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

Side by Side Diff: chrome/browser/net/pref_proxy_config_service.h

Issue 5005002: Dynamically refresh pref-configured proxies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 10 years, 1 month 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
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_NET_PREF_PROXY_CONFIG_SERVICE_H_
6 #define CHROME_BROWSER_NET_PREF_PROXY_CONFIG_SERVICE_H_
7
8 #include "base/basictypes.h"
9 #include "base/observer_list.h"
10 #include "base/weak_ptr.h"
11 #include "net/proxy/proxy_config.h"
12 #include "net/proxy/proxy_config_service.h"
13
14 class PrefService;
15 class PrefProxyConfigTracker;
16
17 // A net::ProxyConfigService implementation that applies preference proxy
18 // settings as overrides to the proxy configuration determined by a baseline
19 // delegate ProxyConfigService.
20 class PrefProxyConfigService
21 : public net::ProxyConfigService,
22 public net::ProxyConfigService::Observer,
23 public base::SupportsWeakPtr<PrefProxyConfigService> {
24 public:
25 // Takes ownership of the passed |base_service|.
26 PrefProxyConfigService(PrefService* pref_service,
27 net::ProxyConfigService* base_service);
28 virtual ~PrefProxyConfigService();
29
30 // ProxyConfigService implementation:
31 virtual void AddObserver(net::ProxyConfigService::Observer* observer);
32 virtual void RemoveObserver(net::ProxyConfigService::Observer* observer);
33 virtual bool GetLatestProxyConfig(net::ProxyConfig* config);
34 virtual void OnLazyPoll();
35
36 private:
37 class PrefProxyConfigTracker;
38
39 // ProxyConfigService::Observer implementation:
40 virtual void OnProxyConfigChanged(const net::ProxyConfig& config);
41
42 // Called by the tracker when a new policy configuration is available.
43 void PrefProxyConfigChanged();
44
45 scoped_ptr<net::ProxyConfigService> base_service_;
46 ObserverList<net::ProxyConfigService::Observer> observers_;
47 scoped_refptr<PrefProxyConfigTracker> pref_config_tracker_;
48
49 // Counter for assigning proxy configuration identifiers.
50 net::ProxyConfig::ID current_id_;
51
52 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigService);
53 };
54
55 #endif // CHROME_BROWSER_NET_PREF_PROXY_CONFIG_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698