| Index: net/proxy/proxy_config_service_linux.cc
|
| diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc
|
| index a93567d1e00de5e4f327496667aa2e4a53be5fbf..25fe1a11ae4cfb33a8ee2f3737940a52ff80ed27 100644
|
| --- a/net/proxy/proxy_config_service_linux.cc
|
| +++ b/net/proxy/proxy_config_service_linux.cc
|
| @@ -54,8 +54,7 @@ namespace {
|
| // scheme indicates the desired proxy scheme: usually http, with
|
| // socks 4 or 5 as special cases.
|
| // TODO(arindam): Remove URI string manipulation by using MapUrlSchemeToProxy.
|
| -std::string FixupProxyHostScheme(ProxyServer::Scheme scheme,
|
| - std::string host) {
|
| +std::string FixupProxyHostScheme(ProxyServer::Scheme scheme, std::string host) {
|
| if (scheme == ProxyServer::SCHEME_SOCKS5 &&
|
| StartsWithASCII(host, "socks4://", false)) {
|
| // We default to socks 5, but if the user specifically set it to
|
| @@ -96,7 +95,8 @@ ProxyConfigServiceLinux::Delegate::~Delegate() {
|
| }
|
|
|
| bool ProxyConfigServiceLinux::Delegate::GetProxyFromEnvVarForScheme(
|
| - const char* variable, ProxyServer::Scheme scheme,
|
| + const char* variable,
|
| + ProxyServer::Scheme scheme,
|
| ProxyServer* result_server) {
|
| std::string env_value;
|
| if (env_var_getter_->GetVar(variable, &env_value)) {
|
| @@ -116,9 +116,10 @@ bool ProxyConfigServiceLinux::Delegate::GetProxyFromEnvVarForScheme(
|
| }
|
|
|
| bool ProxyConfigServiceLinux::Delegate::GetProxyFromEnvVar(
|
| - const char* variable, ProxyServer* result_server) {
|
| - return GetProxyFromEnvVarForScheme(variable, ProxyServer::SCHEME_HTTP,
|
| - result_server);
|
| + const char* variable,
|
| + ProxyServer* result_server) {
|
| + return GetProxyFromEnvVarForScheme(
|
| + variable, ProxyServer::SCHEME_HTTP, result_server);
|
| }
|
|
|
| bool ProxyConfigServiceLinux::Delegate::GetConfigFromEnv(ProxyConfig* config) {
|
| @@ -153,8 +154,8 @@ bool ProxyConfigServiceLinux::Delegate::GetConfigFromEnv(ProxyConfig* config) {
|
| // like other apps do this. So we will refrain.
|
| bool have_https = GetProxyFromEnvVar("https_proxy", &proxy_server);
|
| if (have_https)
|
| - config->proxy_rules().proxies_for_https.
|
| - SetSingleProxyServer(proxy_server);
|
| + config->proxy_rules().proxies_for_https.SetSingleProxyServer(
|
| + proxy_server);
|
| bool have_ftp = GetProxyFromEnvVar("ftp_proxy", &proxy_server);
|
| if (have_ftp)
|
| config->proxy_rules().proxies_for_ftp.SetSingleProxyServer(proxy_server);
|
| @@ -170,8 +171,8 @@ bool ProxyConfigServiceLinux::Delegate::GetConfigFromEnv(ProxyConfig* config) {
|
| // documentation: http://library.gnome.org/devel/gnet/stable/gnet-socks.html
|
| ProxyServer::Scheme scheme = ProxyServer::SCHEME_SOCKS5;
|
| std::string env_version;
|
| - if (env_var_getter_->GetVar("SOCKS_VERSION", &env_version)
|
| - && env_version == "4")
|
| + if (env_var_getter_->GetVar("SOCKS_VERSION", &env_version) &&
|
| + env_version == "4")
|
| scheme = ProxyServer::SCHEME_SOCKS4;
|
| if (GetProxyFromEnvVarForScheme("SOCKS_SERVER", scheme, &proxy_server)) {
|
| config->proxy_rules().type = ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY;
|
| @@ -204,9 +205,10 @@ const int kDebounceTimeoutMilliseconds = 250;
|
| class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter {
|
| public:
|
| SettingGetterImplGConf()
|
| - : client_(NULL), system_proxy_id_(0), system_http_proxy_id_(0),
|
| - notify_delegate_(NULL) {
|
| - }
|
| + : client_(NULL),
|
| + system_proxy_id_(0),
|
| + system_http_proxy_id_(0),
|
| + notify_delegate_(NULL) {}
|
|
|
| virtual ~SettingGetterImplGConf() {
|
| // client_ should have been released before now, from
|
| @@ -253,12 +255,12 @@ class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter {
|
| // for notifications, and we might as well ask to preload them.
|
| // These need to be removed again in ShutDown(); we are careful
|
| // here to only leave client_ non-NULL if both have been added.
|
| - gconf_client_add_dir(client_, "/system/proxy",
|
| - GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
|
| + gconf_client_add_dir(
|
| + client_, "/system/proxy", GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
|
| if (error == NULL) {
|
| added_system_proxy = true;
|
| - gconf_client_add_dir(client_, "/system/http_proxy",
|
| - GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
|
| + gconf_client_add_dir(
|
| + client_, "/system/http_proxy", GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
|
| }
|
| if (error != NULL) {
|
| LOG(ERROR) << "Error requesting gconf directory: " << error->message;
|
| @@ -299,15 +301,19 @@ class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter {
|
| // We have to keep track of the IDs returned by gconf_client_notify_add() so
|
| // that we can remove them in ShutDown(). (Otherwise, notifications will be
|
| // delivered to this object after it is deleted, which is bad, m'kay?)
|
| - system_proxy_id_ = gconf_client_notify_add(
|
| - client_, "/system/proxy",
|
| - OnGConfChangeNotification, this,
|
| - NULL, &error);
|
| + system_proxy_id_ = gconf_client_notify_add(client_,
|
| + "/system/proxy",
|
| + OnGConfChangeNotification,
|
| + this,
|
| + NULL,
|
| + &error);
|
| if (error == NULL) {
|
| - system_http_proxy_id_ = gconf_client_notify_add(
|
| - client_, "/system/http_proxy",
|
| - OnGConfChangeNotification, this,
|
| - NULL, &error);
|
| + system_http_proxy_id_ = gconf_client_notify_add(client_,
|
| + "/system/http_proxy",
|
| + OnGConfChangeNotification,
|
| + this,
|
| + NULL,
|
| + &error);
|
| }
|
| if (error != NULL) {
|
| LOG(ERROR) << "Error requesting gconf notifications: " << error->message;
|
| @@ -383,9 +389,7 @@ class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter {
|
| return false;
|
| }
|
|
|
| - virtual bool MatchHostsUsingSuffixMatching() OVERRIDE {
|
| - return false;
|
| - }
|
| + virtual bool MatchHostsUsingSuffixMatching() OVERRIDE { return false; }
|
|
|
| private:
|
| bool GetStringByPath(const char* key, std::string* result) {
|
| @@ -440,13 +444,13 @@ class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter {
|
| DCHECK(client_);
|
| DCHECK(task_runner_->BelongsToCurrentThread());
|
| GError* error = NULL;
|
| - GSList* list = gconf_client_get_list(client_, key,
|
| - GCONF_VALUE_STRING, &error);
|
| + GSList* list =
|
| + gconf_client_get_list(client_, key, GCONF_VALUE_STRING, &error);
|
| if (HandleGError(error, key))
|
| return false;
|
| if (!list)
|
| return false;
|
| - for (GSList *it = list; it; it = it->next) {
|
| + for (GSList* it = list; it; it = it->next) {
|
| result->push_back(static_cast<char*>(it->data));
|
| g_free(it->data);
|
| }
|
| @@ -458,8 +462,8 @@ class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter {
|
| // (error is NULL).
|
| bool HandleGError(GError* error, const char* key) {
|
| if (error != NULL) {
|
| - LOG(ERROR) << "Error getting gconf value for " << key
|
| - << ": " << error->message;
|
| + LOG(ERROR) << "Error getting gconf value for " << key << ": "
|
| + << error->message;
|
| g_error_free(error);
|
| return true;
|
| }
|
| @@ -478,14 +482,18 @@ class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter {
|
| // We don't use Reset() because the timer may not yet be running.
|
| // (In that case Stop() is a no-op.)
|
| debounce_timer_.Stop();
|
| - debounce_timer_.Start(FROM_HERE,
|
| + debounce_timer_.Start(
|
| + FROM_HERE,
|
| base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds),
|
| - this, &SettingGetterImplGConf::OnDebouncedNotification);
|
| + this,
|
| + &SettingGetterImplGConf::OnDebouncedNotification);
|
| }
|
|
|
| // gconf notification callback, dispatched on the default glib main loop.
|
| - static void OnGConfChangeNotification(GConfClient* client, guint cnxn_id,
|
| - GConfEntry* entry, gpointer user_data) {
|
| + static void OnGConfChangeNotification(GConfClient* client,
|
| + guint cnxn_id,
|
| + GConfEntry* entry,
|
| + gpointer user_data) {
|
| VLOG(1) << "gconf change notification for key "
|
| << gconf_entry_get_key(entry);
|
| // We don't track which key has changed, just that something did change.
|
| @@ -517,14 +525,13 @@ class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter {
|
| class SettingGetterImplGSettings
|
| : public ProxyConfigServiceLinux::SettingGetter {
|
| public:
|
| - SettingGetterImplGSettings() :
|
| - client_(NULL),
|
| - http_client_(NULL),
|
| - https_client_(NULL),
|
| - ftp_client_(NULL),
|
| - socks_client_(NULL),
|
| - notify_delegate_(NULL) {
|
| - }
|
| + SettingGetterImplGSettings()
|
| + : client_(NULL),
|
| + http_client_(NULL),
|
| + https_client_(NULL),
|
| + ftp_client_(NULL),
|
| + socks_client_(NULL),
|
| + notify_delegate_(NULL) {}
|
|
|
| virtual ~SettingGetterImplGSettings() {
|
| // client_ should have been released before now, from
|
| @@ -607,16 +614,26 @@ class SettingGetterImplGSettings
|
| // We could watch for the change-event signal instead of changed, but
|
| // since we have to watch more than one object, we'd still have to
|
| // debounce change notifications. This is conceptually simpler.
|
| - g_signal_connect(G_OBJECT(client_), "changed",
|
| - G_CALLBACK(OnGSettingsChangeNotification), this);
|
| - g_signal_connect(G_OBJECT(http_client_), "changed",
|
| - G_CALLBACK(OnGSettingsChangeNotification), this);
|
| - g_signal_connect(G_OBJECT(https_client_), "changed",
|
| - G_CALLBACK(OnGSettingsChangeNotification), this);
|
| - g_signal_connect(G_OBJECT(ftp_client_), "changed",
|
| - G_CALLBACK(OnGSettingsChangeNotification), this);
|
| - g_signal_connect(G_OBJECT(socks_client_), "changed",
|
| - G_CALLBACK(OnGSettingsChangeNotification), this);
|
| + g_signal_connect(G_OBJECT(client_),
|
| + "changed",
|
| + G_CALLBACK(OnGSettingsChangeNotification),
|
| + this);
|
| + g_signal_connect(G_OBJECT(http_client_),
|
| + "changed",
|
| + G_CALLBACK(OnGSettingsChangeNotification),
|
| + this);
|
| + g_signal_connect(G_OBJECT(https_client_),
|
| + "changed",
|
| + G_CALLBACK(OnGSettingsChangeNotification),
|
| + this);
|
| + g_signal_connect(G_OBJECT(ftp_client_),
|
| + "changed",
|
| + G_CALLBACK(OnGSettingsChangeNotification),
|
| + this);
|
| + g_signal_connect(G_OBJECT(socks_client_),
|
| + "changed",
|
| + G_CALLBACK(OnGSettingsChangeNotification),
|
| + this);
|
| // Simulate a change to avoid possibly losing updates before this point.
|
| OnChangeNotification();
|
| return true;
|
| @@ -695,12 +712,11 @@ class SettingGetterImplGSettings
|
| return false;
|
| }
|
|
|
| - virtual bool MatchHostsUsingSuffixMatching() OVERRIDE {
|
| - return false;
|
| - }
|
| + virtual bool MatchHostsUsingSuffixMatching() OVERRIDE { return false; }
|
|
|
| private:
|
| - bool GetStringByPath(GSettings* client, const char* key,
|
| + bool GetStringByPath(GSettings* client,
|
| + const char* key,
|
| std::string* result) {
|
| DCHECK(task_runner_->BelongsToCurrentThread());
|
| gchar* value = libgio_loader_.g_settings_get_string(client, key);
|
| @@ -712,8 +728,8 @@ class SettingGetterImplGSettings
|
| }
|
| bool GetBoolByPath(GSettings* client, const char* key, bool* result) {
|
| DCHECK(task_runner_->BelongsToCurrentThread());
|
| - *result = static_cast<bool>(
|
| - libgio_loader_.g_settings_get_boolean(client, key));
|
| + *result =
|
| + static_cast<bool>(libgio_loader_.g_settings_get_boolean(client, key));
|
| return true;
|
| }
|
| bool GetIntByPath(GSettings* client, const char* key, int* result) {
|
| @@ -721,7 +737,8 @@ class SettingGetterImplGSettings
|
| *result = libgio_loader_.g_settings_get_int(client, key);
|
| return true;
|
| }
|
| - bool GetStringListByPath(GSettings* client, const char* key,
|
| + bool GetStringListByPath(GSettings* client,
|
| + const char* key,
|
| std::vector<std::string>* result) {
|
| DCHECK(task_runner_->BelongsToCurrentThread());
|
| gchar** list = libgio_loader_.g_settings_get_strv(client, key);
|
| @@ -747,13 +764,16 @@ class SettingGetterImplGSettings
|
| // We don't use Reset() because the timer may not yet be running.
|
| // (In that case Stop() is a no-op.)
|
| debounce_timer_.Stop();
|
| - debounce_timer_.Start(FROM_HERE,
|
| + debounce_timer_.Start(
|
| + FROM_HERE,
|
| base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds),
|
| - this, &SettingGetterImplGSettings::OnDebouncedNotification);
|
| + this,
|
| + &SettingGetterImplGSettings::OnDebouncedNotification);
|
| }
|
|
|
| // gsettings notification callback, dispatched on the default glib main loop.
|
| - static void OnGSettingsChangeNotification(GSettings* client, gchar* key,
|
| + static void OnGSettingsChangeNotification(GSettings* client,
|
| + gchar* key,
|
| gpointer user_data) {
|
| VLOG(1) << "gsettings change notification for key " << key;
|
| // We don't track which key has changed, just that something did change.
|
| @@ -780,8 +800,7 @@ class SettingGetterImplGSettings
|
| DISALLOW_COPY_AND_ASSIGN(SettingGetterImplGSettings);
|
| };
|
|
|
| -bool SettingGetterImplGSettings::LoadAndCheckVersion(
|
| - base::Environment* env) {
|
| +bool SettingGetterImplGSettings::LoadAndCheckVersion(base::Environment* env) {
|
| // LoadAndCheckVersion() must be called *before* Init()!
|
| DCHECK(!client_);
|
|
|
| @@ -849,9 +868,13 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
|
| public base::MessagePumpLibevent::Watcher {
|
| public:
|
| explicit SettingGetterImplKDE(base::Environment* env_var_getter)
|
| - : inotify_fd_(-1), notify_delegate_(NULL), indirect_manual_(false),
|
| - auto_no_pac_(false), reversed_bypass_list_(false),
|
| - env_var_getter_(env_var_getter), file_loop_(NULL) {
|
| + : inotify_fd_(-1),
|
| + notify_delegate_(NULL),
|
| + indirect_manual_(false),
|
| + auto_no_pac_(false),
|
| + reversed_bypass_list_(false),
|
| + env_var_getter_(env_var_getter),
|
| + file_loop_(NULL) {
|
| // This has to be called on the UI thread (http://crbug.com/69057).
|
| base::ThreadRestrictions::ScopedAllowIO allow_io;
|
|
|
| @@ -962,7 +985,8 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
|
| // inotify watches inodes (so we'll be watching the old deleted file after
|
| // the first change, and it will never change again). So, we watch the
|
| // directory instead. We then act only on changes to the kioslaverc entry.
|
| - if (inotify_add_watch(inotify_fd_, kde_config_dir_.value().c_str(),
|
| + if (inotify_add_watch(inotify_fd_,
|
| + kde_config_dir_.value().c_str(),
|
| IN_MODIFY | IN_MOVED_TO) < 0)
|
| return false;
|
| notify_delegate_ = delegate;
|
| @@ -987,9 +1011,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
|
| DCHECK(base::MessageLoop::current() == file_loop_);
|
| OnChangeNotification();
|
| }
|
| - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE {
|
| - NOTREACHED();
|
| - }
|
| + virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE { NOTREACHED(); }
|
|
|
| virtual ProxyConfigSource GetConfigSource() OVERRIDE {
|
| return PROXY_CONFIG_SOURCE_KDE;
|
| @@ -1019,13 +1041,9 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
|
| return true;
|
| }
|
|
|
| - virtual bool BypassListIsReversed() OVERRIDE {
|
| - return reversed_bypass_list_;
|
| - }
|
| + virtual bool BypassListIsReversed() OVERRIDE { return reversed_bypass_list_; }
|
|
|
| - virtual bool MatchHostsUsingSuffixMatching() OVERRIDE {
|
| - return true;
|
| - }
|
| + virtual bool MatchHostsUsingSuffixMatching() OVERRIDE { return true; }
|
|
|
| private:
|
| void ResetCachedSettings() {
|
| @@ -1125,8 +1143,8 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
|
| if (mode) {
|
| // ProxyConfig does not support authentication parameters, but
|
| // Chrome will prompt for the password later. So we ignore this.
|
| - LOG(WARNING) <<
|
| - "Proxy authentication parameters ignored, see bug 16709";
|
| + LOG(WARNING)
|
| + << "Proxy authentication parameters ignored, see bug 16709";
|
| }
|
| }
|
| }
|
| @@ -1262,7 +1280,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
|
| // from the inotify file descriptor and starts up a debounce timer if
|
| // an event for kioslaverc is seen.
|
| void OnChangeNotification() {
|
| - DCHECK_GE(inotify_fd_, 0);
|
| + DCHECK_GE(inotify_fd_, 0);
|
| DCHECK(base::MessageLoop::current() == file_loop_);
|
| char event_buf[(sizeof(inotify_event) + NAME_MAX + 1) * 4];
|
| bool kioslaverc_touched = false;
|
| @@ -1306,15 +1324,17 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter,
|
| // We don't use Reset() because the timer may not yet be running.
|
| // (In that case Stop() is a no-op.)
|
| debounce_timer_.Stop();
|
| - debounce_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(
|
| - kDebounceTimeoutMilliseconds), this,
|
| + debounce_timer_.Start(
|
| + FROM_HERE,
|
| + base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds),
|
| + this,
|
| &SettingGetterImplKDE::OnDebouncedNotification);
|
| }
|
| }
|
|
|
| typedef std::map<StringSetting, std::string> string_map_type;
|
| - typedef std::map<StringListSetting,
|
| - std::vector<std::string> > strings_map_type;
|
| + typedef std::map<StringListSetting, std::vector<std::string> >
|
| + strings_map_type;
|
|
|
| int inotify_fd_;
|
| base::MessagePumpLibevent::FileDescriptorWatcher inotify_watcher_;
|
| @@ -1364,11 +1384,12 @@ bool ProxyConfigServiceLinux::Delegate::GetProxyFromSettings(
|
| // gconf settings do not appear to distinguish between SOCKS version. We
|
| // default to version 5. For more information on this policy decision, see:
|
| // http://code.google.com/p/chromium/issues/detail?id=55912#c2
|
| - ProxyServer::Scheme scheme = (host_key == SettingGetter::PROXY_SOCKS_HOST) ?
|
| - ProxyServer::SCHEME_SOCKS5 : ProxyServer::SCHEME_HTTP;
|
| + ProxyServer::Scheme scheme = (host_key == SettingGetter::PROXY_SOCKS_HOST)
|
| + ? ProxyServer::SCHEME_SOCKS5
|
| + : ProxyServer::SCHEME_HTTP;
|
| host = FixupProxyHostScheme(scheme, host);
|
| - ProxyServer proxy_server = ProxyServer::FromURI(host,
|
| - ProxyServer::SCHEME_HTTP);
|
| + ProxyServer proxy_server =
|
| + ProxyServer::FromURI(host, ProxyServer::SCHEME_HTTP);
|
| if (proxy_server.is_valid()) {
|
| *result_server = proxy_server;
|
| return true;
|
| @@ -1416,8 +1437,8 @@ bool ProxyConfigServiceLinux::Delegate::GetConfigFromSettings(
|
| }
|
| bool use_http_proxy;
|
| if (setting_getter_->GetBool(SettingGetter::PROXY_USE_HTTP_PROXY,
|
| - &use_http_proxy)
|
| - && !use_http_proxy) {
|
| + &use_http_proxy) &&
|
| + !use_http_proxy) {
|
| // Another master switch for some reason. If set to false, then no
|
| // proxy. But we don't panic if the key doesn't exist.
|
| return true;
|
| @@ -1427,8 +1448,7 @@ bool ProxyConfigServiceLinux::Delegate::GetConfigFromSettings(
|
| // Indicates to use the http proxy for all protocols. This one may
|
| // not exist (presumably on older versions); we assume false in that
|
| // case.
|
| - setting_getter_->GetBool(SettingGetter::PROXY_USE_SAME_PROXY,
|
| - &same_proxy);
|
| + setting_getter_->GetBool(SettingGetter::PROXY_USE_SAME_PROXY, &same_proxy);
|
|
|
| ProxyServer proxy_for_http;
|
| ProxyServer proxy_for_https;
|
| @@ -1464,10 +1484,10 @@ bool ProxyConfigServiceLinux::Delegate::GetConfigFromSettings(
|
| // Otherwise use the indicated proxies per-scheme.
|
| config->proxy_rules().type =
|
| ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME;
|
| - config->proxy_rules().proxies_for_http.
|
| - SetSingleProxyServer(proxy_for_http);
|
| - config->proxy_rules().proxies_for_https.
|
| - SetSingleProxyServer(proxy_for_https);
|
| + config->proxy_rules().proxies_for_http.SetSingleProxyServer(
|
| + proxy_for_http);
|
| + config->proxy_rules().proxies_for_https.SetSingleProxyServer(
|
| + proxy_for_https);
|
| config->proxy_rules().proxies_for_ftp.SetSingleProxyServer(proxy_for_ftp);
|
| config->proxy_rules().fallback_proxies.SetSingleProxyServer(socks_proxy);
|
| }
|
| @@ -1480,8 +1500,7 @@ bool ProxyConfigServiceLinux::Delegate::GetConfigFromSettings(
|
|
|
| // Check for authentication, just so we can warn.
|
| bool use_auth = false;
|
| - setting_getter_->GetBool(SettingGetter::PROXY_USE_AUTHENTICATION,
|
| - &use_auth);
|
| + setting_getter_->GetBool(SettingGetter::PROXY_USE_AUTHENTICATION, &use_auth);
|
| if (use_auth) {
|
| // ProxyConfig does not support authentication parameters, but
|
| // Chrome will prompt for the password later. So we ignore
|
| @@ -1497,8 +1516,8 @@ bool ProxyConfigServiceLinux::Delegate::GetConfigFromSettings(
|
| std::vector<std::string>::const_iterator it(ignore_hosts_list.begin());
|
| for (; it != ignore_hosts_list.end(); ++it) {
|
| if (setting_getter_->MatchHostsUsingSuffixMatching()) {
|
| - config->proxy_rules().bypass_rules.
|
| - AddRuleFromStringUsingSuffixMatching(*it);
|
| + config->proxy_rules().bypass_rules.AddRuleFromStringUsingSuffixMatching(
|
| + *it);
|
| } else {
|
| config->proxy_rules().bypass_rules.AddRuleFromString(*it);
|
| }
|
| @@ -1522,14 +1541,14 @@ ProxyConfigServiceLinux::Delegate::Delegate(base::Environment* env_var_getter)
|
| case base::nix::DESKTOP_ENVIRONMENT_GNOME:
|
| case base::nix::DESKTOP_ENVIRONMENT_UNITY:
|
| #if defined(USE_GIO)
|
| - {
|
| - scoped_ptr<SettingGetterImplGSettings> gs_getter(
|
| - new SettingGetterImplGSettings());
|
| - // We have to load symbols and check the GNOME version in use to decide
|
| - // if we should use the gsettings getter. See LoadAndCheckVersion().
|
| - if (gs_getter->LoadAndCheckVersion(env_var_getter))
|
| - setting_getter_.reset(gs_getter.release());
|
| - }
|
| + {
|
| + scoped_ptr<SettingGetterImplGSettings> gs_getter(
|
| + new SettingGetterImplGSettings());
|
| + // We have to load symbols and check the GNOME version in use to decide
|
| + // if we should use the gsettings getter. See LoadAndCheckVersion().
|
| + if (gs_getter->LoadAndCheckVersion(env_var_getter))
|
| + setting_getter_.reset(gs_getter.release());
|
| + }
|
| #endif
|
| #if defined(USE_GCONF)
|
| // Fall back on gconf if gsettings is unavailable or incorrect.
|
| @@ -1547,8 +1566,8 @@ ProxyConfigServiceLinux::Delegate::Delegate(base::Environment* env_var_getter)
|
| }
|
| }
|
|
|
| -ProxyConfigServiceLinux::Delegate::Delegate(
|
| - base::Environment* env_var_getter, SettingGetter* setting_getter)
|
| +ProxyConfigServiceLinux::Delegate::Delegate(base::Environment* env_var_getter,
|
| + SettingGetter* setting_getter)
|
| : env_var_getter_(env_var_getter), setting_getter_(setting_getter) {
|
| }
|
|
|
| @@ -1616,8 +1635,10 @@ void ProxyConfigServiceLinux::Delegate::SetUpAndFetchInitialConfig(
|
| SetUpNotifications();
|
| } else {
|
| // Post a task to set up notifications. We don't wait for success.
|
| - required_loop->PostTask(FROM_HERE, base::Bind(
|
| - &ProxyConfigServiceLinux::Delegate::SetUpNotifications, this));
|
| + required_loop->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&ProxyConfigServiceLinux::Delegate::SetUpNotifications,
|
| + this));
|
| }
|
| }
|
| }
|
| @@ -1654,8 +1675,7 @@ void ProxyConfigServiceLinux::Delegate::RemoveObserver(Observer* observer) {
|
| }
|
|
|
| ProxyConfigService::ConfigAvailability
|
| - ProxyConfigServiceLinux::Delegate::GetLatestProxyConfig(
|
| - ProxyConfig* config) {
|
| +ProxyConfigServiceLinux::Delegate::GetLatestProxyConfig(ProxyConfig* config) {
|
| // This is called from the IO thread.
|
| DCHECK(!io_thread_task_runner_.get() ||
|
| io_thread_task_runner_->BelongsToCurrentThread());
|
| @@ -1693,9 +1713,11 @@ void ProxyConfigServiceLinux::Delegate::OnCheckProxyConfigSettings() {
|
| !new_config.Equals(reference_config_)) {
|
| // Post a task to the IO thread with the new configuration, so it can
|
| // update |cached_config_|.
|
| - io_thread_task_runner_->PostTask(FROM_HERE, base::Bind(
|
| - &ProxyConfigServiceLinux::Delegate::SetNewProxyConfig,
|
| - this, new_config));
|
| + io_thread_task_runner_->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&ProxyConfigServiceLinux::Delegate::SetNewProxyConfig,
|
| + this,
|
| + new_config));
|
| // Update the thread-private copy in |reference_config_| as well.
|
| reference_config_ = new_config;
|
| } else {
|
| @@ -1709,7 +1731,8 @@ void ProxyConfigServiceLinux::Delegate::SetNewProxyConfig(
|
| VLOG(1) << "Proxy configuration changed";
|
| cached_config_ = new_config;
|
| FOR_EACH_OBSERVER(
|
| - Observer, observers_,
|
| + Observer,
|
| + observers_,
|
| OnProxyConfigChanged(new_config, ProxyConfigService::CONFIG_VALID));
|
| }
|
|
|
| @@ -1725,8 +1748,9 @@ void ProxyConfigServiceLinux::Delegate::PostDestroyTask() {
|
| } else {
|
| // Post to shutdown thread. Note that on browser shutdown, we may quit
|
| // this MessageLoop and exit the program before ever running this.
|
| - shutdown_loop->PostTask(FROM_HERE, base::Bind(
|
| - &ProxyConfigServiceLinux::Delegate::OnDestroy, this));
|
| + shutdown_loop->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&ProxyConfigServiceLinux::Delegate::OnDestroy, this));
|
| }
|
| }
|
| void ProxyConfigServiceLinux::Delegate::OnDestroy() {
|
| @@ -1750,7 +1774,8 @@ ProxyConfigServiceLinux::ProxyConfigServiceLinux(
|
| }
|
|
|
| ProxyConfigServiceLinux::ProxyConfigServiceLinux(
|
| - base::Environment* env_var_getter, SettingGetter* setting_getter)
|
| + base::Environment* env_var_getter,
|
| + SettingGetter* setting_getter)
|
| : delegate_(new Delegate(env_var_getter, setting_getter)) {
|
| }
|
|
|
| @@ -1763,7 +1788,7 @@ void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) {
|
| }
|
|
|
| ProxyConfigService::ConfigAvailability
|
| - ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) {
|
| +ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) {
|
| return delegate_->GetLatestProxyConfig(config);
|
| }
|
|
|
|
|