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 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/task.h" | 11 #include "base/task.h" |
12 #include "chrome/browser/chromeos/cros/network_library.h" | 12 #include "chrome/browser/chromeos/cros/network_library.h" |
13 #include "chrome/browser/chromeos/cros/power_library.h" | 13 #include "chrome/browser/chromeos/cros/power_library.h" |
| 14 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
14 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 | 18 |
18 class OnlineStatusReportThreadTask; | 19 class OnlineStatusReportThreadTask; |
19 | 20 |
20 class NetworkChangeNotifierChromeos | 21 class NetworkChangeNotifierChromeos |
21 : public net::NetworkChangeNotifier, | 22 : public net::NetworkChangeNotifier, |
22 public chromeos::PowerLibrary::Observer, | 23 public chromeos::PowerLibrary::Observer, |
| 24 public chromeos::PowerManagerClient::Observer, |
23 public chromeos::NetworkLibrary::NetworkObserver, | 25 public chromeos::NetworkLibrary::NetworkObserver, |
24 public chromeos::NetworkLibrary::NetworkManagerObserver { | 26 public chromeos::NetworkLibrary::NetworkManagerObserver { |
25 public: | 27 public: |
26 NetworkChangeNotifierChromeos(); | 28 NetworkChangeNotifierChromeos(); |
27 virtual ~NetworkChangeNotifierChromeos(); | 29 virtual ~NetworkChangeNotifierChromeos(); |
28 | 30 |
29 // Initializes the network change notifier. Starts to observe changes | 31 // Initializes the network change notifier. Starts to observe changes |
30 // from the power manager and the network manager. | 32 // from the power manager and the network manager. |
31 void Init(); | 33 void Init(); |
32 | 34 |
33 // Shutdowns the network change notifier. Stops observing changes from | 35 // Shutdowns the network change notifier. Stops observing changes from |
34 // the power manager and the network manager. | 36 // the power manager and the network manager. |
35 void Shutdown(); | 37 void Shutdown(); |
36 | 38 |
37 private: | 39 private: |
38 friend class OnlineStatusReportThreadTask; | 40 friend class OnlineStatusReportThreadTask; |
39 | 41 |
40 // PowerLibrary::Observer overrides. | 42 // PowerManagerClient::Observer overrides. |
41 virtual void PowerChanged(const PowerSupplyStatus& status) OVERRIDE; | 43 virtual void PowerChanged(const PowerSupplyStatus& status) OVERRIDE; |
| 44 |
| 45 // PowerLibrary::Observer overrides |
42 virtual void SystemResumed() OVERRIDE; | 46 virtual void SystemResumed() OVERRIDE; |
43 | 47 |
44 // NetworkChangeNotifier overrides. | 48 // NetworkChangeNotifier overrides. |
45 virtual bool IsCurrentlyOffline() const OVERRIDE; | 49 virtual bool IsCurrentlyOffline() const OVERRIDE; |
46 | 50 |
47 // NetworkManagerObserver overrides: | 51 // NetworkManagerObserver overrides: |
48 virtual void OnNetworkManagerChanged(chromeos::NetworkLibrary* obj) OVERRIDE; | 52 virtual void OnNetworkManagerChanged(chromeos::NetworkLibrary* obj) OVERRIDE; |
49 | 53 |
50 // NetworkObserver overrides: | 54 // NetworkObserver overrides: |
51 virtual void OnNetworkChanged(chromeos::NetworkLibrary* cros, | 55 virtual void OnNetworkChanged(chromeos::NetworkLibrary* cros, |
(...skipping 24 matching lines...) Expand all Loading... |
76 // Current active network's IP address. | 80 // Current active network's IP address. |
77 std::string ip_address_; | 81 std::string ip_address_; |
78 | 82 |
79 OnlineStatusReportThreadTask* online_notification_task_; | 83 OnlineStatusReportThreadTask* online_notification_task_; |
80 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierChromeos); | 84 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierChromeos); |
81 }; | 85 }; |
82 | 86 |
83 } // namespace chromeos | 87 } // namespace chromeos |
84 | 88 |
85 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ | 89 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ |
OLD | NEW |