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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_H_
6 #define COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "components/proxy_config/proxy_config_export.h"
13 class ProxyConfigService
;
16 // Interface for a class that tracks proxy preferences. The purpose of the
17 // concrete class is to track changes in the Preferences, to translates the
18 // preferences to net::ProxyConfig and to push the result over to a
19 // net::ProxyConfigService onto the IO thread.
20 class PROXY_CONFIG_EXPORT PrefProxyConfigTracker
{
22 PrefProxyConfigTracker();
23 virtual ~PrefProxyConfigTracker();
25 // Creates a net::ProxyConfigService and keeps a pointer to it. After this
26 // call, this tracker forwards any changes of proxy preferences to the created
27 // ProxyConfigService. The returned ProxyConfigService must not be deleted
28 // before DetachFromPrefService was called. Takes ownership of the passed
29 // |base_service|, which can be NULL. This |base_service| provides the proxy
30 // settings of the OS (except of ChromeOS). This must be called on the
32 virtual scoped_ptr
<net::ProxyConfigService
> CreateTrackingProxyConfigService(
33 scoped_ptr
<net::ProxyConfigService
> base_service
) = 0;
35 // Releases the PrefService passed upon construction and the |base_service|
36 // passed to CreateTrackingProxyConfigService. This must be called on the UI
38 virtual void DetachFromPrefService() = 0;
41 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigTracker
);
44 #endif // COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_H_