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

Unified Diff: net/proxy/proxy_config_service_linux.h

Issue 2094913002: Make base::Environment::Create() return unique_ptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: '' Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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.
+ 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;

Powered by Google App Engine
This is Rietveld 408576698