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

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

Issue 15294010: Remove NetworkStateInformer's dependency on ProxyConfigServiceImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed IsProxyConfigured. Created 7 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/login/network_state_informer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "base/cancelable_callback.h" 11 #include "base/cancelable_callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h"
14 #include "base/observer_list.h" 15 #include "base/observer_list.h"
15 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h" 16 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h"
16 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" 17 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h"
17 #include "chrome/browser/chromeos/net/network_portal_detector.h" 18 #include "chrome/browser/chromeos/net/network_portal_detector.h"
18 #include "chromeos/network/network_state_handler_observer.h" 19 #include "chromeos/network/network_state_handler_observer.h"
19 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
21 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
22 23
23 namespace chromeos { 24 namespace chromeos {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 88 }
88 89
89 bool is_online() { return state_ == ONLINE; } 90 bool is_online() { return state_ == ONLINE; }
90 State state() const { return state_; } 91 State state() const { return state_; }
91 std::string last_network_service_path() const { 92 std::string last_network_service_path() const {
92 return last_network_service_path_; 93 return last_network_service_path_;
93 } 94 }
94 std::string last_network_type() const { return last_network_type_; } 95 std::string last_network_type() const { return last_network_type_; }
95 96
96 private: 97 private:
97 struct ProxyState {
98 ProxyState() : configured(false) {
99 }
100
101 ProxyState(const std::string& proxy_config, bool configured)
102 : proxy_config(proxy_config),
103 configured(configured) {
104 }
105
106 std::string proxy_config;
107 bool configured;
108 };
109
110 typedef std::map<std::string, ProxyState> ProxyStateMap;
111
112 friend class base::RefCounted<NetworkStateInformer>; 98 friend class base::RefCounted<NetworkStateInformer>;
113 99
114 virtual ~NetworkStateInformer(); 100 virtual ~NetworkStateInformer();
115 101
116 bool UpdateState(); 102 bool UpdateState();
117 103
118 void UpdateStateAndNotify(); 104 void UpdateStateAndNotify();
119 105
120 void SendStateToObservers(ErrorScreenActor::ErrorReason reason); 106 void SendStateToObservers(ErrorScreenActor::ErrorReason reason);
121 107
122 State GetNetworkState(const NetworkState* network); 108 State GetNetworkState(const NetworkState* network);
123 bool IsProxyConfigured(const NetworkState* network); 109 bool IsProxyConfigured(const NetworkState* network);
124 110
125 content::NotificationRegistrar registrar_; 111 content::NotificationRegistrar registrar_;
126 State state_; 112 State state_;
127 ObserverList<NetworkStateInformerObserver> observers_; 113 ObserverList<NetworkStateInformerObserver> observers_;
128 std::string last_online_service_path_; 114 std::string last_online_service_path_;
129 std::string last_connected_service_path_; 115 std::string last_connected_service_path_;
130 std::string last_network_service_path_; 116 std::string last_network_service_path_;
131 std::string last_network_type_; 117 std::string last_network_type_;
132 base::CancelableClosure check_state_; 118 base::CancelableClosure check_state_;
133 119
134 // Caches proxy state for active networks. 120 base::WeakPtrFactory<NetworkStateInformer> weak_ptr_factory_;
135 ProxyStateMap proxy_state_map_;
136 }; 121 };
137 122
138 } // namespace chromeos 123 } // namespace chromeos
139 124
140 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ 125 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/login/network_state_informer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698