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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP, latest changes from kaiwang@ Created 8 years 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_NET_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ 5 #ifndef CHROME_BROWSER_NET_PREF_PROXY_CONFIG_TRACKER_IMPL_H_
6 #define CHROME_BROWSER_NET_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ 6 #define CHROME_BROWSER_NET_PREF_PROXY_CONFIG_TRACKER_IMPL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "base/prefs/public/pref_change_registrar.h" 12 #include "base/prefs/public/pref_change_registrar.h"
13 #include "chrome/browser/prefs/proxy_config_dictionary.h" 13 #include "chrome/browser/prefs/proxy_config_dictionary.h"
14 #include "net/proxy/proxy_config.h" 14 #include "net/proxy/proxy_config.h"
15 #include "net/proxy/proxy_config_service.h" 15 #include "net/proxy/proxy_config_service.h"
16 16
17 class PrefService; 17 class PrefService;
18 class PrefServiceSyncable;
18 19
19 // A net::ProxyConfigService implementation that applies preference proxy 20 // A net::ProxyConfigService implementation that applies preference proxy
20 // settings (pushed from PrefProxyConfigTrackerImpl) as overrides to the proxy 21 // settings (pushed from PrefProxyConfigTrackerImpl) as overrides to the proxy
21 // configuration determined by a baseline delegate ProxyConfigService on 22 // configuration determined by a baseline delegate ProxyConfigService on
22 // non-ChromeOS platforms. ChromeOS has its own implementation of overrides in 23 // non-ChromeOS platforms. ChromeOS has its own implementation of overrides in
23 // chromeos::ProxyConfigServiceImpl. 24 // chromeos::ProxyConfigServiceImpl.
24 class ChromeProxyConfigService 25 class ChromeProxyConfigService
25 : public net::ProxyConfigService, 26 : public net::ProxyConfigService,
26 public net::ProxyConfigService::Observer { 27 public net::ProxyConfigService::Observer {
27 public: 28 public:
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 bool ignore_fallback_config, 111 bool ignore_fallback_config,
111 ProxyPrefs::ConfigState* effective_config_state, 112 ProxyPrefs::ConfigState* effective_config_state,
112 net::ProxyConfig* effective_config); 113 net::ProxyConfig* effective_config);
113 114
114 // Converts a ProxyConfigDictionary to net::ProxyConfig representation. 115 // Converts a ProxyConfigDictionary to net::ProxyConfig representation.
115 // Returns true if the data from in the dictionary is valid, false otherwise. 116 // Returns true if the data from in the dictionary is valid, false otherwise.
116 static bool PrefConfigToNetConfig(const ProxyConfigDictionary& proxy_dict, 117 static bool PrefConfigToNetConfig(const ProxyConfigDictionary& proxy_dict,
117 net::ProxyConfig* config); 118 net::ProxyConfig* config);
118 119
119 // Registers the proxy preference. 120 // Registers the proxy preference.
120 static void RegisterPrefs(PrefService* user_prefs); 121 static void RegisterPrefs(PrefServiceSyncable* user_prefs);
121 122
122 protected: 123 protected:
123 // Get the proxy configuration currently defined by preferences. 124 // Get the proxy configuration currently defined by preferences.
124 // Status is indicated in the return value. 125 // Status is indicated in the return value.
125 // Writes the configuration to |config| unless the return value is 126 // Writes the configuration to |config| unless the return value is
126 // CONFIG_UNSET, in which case |config| and |config_source| are not touched. 127 // CONFIG_UNSET, in which case |config| and |config_source| are not touched.
127 ProxyPrefs::ConfigState GetProxyConfig(net::ProxyConfig* config); 128 ProxyPrefs::ConfigState GetProxyConfig(net::ProxyConfig* config);
128 129
129 // Called when there's a change in prefs proxy config. 130 // Called when there's a change in prefs proxy config.
130 // Subclasses can extend it for changes in other sources of proxy config. 131 // Subclasses can extend it for changes in other sources of proxy config.
(...skipping 20 matching lines...) Expand all
151 152
152 PrefService* pref_service_; 153 PrefService* pref_service_;
153 ChromeProxyConfigService* chrome_proxy_config_service_; // Weak ptr. 154 ChromeProxyConfigService* chrome_proxy_config_service_; // Weak ptr.
154 bool update_pending_; // True if config has not been pushed to network stack. 155 bool update_pending_; // True if config has not been pushed to network stack.
155 PrefChangeRegistrar proxy_prefs_; 156 PrefChangeRegistrar proxy_prefs_;
156 157
157 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigTrackerImpl); 158 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigTrackerImpl);
158 }; 159 };
159 160
160 #endif // CHROME_BROWSER_NET_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ 161 #endif // CHROME_BROWSER_NET_PREF_PROXY_CONFIG_TRACKER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698