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

Side by Side Diff: chromeos/network/network_sms_handler.cc

Issue 10582028: Re-factor TraySms to use ash::SmsObserver instead of NetoworkSmsHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/sms_observer.cc ('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 "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>
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // NetworkSmsHandler 327 // NetworkSmsHandler
328 328
329 NetworkSmsHandler::NetworkSmsHandler() 329 NetworkSmsHandler::NetworkSmsHandler()
330 : weak_ptr_factory_(this) { 330 : weak_ptr_factory_(this) {
331 } 331 }
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
338 // so that devices added after Init() is called get added to device_handlers_.
339 // See: crbug.com/133416.
340
337 // 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.
338 DBusThreadManager::Get()->GetFlimflamManagerClient()->GetProperties( 342 DBusThreadManager::Get()->GetFlimflamManagerClient()->GetProperties(
339 base::Bind(&NetworkSmsHandler::ManagerPropertiesCallback, 343 base::Bind(&NetworkSmsHandler::ManagerPropertiesCallback,
340 weak_ptr_factory_.GetWeakPtr())); 344 weak_ptr_factory_.GetWeakPtr()));
341 } 345 }
342 346
343 void NetworkSmsHandler::RequestUpdate() { 347 void NetworkSmsHandler::RequestUpdate() {
344 for (ScopedVector<NetworkSmsDeviceHandler>::iterator iter = 348 for (ScopedVector<NetworkSmsDeviceHandler>::iterator iter =
345 device_handlers_.begin(); iter != device_handlers_.end(); ++iter) { 349 device_handlers_.begin(); iter != device_handlers_.end(); ++iter) {
346 (*iter)->RequestUpdate(); 350 (*iter)->RequestUpdate();
(...skipping 27 matching lines...) Expand all
374 << flimflam::kDevicesProperty; 378 << flimflam::kDevicesProperty;
375 return; 379 return;
376 } 380 }
377 const base::ListValue* devices = static_cast<const base::ListValue*>(value); 381 const base::ListValue* devices = static_cast<const base::ListValue*>(value);
378 for (base::ListValue::const_iterator iter = devices->begin(); 382 for (base::ListValue::const_iterator iter = devices->begin();
379 iter != devices->end(); ++iter) { 383 iter != devices->end(); ++iter) {
380 std::string device_path; 384 std::string device_path;
381 (*iter)->GetAsString(&device_path); 385 (*iter)->GetAsString(&device_path);
382 if (!device_path.empty()) { 386 if (!device_path.empty()) {
383 // Request device properties. 387 // Request device properties.
388 VLOG(1) << "GetDeviceProperties: " << device_path;
384 DBusThreadManager::Get()->GetFlimflamDeviceClient()->GetProperties( 389 DBusThreadManager::Get()->GetFlimflamDeviceClient()->GetProperties(
385 dbus::ObjectPath(device_path), 390 dbus::ObjectPath(device_path),
386 base::Bind(&NetworkSmsHandler::DevicePropertiesCallback, 391 base::Bind(&NetworkSmsHandler::DevicePropertiesCallback,
387 weak_ptr_factory_.GetWeakPtr(), 392 weak_ptr_factory_.GetWeakPtr(),
388 device_path)); 393 device_path));
389 } 394 }
390 } 395 }
391 } 396 }
392 397
393 void NetworkSmsHandler::DevicePropertiesCallback( 398 void NetworkSmsHandler::DevicePropertiesCallback(
394 const std::string& device_path, 399 const std::string& device_path,
395 DBusMethodCallStatus call_status, 400 DBusMethodCallStatus call_status,
396 const base::DictionaryValue& properties) { 401 const base::DictionaryValue& properties) {
397 if (call_status != DBUS_METHOD_CALL_SUCCESS) 402 if (call_status != DBUS_METHOD_CALL_SUCCESS) {
403 LOG(ERROR) << "NetworkSmsHandler: ERROR: " << call_status;
398 return; 404 return;
405 }
399 406
400 std::string device_type; 407 std::string device_type;
401 if (!properties.GetStringWithoutPathExpansion( 408 if (!properties.GetStringWithoutPathExpansion(
402 flimflam::kTypeProperty, &device_type)) { 409 flimflam::kTypeProperty, &device_type)) {
403 LOG(ERROR) << "NetworkSmsHandler: No type for: " << device_path; 410 LOG(ERROR) << "NetworkSmsHandler: No type for: " << device_path;
404 return; 411 return;
405 } 412 }
406 if (device_type != flimflam::kTypeCellular) 413 if (device_type != flimflam::kTypeCellular)
407 return; 414 return;
408 415
(...skipping 19 matching lines...) Expand all
428 this, dbus_connection, object_path)); 435 this, dbus_connection, object_path));
429 } else { 436 } else {
430 device_handlers_.push_back( 437 device_handlers_.push_back(
431 new ModemManagerNetworkSmsDeviceHandler( 438 new ModemManagerNetworkSmsDeviceHandler(
432 this, dbus_connection, object_path)); 439 this, dbus_connection, object_path));
433 } 440 }
434 } 441 }
435 442
436 443
437 } // namespace chromeos 444 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/sms_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698