Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/network_state_informer.h

Issue 14846004: Migrate ProxyConfigServiceImpl to NetworkStateHandler and NetworkProfileHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial patch. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 bool is_online() { return state_ == ONLINE; } 96 bool is_online() { return state_ == ONLINE; }
97 State state() const { return state_; } 97 State state() const { return state_; }
98 std::string last_network_service_path() const { 98 std::string last_network_service_path() const {
99 return last_network_service_path_; 99 return last_network_service_path_;
100 } 100 }
101 ConnectionType last_network_type() const { return last_network_type_; } 101 ConnectionType last_network_type() const { return last_network_type_; }
102 102
103 private: 103 private:
104 struct ProxyState {
105 ProxyState() : configured(false) {
106 }
107
108 ProxyState(const std::string& proxy_config, bool configured)
109 : proxy_config(proxy_config),
110 configured(configured) {
111 }
112
113 std::string proxy_config;
114 bool configured;
115 };
116
117 typedef std::map<std::string, ProxyState> ProxyStateMap;
118
119 friend class base::RefCounted<NetworkStateInformer>; 104 friend class base::RefCounted<NetworkStateInformer>;
120 105
121 virtual ~NetworkStateInformer(); 106 virtual ~NetworkStateInformer();
122 107
123 bool UpdateState(chromeos::NetworkLibrary* cros); 108 bool UpdateState(chromeos::NetworkLibrary* cros);
124 109
125 void UpdateStateAndNotify(); 110 void UpdateStateAndNotify();
126 111
127 void SendStateToObservers(const std::string& reason); 112 void SendStateToObservers(const std::string& reason);
128 113
129 State GetNetworkState(const Network* network); 114 State GetNetworkState(const Network* network);
130 bool IsProxyConfigured(const Network* network); 115 bool IsProxyConfigured(const Network* network);
131 116
132 content::NotificationRegistrar registrar_; 117 content::NotificationRegistrar registrar_;
133 State state_; 118 State state_;
134 NetworkStateInformerDelegate* delegate_; 119 NetworkStateInformerDelegate* delegate_;
135 ObserverList<NetworkStateInformerObserver> observers_; 120 ObserverList<NetworkStateInformerObserver> observers_;
136 std::string last_online_service_path_; 121 std::string last_online_service_path_;
137 std::string last_connected_service_path_; 122 std::string last_connected_service_path_;
138 std::string last_network_service_path_; 123 std::string last_network_service_path_;
139 ConnectionType last_network_type_; 124 ConnectionType last_network_type_;
140 base::CancelableClosure check_state_; 125 base::CancelableClosure check_state_;
141
142 // Caches proxy state for active networks.
143 ProxyStateMap proxy_state_map_;
144 }; 126 };
145 127
146 } // namespace chromeos 128 } // namespace chromeos
147 129
148 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ 130 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698