| 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 | 4 |
| 5 #include "chrome/browser/chromeos/cros/sms_watcher.h" | 5 #include "chrome/browser/chromeos/cros/sms_watcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 DBusThreadManager::Get()->GetGsmSMSClient()->Delete( | 177 DBusThreadManager::Get()->GetGsmSMSClient()->Delete( |
| 178 dbus_connection_, object_path_, index, base::Bind(&DeleteSMSCallback)); | 178 dbus_connection_, object_path_, index, base::Bind(&DeleteSMSCallback)); |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Callback for List() method. | 181 // Callback for List() method. |
| 182 void ListSMSCallback(const base::ListValue& result) { | 182 void ListSMSCallback(const base::ListValue& result) { |
| 183 // List() is called only once; no one touches delete_queue_ before List(). | 183 // List() is called only once; no one touches delete_queue_ before List(). |
| 184 CHECK(delete_queue_.empty()); | 184 CHECK(delete_queue_.empty()); |
| 185 for (size_t i = 0; i != result.GetSize(); ++i) { | 185 for (size_t i = 0; i != result.GetSize(); ++i) { |
| 186 base::DictionaryValue* sms_dictionary = NULL; | 186 const base::DictionaryValue* sms_dictionary = NULL; |
| 187 if (!result.GetDictionary(i, &sms_dictionary)) { | 187 if (!result.GetDictionary(i, &sms_dictionary)) { |
| 188 LOG(ERROR) << "result[" << i << "] is not a dictionary."; | 188 LOG(ERROR) << "result[" << i << "] is not a dictionary."; |
| 189 continue; | 189 continue; |
| 190 } | 190 } |
| 191 RunCallbackWithSMS(*sms_dictionary); | 191 RunCallbackWithSMS(*sms_dictionary); |
| 192 double index = 0; | 192 double index = 0; |
| 193 if (sms_dictionary->GetDoubleWithoutPathExpansion(SMSWatcher::kIndexKey, | 193 if (sms_dictionary->GetDoubleWithoutPathExpansion(SMSWatcher::kIndexKey, |
| 194 &index)) { | 194 &index)) { |
| 195 delete_queue_.push_back(index); | 195 delete_queue_.push_back(index); |
| 196 } | 196 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 new ModemManager1Watcher(device_path_, callback_, dbus_connection, | 400 new ModemManager1Watcher(device_path_, callback_, dbus_connection, |
| 401 dbus::ObjectPath(object_path_string))); | 401 dbus::ObjectPath(object_path_string))); |
| 402 } else { | 402 } else { |
| 403 watcher_.reset( | 403 watcher_.reset( |
| 404 new GsmWatcher(device_path_, callback_, dbus_connection, | 404 new GsmWatcher(device_path_, callback_, dbus_connection, |
| 405 dbus::ObjectPath(object_path_string))); | 405 dbus::ObjectPath(object_path_string))); |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace chromeos | 409 } // namespace chromeos |
| OLD | NEW |