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 "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 NetworkChangeNotifierChromeos::~NetworkChangeNotifierChromeos() { | 76 NetworkChangeNotifierChromeos::~NetworkChangeNotifierChromeos() { |
77 } | 77 } |
78 | 78 |
79 void NetworkChangeNotifierChromeos::Init() { | 79 void NetworkChangeNotifierChromeos::Init() { |
80 chromeos::NetworkLibrary* network_library = | 80 chromeos::NetworkLibrary* network_library = |
81 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 81 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
82 network_library->AddNetworkManagerObserver(this); | 82 network_library->AddNetworkManagerObserver(this); |
83 | 83 |
84 chromeos::CrosLibrary::Get()->GetPowerLibrary() | 84 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
85 ->AddObserver(this); | |
86 | 85 |
87 UpdateNetworkState(network_library); | 86 UpdateNetworkState(network_library); |
88 } | 87 } |
89 | 88 |
90 void NetworkChangeNotifierChromeos::Shutdown() { | 89 void NetworkChangeNotifierChromeos::Shutdown() { |
91 if (online_notification_task_) { | 90 if (online_notification_task_) { |
92 online_notification_task_->Cancel(); | 91 online_notification_task_->Cancel(); |
93 online_notification_task_ = NULL; | 92 online_notification_task_ = NULL; |
94 } | 93 } |
95 if (!chromeos::CrosLibrary::Get()) | 94 if (!chromeos::CrosLibrary::Get()) |
96 return; | 95 return; |
97 chromeos::NetworkLibrary* lib = | 96 chromeos::NetworkLibrary* lib = |
98 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 97 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
99 lib->RemoveNetworkManagerObserver(this); | 98 lib->RemoveNetworkManagerObserver(this); |
100 lib->RemoveObserverForAllNetworks(this); | 99 lib->RemoveObserverForAllNetworks(this); |
101 | 100 |
102 chromeos::CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this); | 101 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
103 chromeos::DBusThreadManager::Get()->GetPowerManagerClient() | |
104 ->RemoveObserver(this); | |
105 } | 102 } |
106 | 103 |
107 void NetworkChangeNotifierChromeos::PowerChanged( | 104 void NetworkChangeNotifierChromeos::PowerChanged( |
108 const PowerSupplyStatus& status) { | 105 const PowerSupplyStatus& status) { |
109 } | 106 } |
110 | 107 |
111 void NetworkChangeNotifierChromeos::SystemResumed() { | 108 void NetworkChangeNotifierChromeos::SystemResumed() { |
112 // Force invalidation of various net resources on system resume. | 109 // Force invalidation of various net resources on system resume. |
113 BrowserThread::PostTask( | 110 BrowserThread::PostTask( |
114 BrowserThread::IO, FROM_HERE, | 111 BrowserThread::IO, FROM_HERE, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 254 |
258 // static | 255 // static |
259 void NetworkChangeNotifierChromeos::UpdateInitialState( | 256 void NetworkChangeNotifierChromeos::UpdateInitialState( |
260 NetworkChangeNotifierChromeos* self) { | 257 NetworkChangeNotifierChromeos* self) { |
261 chromeos::NetworkLibrary* net = | 258 chromeos::NetworkLibrary* net = |
262 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 259 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
263 self->UpdateNetworkState(net); | 260 self->UpdateNetworkState(net); |
264 } | 261 } |
265 | 262 |
266 } // namespace chromeos | 263 } // namespace chromeos |
OLD | NEW |