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

Side by Side Diff: net/proxy/polling_proxy_config_service.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
« no previous file with comments | « chrome/test/testing_pref_service.cc ('k') | net/proxy/polling_proxy_config_service.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) 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 NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_ 5 #ifndef NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_
6 #define NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_ 6 #define NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "net/proxy/proxy_config_service.h" 11 #include "net/proxy/proxy_config_service.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 // PollingProxyConfigService is a base class for creating ProxyConfigService 15 // PollingProxyConfigService is a base class for creating ProxyConfigService
16 // implementations that use polling to notice when settings have change. 16 // implementations that use polling to notice when settings have change.
17 // 17 //
18 // It runs code to get the current proxy settings on a background worker 18 // It runs code to get the current proxy settings on a background worker
19 // thread, and notifies registered observers when the value changes. 19 // thread, and notifies registered observers when the value changes.
20 class PollingProxyConfigService : public ProxyConfigService { 20 class PollingProxyConfigService : public ProxyConfigService {
21 public: 21 public:
22 // ProxyConfigService implementation: 22 // ProxyConfigService implementation:
23 virtual void AddObserver(Observer* observer); 23 virtual void AddObserver(Observer* observer);
24 virtual void RemoveObserver(Observer* observer); 24 virtual void RemoveObserver(Observer* observer);
25 virtual bool GetLatestProxyConfig(ProxyConfig* config); 25 virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config);
26 virtual void OnLazyPoll(); 26 virtual void OnLazyPoll();
27 27
28 protected: 28 protected:
29 // Function for retrieving the current proxy configuration. 29 // Function for retrieving the current proxy configuration.
30 // Implementors must be threadsafe as the function will be invoked from 30 // Implementors must be threadsafe as the function will be invoked from
31 // worker threads. 31 // worker threads.
32 typedef void (*GetConfigFunction)(ProxyConfig*); 32 typedef void (*GetConfigFunction)(ProxyConfig*);
33 33
34 // Creates a polling-based ProxyConfigService which will test for new 34 // Creates a polling-based ProxyConfigService which will test for new
35 // settings at most every |poll_interval| time by calling |get_config_func| 35 // settings at most every |poll_interval| time by calling |get_config_func|
36 // on a worker thread. 36 // on a worker thread.
37 PollingProxyConfigService( 37 PollingProxyConfigService(
38 base::TimeDelta poll_interval, 38 base::TimeDelta poll_interval,
39 GetConfigFunction get_config_func); 39 GetConfigFunction get_config_func);
40 40
41 virtual ~PollingProxyConfigService(); 41 virtual ~PollingProxyConfigService();
42 42
43 // Polls for changes by posting a task to the worker pool. 43 // Polls for changes by posting a task to the worker pool.
44 void CheckForChangesNow(); 44 void CheckForChangesNow();
45 45
46 private: 46 private:
47 class Core; 47 class Core;
48 scoped_refptr<Core> core_; 48 scoped_refptr<Core> core_;
49 }; 49 };
50 50
51 } // namespace net 51 } // namespace net
52 52
53 #endif // NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_ 53 #endif // NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/test/testing_pref_service.cc ('k') | net/proxy/polling_proxy_config_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698