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

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

Issue 15774005: chromeos: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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
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/command_line.h" 10 #include "base/command_line.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Ownership passed to callback 94 // Ownership passed to callback
95 base::DictionaryValue *sms = new base::DictionaryValue(); 95 base::DictionaryValue *sms = new base::DictionaryValue();
96 sms->SetString("Number", "000-000-0000"); 96 sms->SetString("Number", "000-000-0000");
97 sms->SetString("Text", 97 sms->SetString("Text",
98 "SMSClientStubImpl: Test Message: " + object_path.value()); 98 "SMSClientStubImpl: Test Message: " + object_path.value());
99 sms->SetString("Timestamp", "Fri Jun 8 13:26:04 EDT 2012"); 99 sms->SetString("Timestamp", "Fri Jun 8 13:26:04 EDT 2012");
100 100
101 // Run callback asynchronously. 101 // Run callback asynchronously.
102 if (callback.is_null()) 102 if (callback.is_null())
103 return; 103 return;
104 MessageLoop::current()->PostTask( 104 base::MessageLoop::current()->PostTask(
105 FROM_HERE, 105 FROM_HERE,
106 base::Bind(&SMSClientStubImpl::OnGetAll, 106 base::Bind(&SMSClientStubImpl::OnGetAll,
107 weak_ptr_factory_.GetWeakPtr(), 107 weak_ptr_factory_.GetWeakPtr(),
108 base::Owned(sms), 108 base::Owned(sms),
109 callback)); 109 callback));
110 } 110 }
111 111
112 private: 112 private:
113 void OnGetAll(base::DictionaryValue *sms, 113 void OnGetAll(base::DictionaryValue *sms,
114 const GetAllCallback& callback) { 114 const GetAllCallback& callback) {
(...skipping 19 matching lines...) Expand all
134 SMSClient* SMSClient::Create(DBusClientImplementationType type, 134 SMSClient* SMSClient::Create(DBusClientImplementationType type,
135 dbus::Bus* bus) { 135 dbus::Bus* bus) {
136 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) { 136 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) {
137 return new SMSClientImpl(bus); 137 return new SMSClientImpl(bus);
138 } 138 }
139 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 139 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
140 return new SMSClientStubImpl(); 140 return new SMSClientStubImpl();
141 } 141 }
142 142
143 } // namespace chromeos 143 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/shill_service_client_stub.cc ('k') | chromeos/disks/disk_mount_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698