OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/bluetooth_input_client.h" | 5 #include "chromeos/dbus/bluetooth_input_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // Called when an error for Connect() is received. | 202 // Called when an error for Connect() is received. |
203 void OnConnectError(const dbus::ObjectPath& object_path, | 203 void OnConnectError(const dbus::ObjectPath& object_path, |
204 const ConnectErrorCallback& error_callback, | 204 const ConnectErrorCallback& error_callback, |
205 dbus::ErrorResponse* response) { | 205 dbus::ErrorResponse* response) { |
206 // Error response has optional error message argument. | 206 // Error response has optional error message argument. |
207 std::string error_name; | 207 std::string error_name; |
208 std::string error_message; | 208 std::string error_message; |
209 if (response) { | 209 if (response) { |
210 dbus::MessageReader reader(response); | 210 dbus::MessageReader reader(response); |
211 error_name = response->GetErrorName(); | 211 error_name = response->GetErrorName(); |
212 error_message = reader.PopString(&error_message); | 212 reader.PopString(&error_message); |
213 } else { | 213 } else { |
214 error_name = kNoResponseError; | 214 error_name = kNoResponseError; |
215 error_message = ""; | 215 error_message = ""; |
216 } | 216 } |
217 error_callback.Run(object_path, error_name, error_message); | 217 error_callback.Run(object_path, error_name, error_message); |
218 } | 218 } |
219 | 219 |
220 // Called when a response for Disconnect() is received. | 220 // Called when a response for Disconnect() is received. |
221 void OnDisconnect(const dbus::ObjectPath& object_path, | 221 void OnDisconnect(const dbus::ObjectPath& object_path, |
222 const InputCallback& callback, | 222 const InputCallback& callback, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 DBusClientImplementationType type, | 285 DBusClientImplementationType type, |
286 dbus::Bus* bus, | 286 dbus::Bus* bus, |
287 BluetoothAdapterClient* adapter_client) { | 287 BluetoothAdapterClient* adapter_client) { |
288 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 288 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
289 return new BluetoothInputClientImpl(bus, adapter_client); | 289 return new BluetoothInputClientImpl(bus, adapter_client); |
290 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 290 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
291 return new BluetoothInputClientStubImpl(); | 291 return new BluetoothInputClientStubImpl(); |
292 } | 292 } |
293 | 293 |
294 } // namespace chromeos | 294 } // namespace chromeos |
OLD | NEW |