| 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/chromeos/proxy_config_service_impl.h" | 5 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 reference_config_.mode = ProxyConfig::MODE_PROXY_PER_SCHEME; | 408 reference_config_.mode = ProxyConfig::MODE_PROXY_PER_SCHEME; |
| 409 proxy->server = server; | 409 proxy->server = server; |
| 410 OnUISetProxyConfig(persist_to_device_); | 410 OnUISetProxyConfig(persist_to_device_); |
| 411 return true; | 411 return true; |
| 412 } | 412 } |
| 413 | 413 |
| 414 bool ProxyConfigServiceImpl::UISetProxyConfigBypassRules( | 414 bool ProxyConfigServiceImpl::UISetProxyConfigBypassRules( |
| 415 const net::ProxyBypassRules& bypass_rules) { | 415 const net::ProxyBypassRules& bypass_rules) { |
| 416 // Should be called from UI thread. | 416 // Should be called from UI thread. |
| 417 CheckCurrentlyOnUIThread(); | 417 CheckCurrentlyOnUIThread(); |
| 418 DCHECK(reference_config_.mode == ProxyConfig::MODE_SINGLE_PROXY || | |
| 419 reference_config_.mode == ProxyConfig::MODE_PROXY_PER_SCHEME); | |
| 420 if (reference_config_.mode != ProxyConfig::MODE_SINGLE_PROXY && | 418 if (reference_config_.mode != ProxyConfig::MODE_SINGLE_PROXY && |
| 421 reference_config_.mode != ProxyConfig::MODE_PROXY_PER_SCHEME) { | 419 reference_config_.mode != ProxyConfig::MODE_PROXY_PER_SCHEME) { |
| 420 NOTREACHED(); |
| 422 VLOG(1) << "Cannot set bypass rules for proxy mode [" | 421 VLOG(1) << "Cannot set bypass rules for proxy mode [" |
| 423 << reference_config_.mode << "]"; | 422 << reference_config_.mode << "]"; |
| 424 return false; | 423 return false; |
| 425 } | 424 } |
| 426 reference_config_.bypass_rules = bypass_rules; | 425 reference_config_.bypass_rules = bypass_rules; |
| 427 OnUISetProxyConfig(persist_to_device_); | 426 OnUISetProxyConfig(persist_to_device_); |
| 428 return true; | 427 return true; |
| 429 } | 428 } |
| 430 | 429 |
| 431 void ProxyConfigServiceImpl::AddObserver( | 430 void ProxyConfigServiceImpl::AddObserver( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 return; | 527 return; |
| 529 } | 528 } |
| 530 | 529 |
| 531 // Now guaranteed to be on the correct thread. | 530 // Now guaranteed to be on the correct thread. |
| 532 VLOG(1) << "Proxy configuration changed"; | 531 VLOG(1) << "Proxy configuration changed"; |
| 533 cached_config_ = new_config; | 532 cached_config_ = new_config; |
| 534 config_availability_ = new_availability; | 533 config_availability_ = new_availability; |
| 535 // Notify observers of new proxy config. | 534 // Notify observers of new proxy config. |
| 536 net::ProxyConfig net_config; | 535 net::ProxyConfig net_config; |
| 537 cached_config_.ToNetProxyConfig(&net_config); | 536 cached_config_.ToNetProxyConfig(&net_config); |
| 537 if (net_config.proxy_rules().type != |
| 538 net::ProxyConfig::ProxyRules::TYPE_NO_RULES) { |
| 539 net_config.proxy_rules().bypass_rules.AddRuleToBypassLocal(); |
| 540 } |
| 538 FOR_EACH_OBSERVER(net::ProxyConfigService::Observer, observers_, | 541 FOR_EACH_OBSERVER(net::ProxyConfigService::Observer, observers_, |
| 539 OnProxyConfigChanged(net_config, config_availability_)); | 542 OnProxyConfigChanged(net_config, config_availability_)); |
| 540 } | 543 } |
| 541 | 544 |
| 542 void ProxyConfigServiceImpl::CheckCurrentlyOnIOThread() { | 545 void ProxyConfigServiceImpl::CheckCurrentlyOnIOThread() { |
| 543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 546 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 544 } | 547 } |
| 545 | 548 |
| 546 void ProxyConfigServiceImpl::CheckCurrentlyOnUIThread() { | 549 void ProxyConfigServiceImpl::CheckCurrentlyOnUIThread() { |
| 547 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 550 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 548 } | 551 } |
| 549 | 552 |
| 550 } // namespace chromeos | 553 } // namespace chromeos |
| OLD | NEW |