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

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

Issue 1540803002: Switch to standard integer types in chromeos/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more includes Created 5 years 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 | « chromeos/dbus/gsm_sms_client.h ('k') | chromeos/dbus/gsm_sms_client_unittest.cc » ('j') | 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/gsm_sms_client.h" 4 #include "chromeos/dbus/gsm_sms_client.h"
5 5
6 #include <stdint.h>
7
6 #include <map> 8 #include <map>
7 #include <utility> 9 #include <utility>
8 #include <vector> 10 #include <vector>
9 11
10 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
13 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
14 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
15 #include "base/values.h" 18 #include "base/values.h"
16 #include "dbus/bus.h" 19 #include "dbus/bus.h"
17 #include "dbus/message.h" 20 #include "dbus/message.h"
18 #include "dbus/object_proxy.h" 21 #include "dbus/object_proxy.h"
19 #include "dbus/values_util.h" 22 #include "dbus/values_util.h"
20 #include "third_party/cros_system_api/dbus/service_constants.h" 23 #include "third_party/cros_system_api/dbus/service_constants.h"
(...skipping 29 matching lines...) Expand all
50 DCHECK(sms_received_handler_.is_null()); 53 DCHECK(sms_received_handler_.is_null());
51 sms_received_handler_ = handler; 54 sms_received_handler_ = handler;
52 } 55 }
53 56
54 // Resets SmsReceived signal handler. 57 // Resets SmsReceived signal handler.
55 void ResetSmsReceivedHandler() { 58 void ResetSmsReceivedHandler() {
56 sms_received_handler_.Reset(); 59 sms_received_handler_.Reset();
57 } 60 }
58 61
59 // Calls Delete method. 62 // Calls Delete method.
60 void Delete(uint32 index, const DeleteCallback& callback) { 63 void Delete(uint32_t index, const DeleteCallback& callback) {
61 dbus::MethodCall method_call(modemmanager::kModemManagerSMSInterface, 64 dbus::MethodCall method_call(modemmanager::kModemManagerSMSInterface,
62 modemmanager::kSMSDeleteFunction); 65 modemmanager::kSMSDeleteFunction);
63 dbus::MessageWriter writer(&method_call); 66 dbus::MessageWriter writer(&method_call);
64 writer.AppendUint32(index); 67 writer.AppendUint32(index);
65 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 68 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
66 base::Bind(&SMSProxy::OnDelete, 69 base::Bind(&SMSProxy::OnDelete,
67 weak_ptr_factory_.GetWeakPtr(), 70 weak_ptr_factory_.GetWeakPtr(),
68 callback)); 71 callback));
69 } 72 }
70 73
71 // Calls Get method. 74 // Calls Get method.
72 void Get(uint32 index, const GetCallback& callback) { 75 void Get(uint32_t index, const GetCallback& callback) {
73 dbus::MethodCall method_call(modemmanager::kModemManagerSMSInterface, 76 dbus::MethodCall method_call(modemmanager::kModemManagerSMSInterface,
74 modemmanager::kSMSGetFunction); 77 modemmanager::kSMSGetFunction);
75 dbus::MessageWriter writer(&method_call); 78 dbus::MessageWriter writer(&method_call);
76 writer.AppendUint32(index); 79 writer.AppendUint32(index);
77 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 80 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
78 base::Bind(&SMSProxy::OnGet, 81 base::Bind(&SMSProxy::OnGet,
79 weak_ptr_factory_.GetWeakPtr(), 82 weak_ptr_factory_.GetWeakPtr(),
80 callback)); 83 callback));
81 } 84 }
82 85
83 // Calls List method. 86 // Calls List method.
84 void List(const ListCallback& callback) { 87 void List(const ListCallback& callback) {
85 dbus::MethodCall method_call(modemmanager::kModemManagerSMSInterface, 88 dbus::MethodCall method_call(modemmanager::kModemManagerSMSInterface,
86 modemmanager::kSMSListFunction); 89 modemmanager::kSMSListFunction);
87 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 90 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
88 base::Bind(&SMSProxy::OnList, 91 base::Bind(&SMSProxy::OnList,
89 weak_ptr_factory_.GetWeakPtr(), 92 weak_ptr_factory_.GetWeakPtr(),
90 callback)); 93 callback));
91 } 94 }
92 95
93 private: 96 private:
94 // Handles SmsReceived signal. 97 // Handles SmsReceived signal.
95 void OnSmsReceived(dbus::Signal* signal) { 98 void OnSmsReceived(dbus::Signal* signal) {
96 uint32 index = 0; 99 uint32_t index = 0;
97 bool complete = false; 100 bool complete = false;
98 dbus::MessageReader reader(signal); 101 dbus::MessageReader reader(signal);
99 if (!reader.PopUint32(&index) || 102 if (!reader.PopUint32(&index) ||
100 !reader.PopBool(&complete)) { 103 !reader.PopBool(&complete)) {
101 LOG(ERROR) << "Invalid signal: " << signal->ToString(); 104 LOG(ERROR) << "Invalid signal: " << signal->ToString();
102 return; 105 return;
103 } 106 }
104 if (!sms_received_handler_.is_null()) 107 if (!sms_received_handler_.is_null())
105 sms_received_handler_.Run(index, complete); 108 sms_received_handler_.Run(index, complete);
106 } 109 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 175
173 // GsmSMSClient override. 176 // GsmSMSClient override.
174 void ResetSmsReceivedHandler(const std::string& service_name, 177 void ResetSmsReceivedHandler(const std::string& service_name,
175 const dbus::ObjectPath& object_path) override { 178 const dbus::ObjectPath& object_path) override {
176 GetProxy(service_name, object_path)->ResetSmsReceivedHandler(); 179 GetProxy(service_name, object_path)->ResetSmsReceivedHandler();
177 } 180 }
178 181
179 // GsmSMSClient override. 182 // GsmSMSClient override.
180 void Delete(const std::string& service_name, 183 void Delete(const std::string& service_name,
181 const dbus::ObjectPath& object_path, 184 const dbus::ObjectPath& object_path,
182 uint32 index, 185 uint32_t index,
183 const DeleteCallback& callback) override { 186 const DeleteCallback& callback) override {
184 GetProxy(service_name, object_path)->Delete(index, callback); 187 GetProxy(service_name, object_path)->Delete(index, callback);
185 } 188 }
186 189
187 // GsmSMSClient override. 190 // GsmSMSClient override.
188 void Get(const std::string& service_name, 191 void Get(const std::string& service_name,
189 const dbus::ObjectPath& object_path, 192 const dbus::ObjectPath& object_path,
190 uint32 index, 193 uint32_t index,
191 const GetCallback& callback) override { 194 const GetCallback& callback) override {
192 GetProxy(service_name, object_path)->Get(index, callback); 195 GetProxy(service_name, object_path)->Get(index, callback);
193 } 196 }
194 197
195 // GsmSMSClient override. 198 // GsmSMSClient override.
196 void List(const std::string& service_name, 199 void List(const std::string& service_name,
197 const dbus::ObjectPath& object_path, 200 const dbus::ObjectPath& object_path,
198 const ListCallback& callback) override { 201 const ListCallback& callback) override {
199 GetProxy(service_name, object_path)->List(callback); 202 GetProxy(service_name, object_path)->List(callback);
200 } 203 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 GsmSMSClient::GsmSMSClient() {} 242 GsmSMSClient::GsmSMSClient() {}
240 243
241 GsmSMSClient::~GsmSMSClient() {} 244 GsmSMSClient::~GsmSMSClient() {}
242 245
243 // static 246 // static
244 GsmSMSClient* GsmSMSClient::Create() { 247 GsmSMSClient* GsmSMSClient::Create() {
245 return new GsmSMSClientImpl(); 248 return new GsmSMSClientImpl();
246 } 249 }
247 250
248 } // namespace chromeos 251 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/gsm_sms_client.h ('k') | chromeos/dbus/gsm_sms_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698