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

Side by Side Diff: chrome/browser/chromeos/proxy_config_service_impl.h

Issue 6597070: Allow ProxyConfigService to report "no configuration set" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Eric's comments. Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_PROXY_CONFIG_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Constructor for testing. 170 // Constructor for testing.
171 // |init_config| specifies the ProxyConfig to use for initialization. 171 // |init_config| specifies the ProxyConfig to use for initialization.
172 explicit ProxyConfigServiceImpl(const ProxyConfig& init_config); 172 explicit ProxyConfigServiceImpl(const ProxyConfig& init_config);
173 virtual ~ProxyConfigServiceImpl(); 173 virtual ~ProxyConfigServiceImpl();
174 174
175 // Methods called on IO thread from wrapper class chromeos::ProxyConfigService 175 // Methods called on IO thread from wrapper class chromeos::ProxyConfigService
176 // as ProxyConfigService methods. 176 // as ProxyConfigService methods.
177 void AddObserver(net::ProxyConfigService::Observer* observer); 177 void AddObserver(net::ProxyConfigService::Observer* observer);
178 void RemoveObserver(net::ProxyConfigService::Observer* observer); 178 void RemoveObserver(net::ProxyConfigService::Observer* observer);
179 // Called from GetLatestProxyConfig. 179 // Called from GetLatestProxyConfig.
180 bool IOGetProxyConfig(net::ProxyConfig* config); 180 net::ProxyConfigService::ConfigAvailability IOGetProxyConfig(
181 net::ProxyConfig* config);
181 182
182 // Called from UI thread to retrieve proxy configuration in |config|. 183 // Called from UI thread to retrieve proxy configuration in |config|.
183 void UIGetProxyConfig(ProxyConfig* config); 184 void UIGetProxyConfig(ProxyConfig* config);
184 185
185 // Called from UI thread to set flag to persist settings to device. 186 // Called from UI thread to set flag to persist settings to device.
186 // Subsequent UISet* methods will use this flag, until UI calls it again with 187 // Subsequent UISet* methods will use this flag, until UI calls it again with
187 // a different flag. 188 // a different flag.
188 void UISetPersistToDevice(bool persist) { 189 void UISetPersistToDevice(bool persist) {
189 persist_to_device_ = persist; 190 persist_to_device_ = persist;
190 } 191 }
(...skipping 17 matching lines...) Expand all
208 209
209 // Implementation for SignedSettings::Delegate 210 // Implementation for SignedSettings::Delegate
210 virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code, 211 virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code,
211 std::string value); 212 std::string value);
212 virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code, 213 virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code,
213 bool value); 214 bool value);
214 215
215 private: 216 private:
216 friend class base::RefCountedThreadSafe<ProxyConfigServiceImpl>; 217 friend class base::RefCountedThreadSafe<ProxyConfigServiceImpl>;
217 218
218 // Init proxy to default config, i.e. AutoDetect.
219 // If |post_to_io_thread| is true, a task will be posted to IO thread to
220 // update |cached_config|.
221 void InitConfigToDefault(bool post_to_io_thread);
222
223 // Persists proxy config to device. 219 // Persists proxy config to device.
224 void PersistConfigToDevice(); 220 void PersistConfigToDevice();
225 221
226 // Called from UI thread from the various UISetProxyConfigTo* 222 // Called from UI thread from the various UISetProxyConfigTo*
227 // |update_to_device| is true to persist new proxy config to device. 223 // |update_to_device| is true to persist new proxy config to device.
228 void OnUISetProxyConfig(bool update_to_device); 224 void OnUISetProxyConfig(bool update_to_device);
229 225
230 // Posted from UI thread to IO thread to carry the new config information. 226 // Posted from UI thread to IO thread to carry the new config information.
231 void IOSetProxyConfig(const ProxyConfig& new_config); 227 void IOSetProxyConfig(
228 const ProxyConfig& new_config,
229 net::ProxyConfigService::ConfigAvailability new_availability);
232 230
233 // Checks that method is called on BrowserThread::IO thread. 231 // Checks that method is called on BrowserThread::IO thread.
234 void CheckCurrentlyOnIOThread(); 232 void CheckCurrentlyOnIOThread();
235 233
236 // Checks that method is called on BrowserThread::UI thread. 234 // Checks that method is called on BrowserThread::UI thread.
237 void CheckCurrentlyOnUIThread(); 235 void CheckCurrentlyOnUIThread();
238 236
239 // Data members. 237 // Data members.
240 238
241 // True if tasks can be posted, which can only happen if constructor has 239 // True if tasks can be posted, which can only happen if constructor has
242 // completed (NewRunnableMethod cannot be created for a RefCountedThreadBase's 240 // completed (NewRunnableMethod cannot be created for a RefCountedThreadBase's
243 // method until the class's ref_count is at least one). 241 // method until the class's ref_count is at least one).
244 bool can_post_task_; 242 bool can_post_task_;
245 243
246 // True if config has been fetched from device or initialized properly. 244 // Availability status of the configuration.
247 bool has_config_; 245 net::ProxyConfigService::ConfigAvailability config_availability_;
248 246
249 // True if settings are to be persisted to device. 247 // True if settings are to be persisted to device.
250 bool persist_to_device_; 248 bool persist_to_device_;
251 249
252 // True if there's a pending operation to store proxy setting to device. 250 // True if there's a pending operation to store proxy setting to device.
253 bool persist_to_device_pending_; 251 bool persist_to_device_pending_;
254 252
255 // Cached proxy configuration, to be converted to net::ProxyConfig and 253 // Cached proxy configuration, to be converted to net::ProxyConfig and
256 // returned by IOGetProxyConfig. 254 // returned by IOGetProxyConfig.
257 // Initially populated from the UI thread, but afterwards only accessed from 255 // Initially populated from the UI thread, but afterwards only accessed from
(...skipping 12 matching lines...) Expand all
270 // respectively. 268 // respectively.
271 scoped_refptr<SignedSettings> retrieve_property_op_; 269 scoped_refptr<SignedSettings> retrieve_property_op_;
272 scoped_refptr<SignedSettings> store_property_op_; 270 scoped_refptr<SignedSettings> store_property_op_;
273 271
274 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); 272 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl);
275 }; 273 };
276 274
277 } // namespace chromeos 275 } // namespace chromeos
278 276
279 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ 277 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/proxy_config_service.h ('k') | chrome/browser/chromeos/proxy_config_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698