| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 NET_PROXY_PROXY_CONFIG_SERVICE_H_ | 5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_H_ |
| 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_H_ | 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "net/base/net_api.h" | 9 #include "net/base/net_export.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 | 12 |
| 13 class ProxyConfig; | 13 class ProxyConfig; |
| 14 | 14 |
| 15 // Service for watching when the proxy settings have changed. | 15 // Service for watching when the proxy settings have changed. |
| 16 class NET_API ProxyConfigService { | 16 class NET_EXPORT ProxyConfigService { |
| 17 public: | 17 public: |
| 18 // Indicates whether proxy configuration is valid, and if not, why. | 18 // Indicates whether proxy configuration is valid, and if not, why. |
| 19 enum ConfigAvailability { | 19 enum ConfigAvailability { |
| 20 // Configuration is pending, observers will be notified later. | 20 // Configuration is pending, observers will be notified later. |
| 21 CONFIG_PENDING, | 21 CONFIG_PENDING, |
| 22 // Configuration is present and valid. | 22 // Configuration is present and valid. |
| 23 CONFIG_VALID, | 23 CONFIG_VALID, |
| 24 // No configuration is set. | 24 // No configuration is set. |
| 25 CONFIG_UNSET | 25 CONFIG_UNSET |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 // Observer for being notified when the proxy settings have changed. | 28 // Observer for being notified when the proxy settings have changed. |
| 29 class NET_API Observer { | 29 class NET_EXPORT Observer { |
| 30 public: | 30 public: |
| 31 virtual ~Observer() {} | 31 virtual ~Observer() {} |
| 32 // Notification callback that should be invoked by ProxyConfigService | 32 // Notification callback that should be invoked by ProxyConfigService |
| 33 // implementors whenever the configuration changes. |availability| indicates | 33 // implementors whenever the configuration changes. |availability| indicates |
| 34 // the new availability status and can be CONFIG_UNSET or CONFIG_VALID (in | 34 // the new availability status and can be CONFIG_UNSET or CONFIG_VALID (in |
| 35 // which case |config| contains the configuration). Implementors must not | 35 // which case |config| contains the configuration). Implementors must not |
| 36 // pass CONFIG_PENDING. | 36 // pass CONFIG_PENDING. |
| 37 virtual void OnProxyConfigChanged(const ProxyConfig& config, | 37 virtual void OnProxyConfigChanged(const ProxyConfig& config, |
| 38 ConfigAvailability availability) = 0; | 38 ConfigAvailability availability) = 0; |
| 39 }; | 39 }; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 60 // Note that this is purely used as an optimization -- polling | 60 // Note that this is purely used as an optimization -- polling |
| 61 // implementations could simply set a global timer that goes off every | 61 // implementations could simply set a global timer that goes off every |
| 62 // X seconds at which point they check for changes. However that has | 62 // X seconds at which point they check for changes. However that has |
| 63 // the disadvantage of doing continuous work even during idle periods. | 63 // the disadvantage of doing continuous work even during idle periods. |
| 64 virtual void OnLazyPoll() {} | 64 virtual void OnLazyPoll() {} |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace net | 67 } // namespace net |
| 68 | 68 |
| 69 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_H_ | 69 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_H_ |
| OLD | NEW |