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

Side by Side Diff: net/proxy/proxy_config_service.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months 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
« no previous file with comments | « net/proxy/proxy_config.cc ('k') | net/proxy/proxy_config_service_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_H_
6 #define NET_PROXY_PROXY_CONFIG_SERVICE_H_
7
8 #include "net/base/net_export.h"
9
10 namespace net {
11
12 class ProxyConfig;
13
14 // Service for watching when the proxy settings have changed.
15 class NET_EXPORT ProxyConfigService {
16 public:
17 // Indicates whether proxy configuration is valid, and if not, why.
18 enum ConfigAvailability {
19 // Configuration is pending, observers will be notified later.
20 CONFIG_PENDING,
21 // Configuration is present and valid.
22 CONFIG_VALID,
23 // No configuration is set.
24 CONFIG_UNSET
25 };
26
27 // Observer for being notified when the proxy settings have changed.
28 class NET_EXPORT Observer {
29 public:
30 virtual ~Observer() {}
31 // Notification callback that should be invoked by ProxyConfigService
32 // implementors whenever the configuration changes. |availability| indicates
33 // the new availability status and can be CONFIG_UNSET or CONFIG_VALID (in
34 // which case |config| contains the configuration). Implementors must not
35 // pass CONFIG_PENDING.
36 virtual void OnProxyConfigChanged(const ProxyConfig& config,
37 ConfigAvailability availability) = 0;
38 };
39
40 virtual ~ProxyConfigService() {}
41
42 // Adds/Removes an observer that will be called whenever the proxy
43 // configuration has changed.
44 virtual void AddObserver(Observer* observer) = 0;
45 virtual void RemoveObserver(Observer* observer) = 0;
46
47 // Gets the most recent availability status. If a configuration is present,
48 // the proxy configuration is written to |config| and CONFIG_VALID is
49 // returned. Returns CONFIG_PENDING if it is not available yet. In this case,
50 // it is guaranteed that subscribed observers will be notified of a change at
51 // some point in the future once the configuration is available.
52 // Note that to avoid re-entrancy problems, implementations should not
53 // dispatch any change notifications from within this function.
54 virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) = 0;
55
56 // ProxyService will call this periodically during periods of activity.
57 // It can be used as a signal for polling-based implementations.
58 //
59 // Note that this is purely used as an optimization -- polling
60 // implementations could simply set a global timer that goes off every
61 // X seconds at which point they check for changes. However that has
62 // the disadvantage of doing continuous work even during idle periods.
63 virtual void OnLazyPoll() {}
64 };
65
66 } // namespace net
67
68 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_H_
OLDNEW
« no previous file with comments | « net/proxy/proxy_config.cc ('k') | net/proxy/proxy_config_service_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698