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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 online_notification_task_->Cancel(); | 92 online_notification_task_->Cancel(); |
92 online_notification_task_ = NULL; | 93 online_notification_task_ = NULL; |
93 } | 94 } |
94 if (!chromeos::CrosLibrary::Get()) | 95 if (!chromeos::CrosLibrary::Get()) |
95 return; | 96 return; |
96 chromeos::NetworkLibrary* lib = | 97 chromeos::NetworkLibrary* lib = |
97 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 98 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
98 lib->RemoveNetworkManagerObserver(this); | 99 lib->RemoveNetworkManagerObserver(this); |
99 lib->RemoveObserverForAllNetworks(this); | 100 lib->RemoveObserverForAllNetworks(this); |
100 | 101 |
101 chromeos::PowerLibrary* power = | 102 chromeos::CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this); |
102 chromeos::CrosLibrary::Get()->GetPowerLibrary(); | 103 chromeos::DBusThreadManager::Get()->GetPowerManagerClient() |
103 power->RemoveObserver(this); | 104 ->RemoveObserver(this); |
104 } | 105 } |
105 | 106 |
106 void NetworkChangeNotifierChromeos::PowerChanged( | 107 void NetworkChangeNotifierChromeos::PowerChanged( |
107 const PowerSupplyStatus& status) { | 108 const PowerSupplyStatus& status) { |
108 } | 109 } |
109 | 110 |
110 void NetworkChangeNotifierChromeos::SystemResumed() { | 111 void NetworkChangeNotifierChromeos::SystemResumed() { |
111 // Force invalidation of various net resources on system resume. | 112 // Force invalidation of various net resources on system resume. |
112 BrowserThread::PostTask( | 113 BrowserThread::PostTask( |
113 BrowserThread::IO, FROM_HERE, | 114 BrowserThread::IO, FROM_HERE, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 257 |
257 // static | 258 // static |
258 void NetworkChangeNotifierChromeos::UpdateInitialState( | 259 void NetworkChangeNotifierChromeos::UpdateInitialState( |
259 NetworkChangeNotifierChromeos* self) { | 260 NetworkChangeNotifierChromeos* self) { |
260 chromeos::NetworkLibrary* net = | 261 chromeos::NetworkLibrary* net = |
261 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 262 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
262 self->UpdateNetworkState(net); | 263 self->UpdateNetworkState(net); |
263 } | 264 } |
264 | 265 |
265 } // namespace chromeos | 266 } // namespace chromeos |
OLD | NEW |