| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/proxy/proxy_service.h" | 5 #include "net/proxy/proxy_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return OK; | 300 return OK; |
| 301 } | 301 } |
| 302 | 302 |
| 303 private: | 303 private: |
| 304 const std::string pac_string_; | 304 const std::string pac_string_; |
| 305 | 305 |
| 306 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryForPacResult); | 306 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryForPacResult); |
| 307 }; | 307 }; |
| 308 | 308 |
| 309 // Returns NetLog parameters describing a proxy configuration change. | 309 // Returns NetLog parameters describing a proxy configuration change. |
| 310 base::Value* NetLogProxyConfigChangedCallback( | 310 scoped_ptr<base::Value> NetLogProxyConfigChangedCallback( |
| 311 const ProxyConfig* old_config, | 311 const ProxyConfig* old_config, |
| 312 const ProxyConfig* new_config, | 312 const ProxyConfig* new_config, |
| 313 NetLogCaptureMode /* capture_mode */) { | 313 NetLogCaptureMode /* capture_mode */) { |
| 314 base::DictionaryValue* dict = new base::DictionaryValue(); | 314 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 315 // The "old_config" is optional -- the first notification will not have | 315 // The "old_config" is optional -- the first notification will not have |
| 316 // any "previous" configuration. | 316 // any "previous" configuration. |
| 317 if (old_config->is_valid()) | 317 if (old_config->is_valid()) |
| 318 dict->Set("old_config", old_config->ToValue()); | 318 dict->Set("old_config", old_config->ToValue()); |
| 319 dict->Set("new_config", new_config->ToValue()); | 319 dict->Set("new_config", new_config->ToValue()); |
| 320 return dict; | 320 return dict.Pass(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 base::Value* NetLogBadProxyListCallback(const ProxyRetryInfoMap* retry_info, | 323 scoped_ptr<base::Value> NetLogBadProxyListCallback( |
| 324 NetLogCaptureMode /* capture_mode */) { | 324 const ProxyRetryInfoMap* retry_info, |
| 325 base::DictionaryValue* dict = new base::DictionaryValue(); | 325 NetLogCaptureMode /* capture_mode */) { |
| 326 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 326 base::ListValue* list = new base::ListValue(); | 327 base::ListValue* list = new base::ListValue(); |
| 327 | 328 |
| 328 for (ProxyRetryInfoMap::const_iterator iter = retry_info->begin(); | 329 for (ProxyRetryInfoMap::const_iterator iter = retry_info->begin(); |
| 329 iter != retry_info->end(); ++iter) { | 330 iter != retry_info->end(); ++iter) { |
| 330 list->Append(new base::StringValue(iter->first)); | 331 list->Append(new base::StringValue(iter->first)); |
| 331 } | 332 } |
| 332 dict->Set("bad_proxy_list", list); | 333 dict->Set("bad_proxy_list", list); |
| 333 return dict; | 334 return dict.Pass(); |
| 334 } | 335 } |
| 335 | 336 |
| 336 // Returns NetLog parameters on a successfuly proxy resolution. | 337 // Returns NetLog parameters on a successfuly proxy resolution. |
| 337 base::Value* NetLogFinishedResolvingProxyCallback( | 338 scoped_ptr<base::Value> NetLogFinishedResolvingProxyCallback( |
| 338 const ProxyInfo* result, | 339 const ProxyInfo* result, |
| 339 NetLogCaptureMode /* capture_mode */) { | 340 NetLogCaptureMode /* capture_mode */) { |
| 340 base::DictionaryValue* dict = new base::DictionaryValue(); | 341 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 341 dict->SetString("pac_string", result->ToPacString()); | 342 dict->SetString("pac_string", result->ToPacString()); |
| 342 return dict; | 343 return dict.Pass(); |
| 343 } | 344 } |
| 344 | 345 |
| 345 #if defined(OS_CHROMEOS) | 346 #if defined(OS_CHROMEOS) |
| 346 class UnsetProxyConfigService : public ProxyConfigService { | 347 class UnsetProxyConfigService : public ProxyConfigService { |
| 347 public: | 348 public: |
| 348 UnsetProxyConfigService() {} | 349 UnsetProxyConfigService() {} |
| 349 ~UnsetProxyConfigService() override {} | 350 ~UnsetProxyConfigService() override {} |
| 350 | 351 |
| 351 void AddObserver(Observer* observer) override {} | 352 void AddObserver(Observer* observer) override {} |
| 352 void RemoveObserver(Observer* observer) override {} | 353 void RemoveObserver(Observer* observer) override {} |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 State previous_state = ResetProxyConfig(false); | 1657 State previous_state = ResetProxyConfig(false); |
| 1657 if (previous_state != STATE_NONE) | 1658 if (previous_state != STATE_NONE) |
| 1658 ApplyProxyConfigIfAvailable(); | 1659 ApplyProxyConfigIfAvailable(); |
| 1659 } | 1660 } |
| 1660 | 1661 |
| 1661 void ProxyService::OnDNSChanged() { | 1662 void ProxyService::OnDNSChanged() { |
| 1662 OnIPAddressChanged(); | 1663 OnIPAddressChanged(); |
| 1663 } | 1664 } |
| 1664 | 1665 |
| 1665 } // namespace net | 1666 } // namespace net |
| OLD | NEW |