| 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_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_NETWORK_LIBRARY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_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/root_power_manager_observer.h" | 14 #include "chromeos/dbus/root_power_manager_observer.h" |
| 15 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 | 18 |
| 19 class OnlineStatusReportThreadTask; | 19 class OnlineStatusReportThreadTask; |
| 20 | 20 |
| 21 class NetworkChangeNotifierChromeos | 21 class NetworkChangeNotifierNetworkLibrary |
| 22 : public net::NetworkChangeNotifier, | 22 : public net::NetworkChangeNotifier, |
| 23 public chromeos::RootPowerManagerObserver, | 23 public chromeos::RootPowerManagerObserver, |
| 24 public chromeos::NetworkLibrary::NetworkObserver, | 24 public chromeos::NetworkLibrary::NetworkObserver, |
| 25 public chromeos::NetworkLibrary::NetworkManagerObserver { | 25 public chromeos::NetworkLibrary::NetworkManagerObserver { |
| 26 public: | 26 public: |
| 27 NetworkChangeNotifierChromeos(); | 27 NetworkChangeNotifierNetworkLibrary(); |
| 28 virtual ~NetworkChangeNotifierChromeos(); | 28 virtual ~NetworkChangeNotifierNetworkLibrary(); |
| 29 | 29 |
| 30 // Initializes the network change notifier. Starts to observe changes | 30 // Initializes the network change notifier. Starts to observe changes |
| 31 // from the power manager and the network manager. | 31 // from the power manager and the network manager. |
| 32 void Init(); | 32 void Init(); |
| 33 | 33 |
| 34 // Shutdowns the network change notifier. Stops observing changes from | 34 // Shutdowns the network change notifier. Stops observing changes from |
| 35 // the power manager and the network manager. | 35 // the power manager and the network manager. |
| 36 void Shutdown(); | 36 void Shutdown(); |
| 37 | 37 |
| 38 private: | 38 private: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 68 // keep the track the network stack state. | 68 // keep the track the network stack state. |
| 69 void UpdateNetworkStateCallback(chromeos::NetworkLibrary* cros, | 69 void UpdateNetworkStateCallback(chromeos::NetworkLibrary* cros, |
| 70 const NetworkIPConfigVector& ip_configs, | 70 const NetworkIPConfigVector& ip_configs, |
| 71 const std::string& hardware_address); | 71 const std::string& hardware_address); |
| 72 // Updates network connectivity state. | 72 // Updates network connectivity state. |
| 73 void UpdateConnectivityState(const chromeos::Network* network); | 73 void UpdateConnectivityState(const chromeos::Network* network); |
| 74 | 74 |
| 75 // Updates the initial state. Lets us trigger initial eval of the | 75 // Updates the initial state. Lets us trigger initial eval of the |
| 76 // connectivity status without waiting for an event from the connection | 76 // connectivity status without waiting for an event from the connection |
| 77 // manager. | 77 // manager. |
| 78 static void UpdateInitialState(NetworkChangeNotifierChromeos* self); | 78 static void UpdateInitialState(NetworkChangeNotifierNetworkLibrary* self); |
| 79 | 79 |
| 80 // Gets connection type for given |network|. | 80 // Gets connection type for given |network|. |
| 81 static net::NetworkChangeNotifier::ConnectionType GetNetworkConnectionType( | 81 static net::NetworkChangeNotifier::ConnectionType GetNetworkConnectionType( |
| 82 const chromeos::Network* network); | 82 const chromeos::Network* network); |
| 83 | 83 |
| 84 // Get parameters for calculating new combined signal. | 84 // Get parameters for calculating new combined signal. |
| 85 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsChromeos(); | 85 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsChromeos(); |
| 86 | 86 |
| 87 // True if we previously had an active network around. | 87 // True if we previously had an active network around. |
| 88 bool has_active_network_; | 88 bool has_active_network_; |
| 89 // Current active network's connection state. | 89 // Current active network's connection state. |
| 90 chromeos::ConnectionState connection_state_; | 90 chromeos::ConnectionState connection_state_; |
| 91 // Current active network's connection type. | 91 // Current active network's connection type. |
| 92 net::NetworkChangeNotifier::ConnectionType connection_type_; | 92 net::NetworkChangeNotifier::ConnectionType connection_type_; |
| 93 // Current active network's service path. | 93 // Current active network's service path. |
| 94 std::string service_path_; | 94 std::string service_path_; |
| 95 // Current active network's IP address. | 95 // Current active network's IP address. |
| 96 std::string ip_address_; | 96 std::string ip_address_; |
| 97 // Current active network's name servers. | 97 // Current active network's name servers. |
| 98 std::vector<std::string> name_servers_; | 98 std::vector<std::string> name_servers_; |
| 99 | 99 |
| 100 scoped_ptr<DnsConfigServiceChromeos> dns_config_service_; | 100 scoped_ptr<DnsConfigServiceChromeos> dns_config_service_; |
| 101 | 101 |
| 102 base::WeakPtrFactory<NetworkChangeNotifierChromeos> weak_factory_; | 102 base::WeakPtrFactory<NetworkChangeNotifierNetworkLibrary> weak_factory_; |
| 103 | 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierChromeos); | 104 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierNetworkLibrary); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 } // namespace chromeos | 107 } // namespace chromeos |
| 108 | 108 |
| 109 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ | 109 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_NETWORK_LIBRARY_H
_ |
| OLD | NEW |