OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NETWORK_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_NETWORK_LIBRARY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_NETWORK_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_NETWORK_LIBRARY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/chromeos/cros/network_library.h" | 13 #include "chrome/browser/chromeos/cros/network_library.h" |
| 14 #include "chromeos/dbus/power_manager_client.h" |
14 #include "chromeos/dbus/root_power_manager_observer.h" | 15 #include "chromeos/dbus/root_power_manager_observer.h" |
15 #include "net/base/network_change_notifier.h" | 16 #include "net/base/network_change_notifier.h" |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 | 19 |
19 class OnlineStatusReportThreadTask; | 20 class OnlineStatusReportThreadTask; |
20 | 21 |
21 class NetworkChangeNotifierNetworkLibrary | 22 class NetworkChangeNotifierNetworkLibrary |
22 : public net::NetworkChangeNotifier, | 23 : public net::NetworkChangeNotifier, |
| 24 public chromeos::PowerManagerClient::Observer, |
23 public chromeos::RootPowerManagerObserver, | 25 public chromeos::RootPowerManagerObserver, |
24 public chromeos::NetworkLibrary::NetworkObserver, | 26 public chromeos::NetworkLibrary::NetworkObserver, |
25 public chromeos::NetworkLibrary::NetworkManagerObserver { | 27 public chromeos::NetworkLibrary::NetworkManagerObserver { |
26 public: | 28 public: |
27 NetworkChangeNotifierNetworkLibrary(); | 29 NetworkChangeNotifierNetworkLibrary(); |
28 virtual ~NetworkChangeNotifierNetworkLibrary(); | 30 virtual ~NetworkChangeNotifierNetworkLibrary(); |
29 | 31 |
30 // Initializes the network change notifier. Starts to observe changes | 32 // Initializes the network change notifier. Starts to observe changes |
31 // from the power manager and the network manager. | 33 // from the power manager and the network manager. |
32 void Init(); | 34 void Init(); |
33 | 35 |
34 // Shutdowns the network change notifier. Stops observing changes from | 36 // Shutdowns the network change notifier. Stops observing changes from |
35 // the power manager and the network manager. | 37 // the power manager and the network manager. |
36 void Shutdown(); | 38 void Shutdown(); |
37 | 39 |
38 private: | 40 private: |
39 friend class OnlineStatusReportThreadTask; | 41 friend class OnlineStatusReportThreadTask; |
40 | 42 |
41 class DnsConfigServiceChromeos; | 43 class DnsConfigServiceChromeos; |
42 | 44 |
| 45 // PowerManagerClient::Observer overrides: |
| 46 virtual void SystemResumed(const base::TimeDelta& sleep_duration) OVERRIDE; |
| 47 |
43 // RootPowerManagerObserver overrides: | 48 // RootPowerManagerObserver overrides: |
| 49 // TODO(derat): Remove this once notifications are sent by powerd. |
44 virtual void OnResume(const base::TimeDelta& sleep_duration) OVERRIDE; | 50 virtual void OnResume(const base::TimeDelta& sleep_duration) OVERRIDE; |
45 | 51 |
46 // NetworkChangeNotifier overrides: | 52 // NetworkChangeNotifier overrides: |
47 virtual net::NetworkChangeNotifier::ConnectionType | 53 virtual net::NetworkChangeNotifier::ConnectionType |
48 GetCurrentConnectionType() const OVERRIDE; | 54 GetCurrentConnectionType() const OVERRIDE; |
49 | 55 |
50 // NetworkManagerObserver overrides: | 56 // NetworkManagerObserver overrides: |
51 virtual void OnNetworkManagerChanged(chromeos::NetworkLibrary* obj) OVERRIDE; | 57 virtual void OnNetworkManagerChanged(chromeos::NetworkLibrary* obj) OVERRIDE; |
52 | 58 |
53 // NetworkObserver overrides: | 59 // NetworkObserver overrides: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 scoped_ptr<DnsConfigServiceChromeos> dns_config_service_; | 106 scoped_ptr<DnsConfigServiceChromeos> dns_config_service_; |
101 | 107 |
102 base::WeakPtrFactory<NetworkChangeNotifierNetworkLibrary> weak_factory_; | 108 base::WeakPtrFactory<NetworkChangeNotifierNetworkLibrary> weak_factory_; |
103 | 109 |
104 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierNetworkLibrary); | 110 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierNetworkLibrary); |
105 }; | 111 }; |
106 | 112 |
107 } // namespace chromeos | 113 } // namespace chromeos |
108 | 114 |
109 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_NETWORK_LIBRARY_H
_ | 115 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_NETWORK_LIBRARY_H
_ |
OLD | NEW |