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