| 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_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool is_online() { return state_ == ONLINE; } | 95 bool is_online() { return state_ == ONLINE; } |
| 96 State state() const { return state_; } | 96 State state() const { return state_; } |
| 97 std::string last_network_service_path() const { | 97 std::string last_network_service_path() const { |
| 98 return last_network_service_path_; | 98 return last_network_service_path_; |
| 99 } | 99 } |
| 100 ConnectionType last_network_type() const { return last_network_type_; } | 100 ConnectionType last_network_type() const { return last_network_type_; } |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 struct ProxyState { | |
| 104 ProxyState() : configured(false) { | |
| 105 } | |
| 106 | |
| 107 ProxyState(const std::string& proxy_config, bool configured) | |
| 108 : proxy_config(proxy_config), | |
| 109 configured(configured) { | |
| 110 } | |
| 111 | |
| 112 std::string proxy_config; | |
| 113 bool configured; | |
| 114 }; | |
| 115 | |
| 116 typedef std::map<std::string, ProxyState> ProxyStateMap; | |
| 117 | |
| 118 friend class base::RefCounted<NetworkStateInformer>; | 103 friend class base::RefCounted<NetworkStateInformer>; |
| 119 | 104 |
| 120 virtual ~NetworkStateInformer(); | 105 virtual ~NetworkStateInformer(); |
| 121 | 106 |
| 122 bool UpdateState(chromeos::NetworkLibrary* cros); | 107 bool UpdateState(chromeos::NetworkLibrary* cros); |
| 123 | 108 |
| 124 void UpdateStateAndNotify(); | 109 void UpdateStateAndNotify(); |
| 125 | 110 |
| 126 void SendStateToObservers(ErrorScreenActor::ErrorReason reason); | 111 void SendStateToObservers(ErrorScreenActor::ErrorReason reason); |
| 127 | 112 |
| 128 State GetNetworkState(const Network* network); | 113 State GetNetworkState(const Network* network); |
| 129 bool IsProxyConfigured(const Network* network); | 114 bool IsProxyConfigured(const Network* network); |
| 130 | 115 |
| 131 content::NotificationRegistrar registrar_; | 116 content::NotificationRegistrar registrar_; |
| 132 State state_; | 117 State state_; |
| 133 NetworkStateInformerDelegate* delegate_; | 118 NetworkStateInformerDelegate* delegate_; |
| 134 ObserverList<NetworkStateInformerObserver> observers_; | 119 ObserverList<NetworkStateInformerObserver> observers_; |
| 135 std::string last_online_service_path_; | 120 std::string last_online_service_path_; |
| 136 std::string last_connected_service_path_; | 121 std::string last_connected_service_path_; |
| 137 std::string last_network_service_path_; | 122 std::string last_network_service_path_; |
| 138 ConnectionType last_network_type_; | 123 ConnectionType last_network_type_; |
| 139 base::CancelableClosure check_state_; | 124 base::CancelableClosure check_state_; |
| 140 | |
| 141 // Caches proxy state for active networks. | |
| 142 ProxyStateMap proxy_state_map_; | |
| 143 }; | 125 }; |
| 144 | 126 |
| 145 } // namespace chromeos | 127 } // namespace chromeos |
| 146 | 128 |
| 147 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ | 129 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ |
| OLD | NEW |