Chromium Code Reviews| 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); |
|
satorux1
2011/11/23 08:30:09
So we weren't calling this before this change. I w
| |
| 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() | 102 chromeos::DBusThreadManager::Get()->GetPowerManagerClient() |
| 104 ->RemoveObserver(this); | 103 ->RemoveObserver(this); |
|
satorux1
2011/11/23 08:30:09
Remove the lines from 102-103. Doing the same thin
Simon Que
2011/11/23 19:24:17
Done.
| |
| 105 } | 104 } |
| 106 | 105 |
| 107 void NetworkChangeNotifierChromeos::PowerChanged( | 106 void NetworkChangeNotifierChromeos::PowerChanged( |
| 108 const PowerSupplyStatus& status) { | 107 const PowerSupplyStatus& status) { |
| 109 } | 108 } |
| 110 | 109 |
| 111 void NetworkChangeNotifierChromeos::SystemResumed() { | 110 void NetworkChangeNotifierChromeos::SystemResumed() { |
| 112 // Force invalidation of various net resources on system resume. | 111 // Force invalidation of various net resources on system resume. |
| 113 BrowserThread::PostTask( | 112 BrowserThread::PostTask( |
| 114 BrowserThread::IO, FROM_HERE, | 113 BrowserThread::IO, FROM_HERE, |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 | 256 |
| 258 // static | 257 // static |
| 259 void NetworkChangeNotifierChromeos::UpdateInitialState( | 258 void NetworkChangeNotifierChromeos::UpdateInitialState( |
| 260 NetworkChangeNotifierChromeos* self) { | 259 NetworkChangeNotifierChromeos* self) { |
| 261 chromeos::NetworkLibrary* net = | 260 chromeos::NetworkLibrary* net = |
| 262 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 261 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 263 self->UpdateNetworkState(net); | 262 self->UpdateNetworkState(net); |
| 264 } | 263 } |
| 265 | 264 |
| 266 } // namespace chromeos | 265 } // namespace chromeos |
| OLD | NEW |