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

Unified 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 side-by-side diff with in-line comments
Download patch
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..c478cf780237655db97111fb7108aba92f9fd927
--- /dev/null
+++ b/chrome/browser/net/pref_proxy_config_service.h
@@ -0,0 +1,55 @@
+// 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"
+#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 applies preference proxy
+// settings as overrides to the proxy configuration determined by a baseline
+// delegate ProxyConfigService.
+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_

Powered by Google App Engine
This is Rietveld 408576698