| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/net/network_change_notifier_chromeos.h" | 5 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/chromeos/cros/cros_library.h" | 8 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 9 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 9 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 10 | 11 |
| 11 using content::BrowserThread; | 12 using content::BrowserThread; |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 // Delay for online change notification reporting. | 16 // Delay for online change notification reporting. |
| 16 const int kOnlineNotificationDelayMS = 500; | 17 const int kOnlineNotificationDelayMS = 500; |
| 17 const int kInitialNotificationCheckDelayMS = 1000; | 18 const int kInitialNotificationCheckDelayMS = 1000; |
| 18 | 19 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 online_notification_task_->Cancel(); | 78 online_notification_task_->Cancel(); |
| 78 online_notification_task_ = NULL; | 79 online_notification_task_ = NULL; |
| 79 } | 80 } |
| 80 if (!chromeos::CrosLibrary::Get()) | 81 if (!chromeos::CrosLibrary::Get()) |
| 81 return; | 82 return; |
| 82 chromeos::NetworkLibrary* lib = | 83 chromeos::NetworkLibrary* lib = |
| 83 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 84 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 84 lib->RemoveNetworkManagerObserver(this); | 85 lib->RemoveNetworkManagerObserver(this); |
| 85 lib->RemoveObserverForAllNetworks(this); | 86 lib->RemoveObserverForAllNetworks(this); |
| 86 | 87 |
| 87 chromeos::PowerLibrary* power = | 88 chromeos::CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this); |
| 88 chromeos::CrosLibrary::Get()->GetPowerLibrary(); | 89 chromeos::DBusThreadManager::Get()->GetPowerManagerClient() |
| 89 power->RemoveObserver(this); | 90 ->RemoveObserver(this); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void NetworkChangeNotifierChromeos::Init() { | 93 void NetworkChangeNotifierChromeos::Init() { |
| 93 chromeos::NetworkLibrary* network_library = | 94 chromeos::NetworkLibrary* network_library = |
| 94 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 95 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 95 network_library->AddNetworkManagerObserver(this); | 96 network_library->AddNetworkManagerObserver(this); |
| 96 | 97 |
| 97 chromeos::CrosLibrary::Get()->GetPowerLibrary() | 98 chromeos::CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this); |
| 99 chromeos::DBusThreadManager::Get()->GetPowerManagerClient() |
| 98 ->AddObserver(this); | 100 ->AddObserver(this); |
| 99 | 101 |
| 100 UpdateNetworkState(network_library); | 102 UpdateNetworkState(network_library); |
| 101 } | 103 } |
| 102 | 104 |
| 103 void NetworkChangeNotifierChromeos::PowerChanged( | 105 void NetworkChangeNotifierChromeos::PowerChanged( |
| 104 const PowerSupplyStatus& status) { | 106 const PowerSupplyStatus& status) { |
| 105 } | 107 } |
| 106 | 108 |
| 107 void NetworkChangeNotifierChromeos::SystemResumed() { | 109 void NetworkChangeNotifierChromeos::SystemResumed() { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 255 |
| 254 // static | 256 // static |
| 255 void NetworkChangeNotifierChromeos::UpdateInitialState( | 257 void NetworkChangeNotifierChromeos::UpdateInitialState( |
| 256 NetworkChangeNotifierChromeos* self) { | 258 NetworkChangeNotifierChromeos* self) { |
| 257 chromeos::NetworkLibrary* net = | 259 chromeos::NetworkLibrary* net = |
| 258 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 260 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 259 self->UpdateNetworkState(net); | 261 self->UpdateNetworkState(net); |
| 260 } | 262 } |
| 261 | 263 |
| 262 } // namespace chromeos | 264 } // namespace chromeos |
| OLD | NEW |