Chromium Code Reviews| Index: chrome/browser/net/pref_proxy_config_service.h |
| diff --git a/chrome/browser/net/pref_proxy_config_service.h b/chrome/browser/net/pref_proxy_config_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4591f5057d65ca1fb828dc52fbb31a98872ee96b |
| --- /dev/null |
| +++ b/chrome/browser/net/pref_proxy_config_service.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_NET_PREF_PROXY_CONFIG_SERVICE_H_ |
| +#define CHROME_BROWSER_NET_PREF_PROXY_CONFIG_SERVICE_H_ |
| + |
| +#include <base/basictypes.h> |
|
jochen (gone - plz use gerrit)
2010/11/16 22:48:32
"" instead of <>
Mattias Nissler (ping if slow)
2010/11/16 22:58:11
Sigh, I make this same mistake again and again...
|
| +#include <base/observer_list.h> |
| +#include <base/weak_ptr.h> |
| +#include <net/proxy/proxy_config.h> |
| +#include <net/proxy/proxy_config_service.h> |
| + |
| +class PrefService; |
| +class PrefProxyConfigTracker; |
| + |
| +// A net::ProxyConfigService implementation that allows preferences to override |
| +// the proxy configuration determined by the baseline system proxy service. |
| +class PrefProxyConfigService |
| + : public net::ProxyConfigService, |
| + public net::ProxyConfigService::Observer, |
| + public base::SupportsWeakPtr<PrefProxyConfigService> { |
| + public: |
| + // Takes ownership of the passed |base_service|. |
| + PrefProxyConfigService(PrefService* pref_service, |
| + net::ProxyConfigService* base_service); |
| + virtual ~PrefProxyConfigService(); |
| + |
| + // ProxyConfigService implementation: |
| + virtual void AddObserver(net::ProxyConfigService::Observer* observer); |
| + virtual void RemoveObserver(net::ProxyConfigService::Observer* observer); |
| + virtual bool GetLatestProxyConfig(net::ProxyConfig* config); |
| + virtual void OnLazyPoll(); |
| + |
| + private: |
| + class PrefProxyConfigTracker; |
| + |
| + // ProxyConfigService::Observer implementation: |
| + virtual void OnProxyConfigChanged(const net::ProxyConfig& config); |
| + |
| + // Called by the tracker when a new policy configuration is available. |
| + void PrefProxyConfigChanged(); |
| + |
| + scoped_ptr<net::ProxyConfigService> base_service_; |
| + ObserverList<net::ProxyConfigService::Observer> observers_; |
| + scoped_refptr<PrefProxyConfigTracker> pref_config_tracker_; |
| + |
| + // Counter for assigning proxy configuration identifiers. |
| + net::ProxyConfig::ID current_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigService); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_NET_PREF_PROXY_CONFIG_SERVICE_H_ |