| 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 #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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |