| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "chromeos/dbus/dbus_thread_manager.h" | 13 #include "chromeos/dbus/dbus_thread_manager.h" |
| 14 #include "chromeos/dbus/flimflam_device_client.h" | 14 #include "chromeos/dbus/shill_device_client.h" |
| 15 #include "chromeos/dbus/flimflam_manager_client.h" | 15 #include "chromeos/dbus/shill_manager_client.h" |
| 16 #include "chromeos/dbus/gsm_sms_client.h" | 16 #include "chromeos/dbus/gsm_sms_client.h" |
| 17 #include "chromeos/dbus/modem_messaging_client.h" | 17 #include "chromeos/dbus/modem_messaging_client.h" |
| 18 #include "chromeos/dbus/sms_client.h" | 18 #include "chromeos/dbus/sms_client.h" |
| 19 #include "dbus/object_path.h" | 19 #include "dbus/object_path.h" |
| 20 #include "third_party/cros_system_api/dbus/service_constants.h" | 20 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 21 | 21 |
| 22 // Not exposed/exported. | 22 // Not exposed/exported. |
| 23 namespace { | 23 namespace { |
| 24 const char kSmscKey[] = "smsc"; | 24 const char kSmscKey[] = "smsc"; |
| 25 const char kValidityKey[] = "validity"; | 25 const char kValidityKey[] = "validity"; |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 332 |
| 333 NetworkSmsHandler::~NetworkSmsHandler() { | 333 NetworkSmsHandler::~NetworkSmsHandler() { |
| 334 } | 334 } |
| 335 | 335 |
| 336 void NetworkSmsHandler::Init() { | 336 void NetworkSmsHandler::Init() { |
| 337 // TODO(stevenjb): This code needs to monitor changes to Manager.Network | 337 // TODO(stevenjb): This code needs to monitor changes to Manager.Network |
| 338 // so that devices added after Init() is called get added to device_handlers_. | 338 // so that devices added after Init() is called get added to device_handlers_. |
| 339 // See: crbug.com/133416. | 339 // See: crbug.com/133416. |
| 340 | 340 |
| 341 // Request network manager properties so that we can get the list of devices. | 341 // Request network manager properties so that we can get the list of devices. |
| 342 DBusThreadManager::Get()->GetFlimflamManagerClient()->GetProperties( | 342 DBusThreadManager::Get()->GetShillManagerClient()->GetProperties( |
| 343 base::Bind(&NetworkSmsHandler::ManagerPropertiesCallback, | 343 base::Bind(&NetworkSmsHandler::ManagerPropertiesCallback, |
| 344 weak_ptr_factory_.GetWeakPtr())); | 344 weak_ptr_factory_.GetWeakPtr())); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void NetworkSmsHandler::RequestUpdate() { | 347 void NetworkSmsHandler::RequestUpdate() { |
| 348 for (ScopedVector<NetworkSmsDeviceHandler>::iterator iter = | 348 for (ScopedVector<NetworkSmsDeviceHandler>::iterator iter = |
| 349 device_handlers_.begin(); iter != device_handlers_.end(); ++iter) { | 349 device_handlers_.begin(); iter != device_handlers_.end(); ++iter) { |
| 350 (*iter)->RequestUpdate(); | 350 (*iter)->RequestUpdate(); |
| 351 } | 351 } |
| 352 } | 352 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 379 return; | 379 return; |
| 380 } | 380 } |
| 381 const base::ListValue* devices = static_cast<const base::ListValue*>(value); | 381 const base::ListValue* devices = static_cast<const base::ListValue*>(value); |
| 382 for (base::ListValue::const_iterator iter = devices->begin(); | 382 for (base::ListValue::const_iterator iter = devices->begin(); |
| 383 iter != devices->end(); ++iter) { | 383 iter != devices->end(); ++iter) { |
| 384 std::string device_path; | 384 std::string device_path; |
| 385 (*iter)->GetAsString(&device_path); | 385 (*iter)->GetAsString(&device_path); |
| 386 if (!device_path.empty()) { | 386 if (!device_path.empty()) { |
| 387 // Request device properties. | 387 // Request device properties. |
| 388 VLOG(1) << "GetDeviceProperties: " << device_path; | 388 VLOG(1) << "GetDeviceProperties: " << device_path; |
| 389 DBusThreadManager::Get()->GetFlimflamDeviceClient()->GetProperties( | 389 DBusThreadManager::Get()->GetShillDeviceClient()->GetProperties( |
| 390 dbus::ObjectPath(device_path), | 390 dbus::ObjectPath(device_path), |
| 391 base::Bind(&NetworkSmsHandler::DevicePropertiesCallback, | 391 base::Bind(&NetworkSmsHandler::DevicePropertiesCallback, |
| 392 weak_ptr_factory_.GetWeakPtr(), | 392 weak_ptr_factory_.GetWeakPtr(), |
| 393 device_path)); | 393 device_path)); |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 void NetworkSmsHandler::DevicePropertiesCallback( | 398 void NetworkSmsHandler::DevicePropertiesCallback( |
| 399 const std::string& device_path, | 399 const std::string& device_path, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 this, dbus_connection, object_path)); | 435 this, dbus_connection, object_path)); |
| 436 } else { | 436 } else { |
| 437 device_handlers_.push_back( | 437 device_handlers_.push_back( |
| 438 new ModemManagerNetworkSmsDeviceHandler( | 438 new ModemManagerNetworkSmsDeviceHandler( |
| 439 this, dbus_connection, object_path)); | 439 this, dbus_connection, object_path)); |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 | 442 |
| 443 | 443 |
| 444 } // namespace chromeos | 444 } // namespace chromeos |
| OLD | NEW |