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

Side by Side Diff: chrome/browser/chromeos/cros/sms_watcher.cc

Issue 10532007: SMSWatcher: Use the ModemManager1 dbus interfaces (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
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
« no previous file with comments | « chrome/browser/chromeos/cros/sms_watcher.h ('k') | 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 "chrome/browser/chromeos/cros/sms_watcher.h" 5 #include "chrome/browser/chromeos/cros/sms_watcher.h"
6 6
7 #include <algorithm>
8 #include <deque>
9 #include <string>
10 #include <vector>
11
7 #include "base/bind.h" 12 #include "base/bind.h"
8 #include "base/values.h" 13 #include "base/values.h"
9 #include "chromeos/dbus/dbus_thread_manager.h" 14 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "chromeos/dbus/flimflam_device_client.h" 15 #include "chromeos/dbus/flimflam_device_client.h"
11 #include "chromeos/dbus/gsm_sms_client.h" 16 #include "chromeos/dbus/gsm_sms_client.h"
17 #include "chromeos/dbus/modem_messaging_client.h"
18 #include "chromeos/dbus/sms_client.h"
12 #include "third_party/cros_system_api/dbus/service_constants.h" 19 #include "third_party/cros_system_api/dbus/service_constants.h"
13 20
14 namespace chromeos { 21 namespace chromeos {
15 22
16 namespace { 23 namespace {
17 24
18 int decode_bcd(const char *s) { 25 int decode_bcd(const char *s) {
19 return (s[0] - '0') * 10 + s[1] - '0'; 26 return (s[0] - '0') * 10 + s[1] - '0';
20 } 27 }
21 28
29 void decode_timestamp(const std::string& sms_timestamp, SMS *sms) {
30 base::Time::Exploded exp;
31 exp.year = decode_bcd(&sms_timestamp[0]);
32 if (exp.year > 95)
33 exp.year += 1900;
34 else
35 exp.year += 2000;
36 exp.month = decode_bcd(&sms_timestamp[2]);
37 exp.day_of_month = decode_bcd(&sms_timestamp[4]);
38 exp.hour = decode_bcd(&sms_timestamp[6]);
39 exp.minute = decode_bcd(&sms_timestamp[8]);
40 exp.second = decode_bcd(&sms_timestamp[10]);
41 exp.millisecond = 0;
42 sms->timestamp = base::Time::FromUTCExploded(exp);
43 int hours = decode_bcd(&sms_timestamp[13]);
44 if (sms_timestamp[12] == '-')
45 hours = -hours;
46 sms->timestamp -= base::TimeDelta::FromHours(hours);
47 }
48
22 // Callback for Delete() method. This method does nothing. 49 // Callback for Delete() method. This method does nothing.
23 void DeleteSMSCallback() {} 50 void DeleteSMSCallback() {}
24 51
25 } // namespace 52 } // namespace
26 53
27 const char SMSWatcher::kNumberKey[] = "number"; 54 const char SMSWatcher::kNumberKey[] = "number";
28 const char SMSWatcher::kTextKey[] = "text"; 55 const char SMSWatcher::kTextKey[] = "text";
29 const char SMSWatcher::kTimestampKey[] = "timestamp"; 56 const char SMSWatcher::kTimestampKey[] = "timestamp";
30 const char SMSWatcher::kSmscKey[] = "smsc"; 57 const char SMSWatcher::kSmscKey[] = "smsc";
31 const char SMSWatcher::kValidityKey[] = "validity"; 58 const char SMSWatcher::kValidityKey[] = "validity";
32 const char SMSWatcher::kClassKey[] = "class"; 59 const char SMSWatcher::kClassKey[] = "class";
33 const char SMSWatcher::kIndexKey[] = "index"; 60 const char SMSWatcher::kIndexKey[] = "index";
34 61
62 const char SMSWatcher::kModemManager1NumberKey[] = "Number";
63 const char SMSWatcher::kModemManager1TextKey[] = "Text";
64 const char SMSWatcher::kModemManager1TimestampKey[] = "Timestamp";
65 const char SMSWatcher::kModemManager1SmscKey[] = "Smsc";
66 const char SMSWatcher::kModemManager1ValidityKey[] = "Validity";
67 const char SMSWatcher::kModemManager1ClassKey[] = "Class";
68 const char SMSWatcher::kModemManager1IndexKey[] = "Index";
69
70 namespace {
71
72 class GsmWatcher : public CrosNetworkWatcher {
stevenjb 2012/06/05 17:48:05 I think what is confusing me is that these two cla
Jason Glasgow 2012/06/05 18:43:45 Yes -- all they really need is a common base class
73 public:
74 GsmWatcher(const std::string& device_path,
75 MonitorSMSCallback callback,
76 void* object,
77 const std::string& dbus_connection,
78 const dbus::ObjectPath& object_path) :
79 device_path_(device_path),
80 callback_(callback),
81 object_(object),
82 weak_ptr_factory_(this),
83 dbus_connection_(dbus_connection),
84 object_path_(object_path) {
85 DBusThreadManager::Get()->GetGsmSMSClient()->SetSmsReceivedHandler(
86 dbus_connection_,
87 object_path_,
88 base::Bind(&GsmWatcher::OnSmsReceived, weak_ptr_factory_.GetWeakPtr()));
89
90 DBusThreadManager::Get()->GetGsmSMSClient()->List(
91 dbus_connection_, object_path_,
92 base::Bind(&GsmWatcher::ListSMSCallback,
93 weak_ptr_factory_.GetWeakPtr()));
94 }
95
96 virtual ~GsmWatcher() {
97 DBusThreadManager::Get()->GetGsmSMSClient()->ResetSmsReceivedHandler(
98 dbus_connection_, object_path_);
99 }
100
101 private:
102 // Callback for SmsReceived signal from ModemManager.Modem.Gsm.SMS
103 void OnSmsReceived(uint32 index, bool complete) {
104 // Only handle complete messages.
105 if (!complete)
106 return;
107 DBusThreadManager::Get()->GetGsmSMSClient()->Get(
108 dbus_connection_, object_path_, index,
109 base::Bind(&GsmWatcher::GetSMSCallback,
110 weak_ptr_factory_.GetWeakPtr(),
111 index));
112 }
113
114 // Runs |callback_| with a SMS.
115 void RunCallbackWithSMS(const base::DictionaryValue& sms_dictionary) {
116 SMS sms;
117
118 std::string number;
119 if (!sms_dictionary.GetStringWithoutPathExpansion(SMSWatcher::kNumberKey,
120 &number))
121 LOG(WARNING) << "SMS did not contain a number";
122 sms.number = number.c_str();
123
124 std::string text;
125 if (!sms_dictionary.GetStringWithoutPathExpansion(SMSWatcher::kTextKey,
126 &text)) {
127 LOG(WARNING) << "SMS did not contain message text";
128 }
129 sms.text = text.c_str();
130
131 std::string sms_timestamp;
132 if (sms_dictionary.GetStringWithoutPathExpansion(SMSWatcher::kTimestampKey,
133 &sms_timestamp)) {
134 decode_timestamp(sms_timestamp, &sms);
135 } else {
136 LOG(WARNING) << "SMS did not contain a timestamp";
137 sms.timestamp = base::Time();
138 }
139
140 std::string smsc;
141 if (!sms_dictionary.GetStringWithoutPathExpansion(SMSWatcher::kSmscKey,
142 &smsc))
143 sms.smsc = NULL;
144 else
145 sms.smsc = smsc.c_str();
146
147 double validity = 0;
148 if (!sms_dictionary.GetDoubleWithoutPathExpansion(SMSWatcher::kValidityKey,
149 &validity))
150 validity = -1;
151 sms.validity = validity;
152
153 double msgclass = 0;
154 if (!sms_dictionary.GetDoubleWithoutPathExpansion(SMSWatcher::kClassKey,
155 &msgclass))
156 msgclass = -1;
157 sms.msgclass = msgclass;
158
159 callback_(object_, device_path_.c_str(), &sms);
160 }
161
162 // Callback for Get() method from ModemManager.Modem.Gsm.SMS
163 void GetSMSCallback(uint32 index,
164 const base::DictionaryValue& sms_dictionary) {
165 RunCallbackWithSMS(sms_dictionary);
166
167 DBusThreadManager::Get()->GetGsmSMSClient()->Delete(
168 dbus_connection_, object_path_, index, base::Bind(&DeleteSMSCallback));
169 }
170
171 // Callback for List() method.
172 void ListSMSCallback(const base::ListValue& result) {
173 // List() is called only once; no one touches delete_queue_ before List().
174 CHECK(delete_queue_.empty());
175 for (size_t i = 0; i != result.GetSize(); ++i) {
176 base::DictionaryValue* sms_dictionary = NULL;
177 if (!result.GetDictionary(i, &sms_dictionary)) {
178 LOG(ERROR) << "result[" << i << "] is not a dictionary.";
179 continue;
180 }
181 RunCallbackWithSMS(*sms_dictionary);
182 double index = 0;
183 if (sms_dictionary->GetDoubleWithoutPathExpansion(SMSWatcher::kIndexKey,
184 &index)) {
185 delete_queue_.push_back(index);
186 }
187 }
188 DeleteSMSInChain();
189 }
190
191 // Deletes SMSs in the queue.
192 void DeleteSMSInChain() {
193 if (!delete_queue_.empty()) {
194 DBusThreadManager::Get()->GetGsmSMSClient()->Delete(
195 dbus_connection_, object_path_, delete_queue_.back(),
196 base::Bind(&GsmWatcher::DeleteSMSInChain,
197 weak_ptr_factory_.GetWeakPtr()));
198 delete_queue_.pop_back();
199 }
200 }
201
202 std::string device_path_;
203 MonitorSMSCallback callback_;
204 void* object_;
205 base::WeakPtrFactory<GsmWatcher> weak_ptr_factory_;
206 std::string dbus_connection_;
207 dbus::ObjectPath object_path_;
208 std::vector<uint32> delete_queue_;
209
210 DISALLOW_COPY_AND_ASSIGN(GsmWatcher);
211 };
212
213 class ModemManager1Watcher : public CrosNetworkWatcher {
214 public:
215 ModemManager1Watcher(const std::string& device_path,
216 MonitorSMSCallback callback,
217 void *object,
218 const std::string& dbus_connection,
219 const dbus::ObjectPath& object_path) :
220 device_path_(device_path),
221 callback_(callback),
222 object_(object),
223 weak_ptr_factory_(this),
224 dbus_connection_(dbus_connection),
225 object_path_(object_path),
226 deleting_messages_(false),
227 retrieving_messages_(false) {
228 DBusThreadManager::Get()->GetModemMessagingClient()->SetSmsReceivedHandler(
229 dbus_connection_,
230 object_path_,
231 base::Bind(&ModemManager1Watcher::OnSmsReceived,
232 weak_ptr_factory_.GetWeakPtr()));
233
234 DBusThreadManager::Get()->GetModemMessagingClient()->List(
235 dbus_connection_, object_path_,
236 base::Bind(&ModemManager1Watcher::ListSMSCallback,
237 weak_ptr_factory_.GetWeakPtr()));
238 }
239
240 virtual ~ModemManager1Watcher() {
241 DBusThreadManager::Get()->GetModemMessagingClient()
242 ->ResetSmsReceivedHandler(dbus_connection_, object_path_);
243 }
244
245 private:
246 void ListSMSCallback(
247 const std::vector<dbus::ObjectPath>& paths) {
248 // This receives all messages, so clear any pending gets and deletes.
249 retrieval_queue_.clear();
250 delete_queue_.clear();
251
252 std::copy(paths.begin(), paths.end(), retrieval_queue_.begin());
253 if (!retrieving_messages_)
254 GetMessages();
255 }
256
257 // Messages must be deleted one at a time, since we can not
258 // guarantee the order the deletion will be executed in. Delete
259 // messages from the back of the list so that the indices are
260 // valid.
261 void DeleteMessages() {
262 if (delete_queue_.empty()) {
263 deleting_messages_ = false;
264 return;
265 }
266 deleting_messages_ = true;
267 dbus::ObjectPath sms_path = delete_queue_.back();
268 delete_queue_.pop_back();
269 DBusThreadManager::Get()->GetModemMessagingClient()->Delete(
270 dbus_connection_, object_path_, sms_path,
271 base::Bind(&ModemManager1Watcher::DeleteMessages,
272 weak_ptr_factory_.GetWeakPtr()));
273 }
274
275 // Messages must be fetched one at a time, so that we do not queue too
276 // many requests to a single threaded server.
277 void GetMessages() {
278 if (retrieval_queue_.empty()) {
279 retrieving_messages_ = false;
280 if (!deleting_messages_)
281 DeleteMessages();
282 return;
283 }
284 retrieving_messages_ = true;
285 dbus::ObjectPath sms_path = retrieval_queue_.front();
286 retrieval_queue_.pop_front();
287 DBusThreadManager::Get()->GetSMSClient()->GetAll(
288 dbus_connection_, sms_path,
289 base::Bind(&ModemManager1Watcher::GetCallback,
290 weak_ptr_factory_.GetWeakPtr()));
291 delete_queue_.push_back(sms_path);
292 }
293
294 // Handles arrival of a new SMS message.
295 void OnSmsReceived(const dbus::ObjectPath& sms_path, bool complete) {
296 // Only handle complete messages.
297 if (!complete)
298 return;
299 retrieval_queue_.push_back(sms_path);
300 if (!retrieving_messages_)
301 GetMessages();
302 }
303
304 // Runs |callback_| with a SMS.
305 void RunCallbackWithSMS(const base::DictionaryValue& sms_dictionary) {
306 SMS sms;
307
308 std::string number;
309 if (!sms_dictionary.GetStringWithoutPathExpansion(
310 SMSWatcher::kModemManager1NumberKey, &number))
311 LOG(WARNING) << "SMS did not contain a number";
312 sms.number = number.c_str();
313
314 std::string text;
315 if (!sms_dictionary.GetStringWithoutPathExpansion(
316 SMSWatcher::kModemManager1TextKey, &text)) {
317 LOG(WARNING) << "SMS did not contain message text";
318 }
319 sms.text = text.c_str();
320
321 std::string sms_timestamp;
322 if (sms_dictionary.GetStringWithoutPathExpansion(
323 SMSWatcher::kModemManager1TimestampKey, &sms_timestamp)) {
324 decode_timestamp(sms_timestamp, &sms);
325 } else {
326 LOG(WARNING) << "SMS did not contain a timestamp";
327 sms.timestamp = base::Time();
328 }
329
330 std::string smsc;
331 if (!sms_dictionary.GetStringWithoutPathExpansion(
332 SMSWatcher::kModemManager1SmscKey, &smsc))
333 sms.smsc = NULL;
334 else
335 sms.smsc = smsc.c_str();
336
337 double validity = 0;
338 if (!sms_dictionary.GetDoubleWithoutPathExpansion(
339 SMSWatcher::kModemManager1ValidityKey, &validity))
340 validity = -1;
341 sms.validity = validity;
342
343 double msgclass = 0;
344 if (!sms_dictionary.GetDoubleWithoutPathExpansion(
345 SMSWatcher::kModemManager1ClassKey, &msgclass))
346 msgclass = -1;
347 sms.msgclass = msgclass;
348
349 callback_(object_, device_path_.c_str(), &sms);
350 }
351
352 void GetCallback(const base::DictionaryValue& dictionary) {
353 RunCallbackWithSMS(dictionary);
354 GetMessages();
355 }
356
357 std::string device_path_;
358 MonitorSMSCallback callback_;
359 void* object_;
360 base::WeakPtrFactory<ModemManager1Watcher> weak_ptr_factory_;
361 std::string dbus_connection_;
362 dbus::ObjectPath object_path_;
363 bool deleting_messages_;
364 bool retrieving_messages_;
365 std::vector<dbus::ObjectPath> delete_queue_;
366 std::deque<dbus::ObjectPath> retrieval_queue_;
367
368 DISALLOW_COPY_AND_ASSIGN(ModemManager1Watcher);
369 };
370
371 } // namespace
372
35 SMSWatcher::SMSWatcher(const std::string& modem_device_path, 373 SMSWatcher::SMSWatcher(const std::string& modem_device_path,
36 MonitorSMSCallback callback, 374 MonitorSMSCallback callback,
37 void* object) 375 void* object)
38 : weak_ptr_factory_(this), 376 : weak_ptr_factory_(this),
39 device_path_(modem_device_path), 377 device_path_(modem_device_path),
40 callback_(callback), 378 callback_(callback),
41 object_(object) { 379 object_(object) {
42 DBusThreadManager::Get()->GetFlimflamDeviceClient()->GetProperties( 380 DBusThreadManager::Get()->GetFlimflamDeviceClient()->GetProperties(
43 dbus::ObjectPath(modem_device_path), 381 dbus::ObjectPath(modem_device_path),
44 base::Bind(&SMSWatcher::DevicePropertiesCallback, 382 base::Bind(&SMSWatcher::DevicePropertiesCallback,
45 weak_ptr_factory_.GetWeakPtr())); 383 weak_ptr_factory_.GetWeakPtr()));
46 } 384 }
47 385
48 SMSWatcher::~SMSWatcher() { 386 SMSWatcher::~SMSWatcher() {
49 if (!dbus_connection_.empty() && !object_path_.value().empty()) {
50 DBusThreadManager::Get()->GetGsmSMSClient()->ResetSmsReceivedHandler(
51 dbus_connection_, object_path_);
52 }
53 } 387 }
54 388
55 void SMSWatcher::DevicePropertiesCallback( 389 void SMSWatcher::DevicePropertiesCallback(
56 DBusMethodCallStatus call_status, 390 DBusMethodCallStatus call_status,
57 const base::DictionaryValue& properties) { 391 const base::DictionaryValue& properties) {
58 if (call_status != DBUS_METHOD_CALL_SUCCESS) 392 if (call_status != DBUS_METHOD_CALL_SUCCESS)
59 return; 393 return;
60 394
395 std::string dbus_connection;
61 if (!properties.GetStringWithoutPathExpansion( 396 if (!properties.GetStringWithoutPathExpansion(
62 flimflam::kDBusConnectionProperty, &dbus_connection_)) { 397 flimflam::kDBusConnectionProperty, &dbus_connection)) {
63 LOG(WARNING) << "Modem device properties do not include DBus connection."; 398 LOG(WARNING) << "Modem device properties do not include DBus connection.";
64 return; 399 return;
65 } 400 }
66 401
67 std::string object_path_string; 402 std::string object_path_string;
68 if (!properties.GetStringWithoutPathExpansion( 403 if (!properties.GetStringWithoutPathExpansion(
69 flimflam::kDBusObjectProperty, &object_path_string)) { 404 flimflam::kDBusObjectProperty, &object_path_string)) {
70 LOG(WARNING) << "Modem device properties do not include DBus object."; 405 LOG(WARNING) << "Modem device properties do not include DBus object.";
71 return; 406 return;
72 } 407 }
73 object_path_ = dbus::ObjectPath(object_path_string);
74 408
75 DBusThreadManager::Get()->GetGsmSMSClient()->SetSmsReceivedHandler( 409 // TODO(jglasgow): or is it modemmanager::kModemManager1 ???
76 dbus_connection_, 410 if (object_path_string.compare(
77 object_path_, 411 0, sizeof(modemmanager::kModemManager1ServicePath) - 1,
78 base::Bind(&SMSWatcher::OnSmsReceived, weak_ptr_factory_.GetWeakPtr())); 412 modemmanager::kModemManager1ServicePath) == 0) {
79 413 watcher_.reset(
80 DBusThreadManager::Get()->GetGsmSMSClient()->List( 414 new ModemManager1Watcher(device_path_,
81 dbus_connection_, object_path_, 415 callback_, object_, dbus_connection,
82 base::Bind(&SMSWatcher::ListSMSCallback, 416 dbus::ObjectPath(object_path_string)));
83 weak_ptr_factory_.GetWeakPtr()));
84 }
85
86 void SMSWatcher::OnSmsReceived(uint32 index, bool complete) {
87 // Only handle complete messages.
88 if (!complete)
89 return;
90 DBusThreadManager::Get()->GetGsmSMSClient()->Get(
91 dbus_connection_, object_path_, index,
92 base::Bind(&SMSWatcher::GetSMSCallback,
93 weak_ptr_factory_.GetWeakPtr(),
94 index));
95 }
96
97 void SMSWatcher::RunCallbackWithSMS(
98 const base::DictionaryValue& sms_dictionary) {
99 SMS sms;
100
101 std::string number;
102 if (!sms_dictionary.GetStringWithoutPathExpansion(kNumberKey, &number))
103 LOG(WARNING) << "SMS did not contain a number";
104 sms.number = number.c_str();
105
106 std::string text;
107 if (!sms_dictionary.GetStringWithoutPathExpansion(kTextKey, &text)) {
108 LOG(WARNING) << "SMS did not contain message text";
109 }
110 sms.text = text.c_str();
111
112 std::string sms_timestamp;
113 if (sms_dictionary.GetStringWithoutPathExpansion(kTimestampKey,
114 &sms_timestamp)) {
115 base::Time::Exploded exp;
116 exp.year = decode_bcd(&sms_timestamp[0]);
117 if (exp.year > 95)
118 exp.year += 1900;
119 else
120 exp.year += 2000;
121 exp.month = decode_bcd(&sms_timestamp[2]);
122 exp.day_of_month = decode_bcd(&sms_timestamp[4]);
123 exp.hour = decode_bcd(&sms_timestamp[6]);
124 exp.minute = decode_bcd(&sms_timestamp[8]);
125 exp.second = decode_bcd(&sms_timestamp[10]);
126 exp.millisecond = 0;
127 sms.timestamp = base::Time::FromUTCExploded(exp);
128 int hours = decode_bcd(&sms_timestamp[13]);
129 if (sms_timestamp[12] == '-')
130 hours = -hours;
131 sms.timestamp -= base::TimeDelta::FromHours(hours);
132 } else { 417 } else {
133 LOG(WARNING) << "SMS did not contain a timestamp"; 418 watcher_.reset(
134 sms.timestamp = base::Time(); 419 new GsmWatcher(device_path_,
135 } 420 callback_, object_, dbus_connection,
136 421 dbus::ObjectPath(object_path_string)));
137 std::string smsc;
138 if (!sms_dictionary.GetStringWithoutPathExpansion(kSmscKey, &smsc))
139 sms.smsc = NULL;
140 else
141 sms.smsc = smsc.c_str();
142
143 double validity = 0;
144 if (!sms_dictionary.GetDoubleWithoutPathExpansion(kValidityKey, &validity))
145 validity = -1;
146 sms.validity = validity;
147
148 double msgclass = 0;
149 if (!sms_dictionary.GetDoubleWithoutPathExpansion(kClassKey, &msgclass))
150 msgclass = -1;
151 sms.msgclass = msgclass;
152
153 callback_(object_, device_path_.c_str(), &sms);
154 }
155
156 void SMSWatcher::GetSMSCallback(uint32 index,
157 const base::DictionaryValue& sms_dictionary) {
158 RunCallbackWithSMS(sms_dictionary);
159
160 DBusThreadManager::Get()->GetGsmSMSClient()->Delete(
161 dbus_connection_, object_path_, index, base::Bind(&DeleteSMSCallback));
162 }
163
164 void SMSWatcher::ListSMSCallback(const base::ListValue& result) {
165 // List() is called only once and no one touches delete_queue_ before List().
166 CHECK(delete_queue_.empty());
167 for (size_t i = 0; i != result.GetSize(); ++i) {
168 base::DictionaryValue* sms_dictionary = NULL;
169 if (!result.GetDictionary(i, &sms_dictionary)) {
170 LOG(ERROR) << "result[" << i << "] is not a dictionary.";
171 continue;
172 }
173 RunCallbackWithSMS(*sms_dictionary);
174 double index = 0;
175 if (sms_dictionary->GetDoubleWithoutPathExpansion(kIndexKey, &index))
176 delete_queue_.push_back(index);
177 }
178 DeleteSMSInChain();
179 }
180
181 void SMSWatcher::DeleteSMSInChain() {
182 if (!delete_queue_.empty()) {
183 DBusThreadManager::Get()->GetGsmSMSClient()->Delete(
184 dbus_connection_, object_path_, delete_queue_.back(),
185 base::Bind(&SMSWatcher::DeleteSMSInChain,
186 weak_ptr_factory_.GetWeakPtr()));
187 delete_queue_.pop_back();
188 } 422 }
189 } 423 }
190 424
191 } // namespace chromeos 425 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/sms_watcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698