Chromium Code Reviews| Index: net/proxy/proxy_config_service_linux.h |
| diff --git a/net/proxy/proxy_config_service_linux.h b/net/proxy/proxy_config_service_linux.h |
| index 1425372c0d38c94f97ee56ad34cd21995fecc537..1a94de8cee9f1826f0417f4479a086c8de7ce66f 100644 |
| --- a/net/proxy/proxy_config_service_linux.h |
| +++ b/net/proxy/proxy_config_service_linux.h |
| @@ -31,8 +31,6 @@ namespace net { |
| // settings from environment variables, gconf, gsettings, or kioslaverc (KDE). |
| class NET_EXPORT_PRIVATE ProxyConfigServiceLinux : public ProxyConfigService { |
| public: |
| - |
| - // Forward declaration of Delegate. |
| class Delegate; |
| class SettingGetter { |
| @@ -168,12 +166,12 @@ class NET_EXPORT_PRIVATE ProxyConfigServiceLinux : public ProxyConfigService { |
| class Delegate : public base::RefCountedThreadSafe<Delegate> { |
| public: |
| - // Constructor receives env var getter implementation to use, and |
| - // takes ownership of it. This is the normal constructor. |
| - explicit Delegate(base::Environment* env_var_getter); |
| - // Constructor receives setting and env var getter implementations |
| - // to use, and takes ownership of them. Used for testing. |
| - Delegate(base::Environment* env_var_getter, SettingGetter* setting_getter); |
| + // Noraml constructor. |
|
Ryan Hamilton
2016/06/28 22:53:05
nit: Normal
Lei Zhang
2016/06/28 23:10:55
Done.
|
| + explicit Delegate(std::unique_ptr<base::Environment> env_var_getter); |
| + |
| + // Constructor for testing. |
| + Delegate(std::unique_ptr<base::Environment> env_var_getter, |
| + SettingGetter* setting_getter); |
| // Synchronously obtains the proxy configuration. If gconf, |
| // gsettings, or kioslaverc are used, also enables notifications for |
| @@ -216,11 +214,12 @@ class NET_EXPORT_PRIVATE ProxyConfigServiceLinux : public ProxyConfigService { |
| // Obtains an environment variable's value. Parses a proxy server |
| // specification from it and puts it in result. Returns true if the |
| // requested variable is defined and the value valid. |
| - bool GetProxyFromEnvVarForScheme(const char* variable, |
| + bool GetProxyFromEnvVarForScheme(base::StringPiece variable, |
| ProxyServer::Scheme scheme, |
| ProxyServer* result_server); |
| // As above but with scheme set to HTTP, for convenience. |
| - bool GetProxyFromEnvVar(const char* variable, ProxyServer* result_server); |
| + bool GetProxyFromEnvVar(base::StringPiece variable, |
| + ProxyServer* result_server); |
| // Fills proxy config from environment variables. Returns true if |
| // variables were found and the configuration is valid. |
| bool GetConfigFromEnv(ProxyConfig* config); |
| @@ -277,9 +276,11 @@ class NET_EXPORT_PRIVATE ProxyConfigServiceLinux : public ProxyConfigService { |
| // Usual constructor |
| ProxyConfigServiceLinux(); |
| + |
| // For testing: take alternate setting and env var getter implementations. |
| - explicit ProxyConfigServiceLinux(base::Environment* env_var_getter); |
| - ProxyConfigServiceLinux(base::Environment* env_var_getter, |
| + explicit ProxyConfigServiceLinux( |
| + std::unique_ptr<base::Environment> env_var_getter); |
| + ProxyConfigServiceLinux(std::unique_ptr<base::Environment> env_var_getter, |
| SettingGetter* setting_getter); |
| ~ProxyConfigServiceLinux() override; |