| 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 #include "chrome/browser/net/pref_proxy_config_service.h" | 5 #include "chrome/browser/net/pref_proxy_config_service.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/prefs/pref_set_observer.h" | 9 #include "chrome/browser/prefs/pref_set_observer.h" |
| 10 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 10 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 LOG(ERROR) << "Proxy settings request PAC script but do not specify " | 130 LOG(ERROR) << "Proxy settings request PAC script but do not specify " |
| 131 << "its URL. Falling back to direct connection."; | 131 << "its URL. Falling back to direct connection."; |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 GURL proxy_pac_url(proxy_pac); | 134 GURL proxy_pac_url(proxy_pac); |
| 135 if (!proxy_pac_url.is_valid()) { | 135 if (!proxy_pac_url.is_valid()) { |
| 136 LOG(ERROR) << "Invalid proxy PAC url: " << proxy_pac; | 136 LOG(ERROR) << "Invalid proxy PAC url: " << proxy_pac; |
| 137 return true; | 137 return true; |
| 138 } | 138 } |
| 139 config->set_pac_url(proxy_pac_url); | 139 config->set_pac_url(proxy_pac_url); |
| 140 bool pac_mandatory = false; |
| 141 proxy_dict.GetPacMandatory(&pac_mandatory); |
| 142 config->set_pac_mandatory(pac_mandatory); |
| 140 return true; | 143 return true; |
| 141 } | 144 } |
| 142 case ProxyPrefs::MODE_FIXED_SERVERS: { | 145 case ProxyPrefs::MODE_FIXED_SERVERS: { |
| 143 std::string proxy_server; | 146 std::string proxy_server; |
| 144 if (!proxy_dict.GetProxyServer(&proxy_server)) { | 147 if (!proxy_dict.GetProxyServer(&proxy_server)) { |
| 145 LOG(ERROR) << "Proxy settings request fixed proxy servers but do not " | 148 LOG(ERROR) << "Proxy settings request fixed proxy servers but do not " |
| 146 << "specify their URLs. Falling back to direct connection."; | 149 << "specify their URLs. Falling back to direct connection."; |
| 147 return true; | 150 return true; |
| 148 } | 151 } |
| 149 config->proxy_rules().ParseFromString(proxy_server); | 152 config->proxy_rules().ParseFromString(proxy_server); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 pref_config_tracker_->AddObserver(this); | 264 pref_config_tracker_->AddObserver(this); |
| 262 registered_observers_ = true; | 265 registered_observers_ = true; |
| 263 } | 266 } |
| 264 } | 267 } |
| 265 | 268 |
| 266 // static | 269 // static |
| 267 void PrefProxyConfigService::RegisterPrefs(PrefService* pref_service) { | 270 void PrefProxyConfigService::RegisterPrefs(PrefService* pref_service) { |
| 268 DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); | 271 DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); |
| 269 pref_service->RegisterDictionaryPref(prefs::kProxy, default_settings); | 272 pref_service->RegisterDictionaryPref(prefs::kProxy, default_settings); |
| 270 } | 273 } |
| OLD | NEW |