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/task.h" | 7 #include "base/task.h" |
8 #include "chrome/browser/chromeos/cros/cros_library.h" | 8 #include "chrome/browser/chromeos/cros/cros_library.h" |
9 #include "content/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 NewRunnableFunction( | 74 NewRunnableFunction( |
75 &NetworkChangeNotifierChromeos::UpdateInitialState, this), | 75 &NetworkChangeNotifierChromeos::UpdateInitialState, this), |
76 kOnlineNotificationDelayMS); | 76 kOnlineNotificationDelayMS); |
77 } | 77 } |
78 | 78 |
79 NetworkChangeNotifierChromeos::~NetworkChangeNotifierChromeos() { | 79 NetworkChangeNotifierChromeos::~NetworkChangeNotifierChromeos() { |
80 if (online_notification_task_) { | 80 if (online_notification_task_) { |
81 online_notification_task_->Cancel(); | 81 online_notification_task_->Cancel(); |
82 online_notification_task_ = NULL; | 82 online_notification_task_ = NULL; |
83 } | 83 } |
| 84 if (!chromeos::CrosLibrary::Get()) |
| 85 return; |
84 chromeos::NetworkLibrary* lib = | 86 chromeos::NetworkLibrary* lib = |
85 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 87 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
86 lib->RemoveNetworkManagerObserver(this); | 88 lib->RemoveNetworkManagerObserver(this); |
87 lib->RemoveObserverForAllNetworks(this); | 89 lib->RemoveObserverForAllNetworks(this); |
88 | 90 |
89 chromeos::PowerLibrary* power = | 91 chromeos::PowerLibrary* power = |
90 chromeos::CrosLibrary::Get()->GetPowerLibrary(); | 92 chromeos::CrosLibrary::Get()->GetPowerLibrary(); |
91 power->RemoveObserver(this); | 93 power->RemoveObserver(this); |
92 } | 94 } |
93 | 95 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 254 |
253 // static | 255 // static |
254 void NetworkChangeNotifierChromeos::UpdateInitialState( | 256 void NetworkChangeNotifierChromeos::UpdateInitialState( |
255 NetworkChangeNotifierChromeos* self) { | 257 NetworkChangeNotifierChromeos* self) { |
256 chromeos::NetworkLibrary* net = | 258 chromeos::NetworkLibrary* net = |
257 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 259 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
258 self->UpdateNetworkState(net); | 260 self->UpdateNetworkState(net); |
259 } | 261 } |
260 | 262 |
261 } // namespace net | 263 } // namespace net |
OLD | NEW |