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

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

Issue 10535127: Fix clang compile failure in chromeos::SMSClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« 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 #include "chromeos/dbus/sms_client.h" 4 #include "chromeos/dbus/sms_client.h"
5 5
6 #include <map> 6 #include <map>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 base::Bind(&SMSClientImpl::OnGetAll, 45 base::Bind(&SMSClientImpl::OnGetAll,
46 weak_ptr_factory_.GetWeakPtr(), 46 weak_ptr_factory_.GetWeakPtr(),
47 callback)); 47 callback));
48 } 48 }
49 49
50 private: 50 private:
51 // Handles responses of GetAll method calls. 51 // Handles responses of GetAll method calls.
52 void OnGetAll(const GetAllCallback& callback, dbus::Response* response) { 52 void OnGetAll(const GetAllCallback& callback, dbus::Response* response) {
53 if (!response) { 53 if (!response) {
54 // Must invoke the callback, even if there is no message. 54 // Must invoke the callback, even if there is no message.
55 callback.Run(base::DictionaryValue()); 55 base::DictionaryValue empty_dictionary;
56 callback.Run(empty_dictionary);
56 return; 57 return;
57 } 58 }
58 dbus::MessageReader reader(response); 59 dbus::MessageReader reader(response);
59 scoped_ptr<base::Value> value(dbus::PopDataAsValue(&reader)); 60 scoped_ptr<base::Value> value(dbus::PopDataAsValue(&reader));
60 base::DictionaryValue* dictionary_value = NULL; 61 base::DictionaryValue* dictionary_value = NULL;
61 if (!value.get() || !value->GetAsDictionary(&dictionary_value)) { 62 if (!value.get() || !value->GetAsDictionary(&dictionary_value)) {
62 LOG(WARNING) << "Invalid response: " << response->ToString(); 63 LOG(WARNING) << "Invalid response: " << response->ToString();
63 callback.Run(base::DictionaryValue()); 64 base::DictionaryValue empty_dictionary;
65 callback.Run(empty_dictionary);
64 return; 66 return;
65 } 67 }
66 callback.Run(*dictionary_value); 68 callback.Run(*dictionary_value);
67 } 69 }
68 70
69 dbus::Bus* bus_; 71 dbus::Bus* bus_;
70 base::WeakPtrFactory<SMSClientImpl> weak_ptr_factory_; 72 base::WeakPtrFactory<SMSClientImpl> weak_ptr_factory_;
71 73
72 DISALLOW_COPY_AND_ASSIGN(SMSClientImpl); 74 DISALLOW_COPY_AND_ASSIGN(SMSClientImpl);
73 }; 75 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 SMSClient* SMSClient::Create(DBusClientImplementationType type, 123 SMSClient* SMSClient::Create(DBusClientImplementationType type,
122 dbus::Bus* bus) { 124 dbus::Bus* bus) {
123 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) { 125 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) {
124 return new SMSClientImpl(bus); 126 return new SMSClientImpl(bus);
125 } 127 }
126 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 128 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
127 return new SMSClientStubImpl(); 129 return new SMSClientStubImpl();
128 } 130 }
129 131
130 } // namespace chromeos 132 } // 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