Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chromeos/dbus/bluetooth_input_client.cc

Issue 11734014: Bluetooth: Fix error_message parsing on a dbus connect error response. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698