#ifndef NET_PROXY_RESOLUTION_POLLING_PROXY_CONFIG_SERVICE_H_
#define NET_PROXY_RESOLUTION_POLLING_PROXY_CONFIG_SERVICE_H_
#include "base/compiler_specific.h"
#include "base/memory/scoped_refptr.h"
#include "base/time/time.h"
#include "net/base/net_export.h"
#include "net/proxy_resolution/proxy_config_service.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
namespace net {
class NET_EXPORT_PRIVATE PollingProxyConfigService : public ProxyConfigService {
public:
PollingProxyConfigService(const PollingProxyConfigService&) = delete;
PollingProxyConfigService& operator=(const PollingProxyConfigService&) =
delete;
void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override;
ConfigAvailability GetLatestProxyConfig(
ProxyConfigWithAnnotation* config) override;
void OnLazyPoll() override;
bool UsesPolling() override;
protected:
typedef void (*GetConfigFunction)(NetworkTrafficAnnotationTag,
ProxyConfigWithAnnotation*);
PollingProxyConfigService(
base::TimeDelta poll_interval,
GetConfigFunction get_config_func,
const NetworkTrafficAnnotationTag& traffic_annotation);
~PollingProxyConfigService() override;
void CheckForChangesNow();
private:
class Core;
scoped_refptr<Core> core_;
};
}
#endif