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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 8102019: redesign and reimplement proxy config service and tracker, revise proxy ui on cros (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/leak_tracker.h" 10 #include "base/debug/leak_tracker.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_split.h" 15 #include "base/string_split.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/threading/thread_restrictions.h" 17 #include "base/threading/thread_restrictions.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/extensions/extension_event_router_forwarder.h" 20 #include "chrome/browser/extensions/extension_event_router_forwarder.h"
21 #include "chrome/browser/media/media_internals.h" 21 #include "chrome/browser/media/media_internals.h"
22 #include "chrome/browser/net/chrome_network_delegate.h" 22 #include "chrome/browser/net/chrome_network_delegate.h"
23 #include "chrome/browser/net/chrome_net_log.h" 23 #include "chrome/browser/net/chrome_net_log.h"
24 #include "chrome/browser/net/chrome_url_request_context.h" 24 #include "chrome/browser/net/chrome_url_request_context.h"
25 #include "chrome/browser/net/connect_interceptor.h" 25 #include "chrome/browser/net/connect_interceptor.h"
26 #include "chrome/browser/net/passive_log_collector.h" 26 #include "chrome/browser/net/passive_log_collector.h"
27 #include "chrome/browser/net/pref_proxy_config_service.h" 27 #include "chrome/browser/net/pref_proxy_config_tracker.h"
28 #include "chrome/browser/net/proxy_service_factory.h" 28 #include "chrome/browser/net/proxy_service_factory.h"
29 #include "chrome/browser/net/sdch_dictionary_fetcher.h" 29 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
30 #include "chrome/browser/prefs/pref_service.h" 30 #include "chrome/browser/prefs/pref_service.h"
31 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
33 #include "content/browser/browser_thread.h" 33 #include "content/browser/browser_thread.h"
34 #include "content/browser/gpu/gpu_process_host.h" 34 #include "content/browser/gpu/gpu_process_host.h"
35 #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" 35 #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h"
36 #include "content/common/net/url_fetcher.h" 36 #include "content/common/net/url_fetcher.h"
37 #include "content/public/common/content_client.h" 37 #include "content/public/common/content_client.h"
(...skipping 17 matching lines...) Expand all
55 #include "net/http/http_server_properties_impl.h" 55 #include "net/http/http_server_properties_impl.h"
56 #include "net/proxy/proxy_config_service.h" 56 #include "net/proxy/proxy_config_service.h"
57 #include "net/proxy/proxy_script_fetcher_impl.h" 57 #include "net/proxy/proxy_script_fetcher_impl.h"
58 #include "net/proxy/proxy_service.h" 58 #include "net/proxy/proxy_service.h"
59 #include "net/socket/dns_cert_provenance_checker.h" 59 #include "net/socket/dns_cert_provenance_checker.h"
60 60
61 #if defined(USE_NSS) 61 #if defined(USE_NSS)
62 #include "net/ocsp/nss_ocsp.h" 62 #include "net/ocsp/nss_ocsp.h"
63 #endif // defined(USE_NSS) 63 #endif // defined(USE_NSS)
64 64
65 #if defined(OS_CHROMEOS)
66 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
67 #endif // defined(OS_CHROMEOS)
68
65 namespace { 69 namespace {
66 70
67 // Custom URLRequestContext used by requests which aren't associated with a 71 // Custom URLRequestContext used by requests which aren't associated with a
68 // particular profile. We need to use a subclass of URLRequestContext in order 72 // particular profile. We need to use a subclass of URLRequestContext in order
69 // to provide the correct User-Agent. 73 // to provide the correct User-Agent.
70 class URLRequestContextWithUserAgent : public net::URLRequestContext { 74 class URLRequestContextWithUserAgent : public net::URLRequestContext {
71 public: 75 public:
72 virtual const std::string& GetUserAgent( 76 virtual const std::string& GetUserAgent(
73 const GURL& url) const OVERRIDE { 77 const GURL& url) const OVERRIDE {
74 return content::GetUserAgent(url); 78 return content::GetUserAgent(url);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 RegisterPrefs(local_state); 355 RegisterPrefs(local_state);
352 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); 356 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes);
353 negotiate_disable_cname_lookup_ = local_state->GetBoolean( 357 negotiate_disable_cname_lookup_ = local_state->GetBoolean(
354 prefs::kDisableAuthNegotiateCnameLookup); 358 prefs::kDisableAuthNegotiateCnameLookup);
355 negotiate_enable_port_ = local_state->GetBoolean( 359 negotiate_enable_port_ = local_state->GetBoolean(
356 prefs::kEnableAuthNegotiatePort); 360 prefs::kEnableAuthNegotiatePort);
357 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist); 361 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist);
358 auth_delegate_whitelist_ = local_state->GetString( 362 auth_delegate_whitelist_ = local_state->GetString(
359 prefs::kAuthNegotiateDelegateWhitelist); 363 prefs::kAuthNegotiateDelegateWhitelist);
360 gssapi_library_name_ = local_state->GetString(prefs::kGSSAPILibraryName); 364 gssapi_library_name_ = local_state->GetString(prefs::kGSSAPILibraryName);
361 pref_proxy_config_tracker_ = new PrefProxyConfigTracker(local_state); 365 pref_proxy_config_tracker_.reset(
366 ProxyServiceFactory::CreatePrefProxyConfigTracker(local_state));
362 ChromeNetworkDelegate::InitializeReferrersEnabled(&system_enable_referrers_, 367 ChromeNetworkDelegate::InitializeReferrersEnabled(&system_enable_referrers_,
363 local_state); 368 local_state);
364 ssl_config_service_manager_.reset( 369 ssl_config_service_manager_.reset(
365 SSLConfigServiceManager::CreateDefaultManager(local_state)); 370 SSLConfigServiceManager::CreateDefaultManager(local_state));
366 MessageLoop::current()->PostTask(FROM_HERE, 371 MessageLoop::current()->PostTask(FROM_HERE,
367 method_factory_.NewRunnableMethod( 372 method_factory_.NewRunnableMethod(
368 &IOThread::InitSystemRequestContext)); 373 &IOThread::InitSystemRequestContext));
369 } 374 }
370 375
371 IOThread::~IOThread() { 376 IOThread::~IOThread() {
372 if (pref_proxy_config_tracker_) 377 if (pref_proxy_config_tracker_.get())
373 pref_proxy_config_tracker_->DetachFromPrefService(); 378 pref_proxy_config_tracker_->DetachFromPrefService();
374 // We cannot rely on our base class to stop the thread since we want our 379 // We cannot rely on our base class to stop the thread since we want our
375 // CleanUp function to run. 380 // CleanUp function to run.
376 Stop(); 381 Stop();
377 DCHECK(!globals_); 382 DCHECK(!globals_);
378 } 383 }
379 384
380 IOThread::Globals* IOThread::globals() { 385 IOThread::Globals* IOThread::globals() {
381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 386 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
382 return globals_; 387 return globals_;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 net::SSLConfigService* IOThread::GetSSLConfigService() { 575 net::SSLConfigService* IOThread::GetSSLConfigService() {
571 return ssl_config_service_manager_->Get(); 576 return ssl_config_service_manager_->Get();
572 } 577 }
573 578
574 void IOThread::InitSystemRequestContext() { 579 void IOThread::InitSystemRequestContext() {
575 if (system_url_request_context_getter_) 580 if (system_url_request_context_getter_)
576 return; 581 return;
577 // If we're in unit_tests, IOThread may not be run. 582 // If we're in unit_tests, IOThread may not be run.
578 if (!message_loop()) 583 if (!message_loop())
579 return; 584 return;
580 system_proxy_config_service_.reset( 585 ChromeProxyConfigService* proxy_config_service =
581 ProxyServiceFactory::CreateProxyConfigService( 586 ProxyServiceFactory::CreateProxyConfigService();
582 pref_proxy_config_tracker_)); 587 system_proxy_config_service_.reset(proxy_config_service);
588 if (pref_proxy_config_tracker_.get()) {
589 pref_proxy_config_tracker_->SetChromeProxyConfigService(
590 proxy_config_service);
591 }
583 system_url_request_context_getter_ = 592 system_url_request_context_getter_ =
584 new SystemURLRequestContextGetter(this); 593 new SystemURLRequestContextGetter(this);
585 message_loop()->PostTask( 594 message_loop()->PostTask(
586 FROM_HERE, 595 FROM_HERE,
587 NewRunnableMethod( 596 NewRunnableMethod(
588 this, 597 this,
589 &IOThread::InitSystemRequestContextOnIOThread)); 598 &IOThread::InitSystemRequestContextOnIOThread));
590 } 599 }
591 600
592 void IOThread::InitSystemRequestContextOnIOThread() { 601 void IOThread::InitSystemRequestContextOnIOThread() {
(...skipping 24 matching lines...) Expand all
617 system_params.network_delegate = globals_->system_network_delegate.get(); 626 system_params.network_delegate = globals_->system_network_delegate.get();
618 system_params.net_log = net_log_; 627 system_params.net_log = net_log_;
619 globals_->system_http_transaction_factory.reset( 628 globals_->system_http_transaction_factory.reset(
620 new net::HttpNetworkLayer( 629 new net::HttpNetworkLayer(
621 new net::HttpNetworkSession(system_params))); 630 new net::HttpNetworkSession(system_params)));
622 globals_->system_ftp_transaction_factory.reset( 631 globals_->system_ftp_transaction_factory.reset(
623 new net::FtpNetworkLayer(globals_->host_resolver.get())); 632 new net::FtpNetworkLayer(globals_->host_resolver.get()));
624 globals_->system_request_context = 633 globals_->system_request_context =
625 ConstructSystemRequestContext(globals_, net_log_); 634 ConstructSystemRequestContext(globals_, net_log_);
626 } 635 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698