| 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 "chromeos/network/network_sms_handler.h" | 5 #include "chromeos/network/network_sms_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 DBusThreadManager::Get()->GetGsmSMSClient()->RequestUpdate( | 108 DBusThreadManager::Get()->GetGsmSMSClient()->RequestUpdate( |
| 109 service_name_, object_path_); | 109 service_name_, object_path_); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void NetworkSmsHandler::ModemManagerNetworkSmsDeviceHandler::ListCallback( | 112 void NetworkSmsHandler::ModemManagerNetworkSmsDeviceHandler::ListCallback( |
| 113 const base::ListValue& message_list) { | 113 const base::ListValue& message_list) { |
| 114 // This receives all messages, so clear any pending deletes. | 114 // This receives all messages, so clear any pending deletes. |
| 115 delete_queue_.clear(); | 115 delete_queue_.clear(); |
| 116 for (base::ListValue::const_iterator iter = message_list.begin(); | 116 for (base::ListValue::const_iterator iter = message_list.begin(); |
| 117 iter != message_list.end(); ++iter) { | 117 iter != message_list.end(); ++iter) { |
| 118 const base::DictionaryValue* message = NULL; | 118 base::DictionaryValue* message = NULL; |
| 119 if (iter->GetAsDictionary(&message)) | 119 if (!(*iter)->GetAsDictionary(&message)) |
| 120 continue; | 120 continue; |
| 121 MessageReceived(*message); | 121 MessageReceived(*message); |
| 122 double index = 0; | 122 double index = 0; |
| 123 if (message->GetDoubleWithoutPathExpansion(kIndexKey, &index)) | 123 if (message->GetDoubleWithoutPathExpansion(kIndexKey, &index)) |
| 124 delete_queue_.push_back(static_cast<uint32_t>(index)); | 124 delete_queue_.push_back(static_cast<uint32_t>(index)); |
| 125 } | 125 } |
| 126 DeleteMessages(); | 126 DeleteMessages(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Messages must be deleted one at a time, since we can not guarantee | 129 // Messages must be deleted one at a time, since we can not guarantee |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 return; | 416 return; |
| 417 } | 417 } |
| 418 const base::ListValue* devices = static_cast<const base::ListValue*>(value); | 418 const base::ListValue* devices = static_cast<const base::ListValue*>(value); |
| 419 UpdateDevices(devices); | 419 UpdateDevices(devices); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void NetworkSmsHandler::UpdateDevices(const base::ListValue* devices) { | 422 void NetworkSmsHandler::UpdateDevices(const base::ListValue* devices) { |
| 423 for (base::ListValue::const_iterator iter = devices->begin(); | 423 for (base::ListValue::const_iterator iter = devices->begin(); |
| 424 iter != devices->end(); ++iter) { | 424 iter != devices->end(); ++iter) { |
| 425 std::string device_path; | 425 std::string device_path; |
| 426 iter->GetAsString(&device_path); | 426 (*iter)->GetAsString(&device_path); |
| 427 if (!device_path.empty()) { | 427 if (!device_path.empty()) { |
| 428 // Request device properties. | 428 // Request device properties. |
| 429 VLOG(1) << "GetDeviceProperties: " << device_path; | 429 VLOG(1) << "GetDeviceProperties: " << device_path; |
| 430 DBusThreadManager::Get()->GetShillDeviceClient()->GetProperties( | 430 DBusThreadManager::Get()->GetShillDeviceClient()->GetProperties( |
| 431 dbus::ObjectPath(device_path), | 431 dbus::ObjectPath(device_path), |
| 432 base::Bind(&NetworkSmsHandler::DevicePropertiesCallback, | 432 base::Bind(&NetworkSmsHandler::DevicePropertiesCallback, |
| 433 weak_ptr_factory_.GetWeakPtr(), | 433 weak_ptr_factory_.GetWeakPtr(), |
| 434 device_path)); | 434 device_path)); |
| 435 } | 435 } |
| 436 } | 436 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 base::MakeUnique<ModemManager1NetworkSmsDeviceHandler>( | 474 base::MakeUnique<ModemManager1NetworkSmsDeviceHandler>( |
| 475 this, service_name, object_path)); | 475 this, service_name, object_path)); |
| 476 } else { | 476 } else { |
| 477 device_handlers_.push_back( | 477 device_handlers_.push_back( |
| 478 base::MakeUnique<ModemManagerNetworkSmsDeviceHandler>( | 478 base::MakeUnique<ModemManagerNetworkSmsDeviceHandler>( |
| 479 this, service_name, object_path)); | 479 this, service_name, object_path)); |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace chromeos | 483 } // namespace chromeos |
| OLD | NEW |