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