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

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

Issue 387003008: ifdef extensions code in BrowserProcess, IOThread, and ChromeNetworkDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 5 months 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
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/debug/leak_tracker.h" 14 #include "base/debug/leak_tracker.h"
15 #include "base/debug/trace_event.h" 15 #include "base/debug/trace_event.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/metrics/field_trial.h" 17 #include "base/metrics/field_trial.h"
18 #include "base/prefs/pref_registry_simple.h" 18 #include "base/prefs/pref_registry_simple.h"
19 #include "base/prefs/pref_service.h" 19 #include "base/prefs/pref_service.h"
20 #include "base/stl_util.h" 20 #include "base/stl_util.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_split.h" 22 #include "base/strings/string_split.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/threading/sequenced_worker_pool.h" 24 #include "base/threading/sequenced_worker_pool.h"
25 #include "base/threading/thread.h" 25 #include "base/threading/thread.h"
26 #include "base/threading/worker_pool.h" 26 #include "base/threading/worker_pool.h"
27 #include "base/time/time.h" 27 #include "base/time/time.h"
28 #include "build/build_config.h" 28 #include "build/build_config.h"
29 #include "chrome/browser/browser_process.h" 29 #include "chrome/browser/browser_process.h"
30 #include "chrome/browser/extensions/event_router_forwarder.h"
31 #include "chrome/browser/net/async_dns_field_trial.h" 30 #include "chrome/browser/net/async_dns_field_trial.h"
32 #include "chrome/browser/net/chrome_net_log.h" 31 #include "chrome/browser/net/chrome_net_log.h"
33 #include "chrome/browser/net/chrome_network_delegate.h" 32 #include "chrome/browser/net/chrome_network_delegate.h"
34 #include "chrome/browser/net/chrome_url_request_context.h" 33 #include "chrome/browser/net/chrome_url_request_context.h"
35 #include "chrome/browser/net/connect_interceptor.h" 34 #include "chrome/browser/net/connect_interceptor.h"
36 #include "chrome/browser/net/dns_probe_service.h" 35 #include "chrome/browser/net/dns_probe_service.h"
37 #include "chrome/browser/net/pref_proxy_config_tracker.h" 36 #include "chrome/browser/net/pref_proxy_config_tracker.h"
38 #include "chrome/browser/net/proxy_service_factory.h" 37 #include "chrome/browser/net/proxy_service_factory.h"
39 #include "chrome/common/chrome_content_client.h" 38 #include "chrome/common/chrome_content_client.h"
40 #include "chrome/common/chrome_switches.h" 39 #include "chrome/common/chrome_switches.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "net/url_request/static_http_user_agent_settings.h" 74 #include "net/url_request/static_http_user_agent_settings.h"
76 #include "net/url_request/url_fetcher.h" 75 #include "net/url_request/url_fetcher.h"
77 #include "net/url_request/url_request_job_factory_impl.h" 76 #include "net/url_request/url_request_job_factory_impl.h"
78 #include "net/url_request/url_request_throttler_manager.h" 77 #include "net/url_request/url_request_throttler_manager.h"
79 #include "url/url_constants.h" 78 #include "url/url_constants.h"
80 79
81 #if defined(ENABLE_CONFIGURATION_POLICY) 80 #if defined(ENABLE_CONFIGURATION_POLICY)
82 #include "policy/policy_constants.h" 81 #include "policy/policy_constants.h"
83 #endif 82 #endif
84 83
84 #if defined(ENABLE_EXTENSIONS)
85 #include "chrome/browser/extensions/event_router_forwarder.h"
86 #endif
87
85 #if !defined(USE_OPENSSL) 88 #if !defined(USE_OPENSSL)
86 #include "net/cert/ct_log_verifier.h" 89 #include "net/cert/ct_log_verifier.h"
87 #include "net/cert/multi_log_ct_verifier.h" 90 #include "net/cert/multi_log_ct_verifier.h"
88 #endif 91 #endif
89 92
90 #if defined(USE_NSS) || defined(OS_IOS) 93 #if defined(USE_NSS) || defined(OS_IOS)
91 #include "net/ocsp/nss_ocsp.h" 94 #include "net/ocsp/nss_ocsp.h"
92 #endif 95 #endif
93 96
94 #if defined(OS_ANDROID) || defined(OS_IOS) 97 #if defined(OS_ANDROID) || defined(OS_IOS)
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 IOThread::Globals::~Globals() {} 439 IOThread::Globals::~Globals() {}
437 440
438 // |local_state| is passed in explicitly in order to (1) reduce implicit 441 // |local_state| is passed in explicitly in order to (1) reduce implicit
439 // dependencies and (2) make IOThread more flexible for testing. 442 // dependencies and (2) make IOThread more flexible for testing.
440 IOThread::IOThread( 443 IOThread::IOThread(
441 PrefService* local_state, 444 PrefService* local_state,
442 policy::PolicyService* policy_service, 445 policy::PolicyService* policy_service,
443 ChromeNetLog* net_log, 446 ChromeNetLog* net_log,
444 extensions::EventRouterForwarder* extension_event_router_forwarder) 447 extensions::EventRouterForwarder* extension_event_router_forwarder)
445 : net_log_(net_log), 448 : net_log_(net_log),
449 #if defined(ENABLE_EXTENSIONS)
446 extension_event_router_forwarder_(extension_event_router_forwarder), 450 extension_event_router_forwarder_(extension_event_router_forwarder),
451 #endif
447 globals_(NULL), 452 globals_(NULL),
448 is_spdy_disabled_by_policy_(false), 453 is_spdy_disabled_by_policy_(false),
449 weak_factory_(this), 454 weak_factory_(this),
450 creation_time_(base::TimeTicks::Now()) { 455 creation_time_(base::TimeTicks::Now()) {
451 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); 456 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes);
452 negotiate_disable_cname_lookup_ = local_state->GetBoolean( 457 negotiate_disable_cname_lookup_ = local_state->GetBoolean(
453 prefs::kDisableAuthNegotiateCnameLookup); 458 prefs::kDisableAuthNegotiateCnameLookup);
454 negotiate_enable_port_ = local_state->GetBoolean( 459 negotiate_enable_port_ = local_state->GetBoolean(
455 prefs::kEnableAuthNegotiatePort); 460 prefs::kEnableAuthNegotiatePort);
456 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist); 461 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 560
556 // Add an observer that will emit network change events to the ChromeNetLog. 561 // Add an observer that will emit network change events to the ChromeNetLog.
557 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be 562 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be
558 // logging the network change before other IO thread consumers respond to it. 563 // logging the network change before other IO thread consumers respond to it.
559 network_change_observer_.reset( 564 network_change_observer_.reset(
560 new LoggingNetworkChangeObserver(net_log_)); 565 new LoggingNetworkChangeObserver(net_log_));
561 566
562 // Setup the HistogramWatcher to run on the IO thread. 567 // Setup the HistogramWatcher to run on the IO thread.
563 net::NetworkChangeNotifier::InitHistogramWatcher(); 568 net::NetworkChangeNotifier::InitHistogramWatcher();
564 569
570 #if defined(ENABLE_EXTENSIONS)
565 globals_->extension_event_router_forwarder = 571 globals_->extension_event_router_forwarder =
566 extension_event_router_forwarder_; 572 extension_event_router_forwarder_;
573 #endif
574
567 ChromeNetworkDelegate* network_delegate = 575 ChromeNetworkDelegate* network_delegate =
568 new ChromeNetworkDelegate(extension_event_router_forwarder_, 576 new ChromeNetworkDelegate(extension_event_router_forwarder(),
569 &system_enable_referrers_); 577 &system_enable_referrers_);
578
570 if (command_line.HasSwitch(switches::kEnableClientHints)) 579 if (command_line.HasSwitch(switches::kEnableClientHints))
571 network_delegate->SetEnableClientHints(); 580 network_delegate->SetEnableClientHints();
581
582 #if defined(ENABLE_EXTENSIONS)
572 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) 583 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling))
573 network_delegate->NeverThrottleRequests(); 584 network_delegate->NeverThrottleRequests();
585 #endif
586
574 globals_->system_network_delegate.reset(network_delegate); 587 globals_->system_network_delegate.reset(network_delegate);
575 globals_->host_resolver = CreateGlobalHostResolver(net_log_); 588 globals_->host_resolver = CreateGlobalHostResolver(net_log_);
576 UpdateDnsClientEnabled(); 589 UpdateDnsClientEnabled();
577 #if defined(OS_CHROMEOS) 590 #if defined(OS_CHROMEOS)
578 // Creates a CertVerifyProc that doesn't allow any profile-provided certs. 591 // Creates a CertVerifyProc that doesn't allow any profile-provided certs.
579 globals_->cert_verifier.reset(new net::MultiThreadedCertVerifier( 592 globals_->cert_verifier.reset(new net::MultiThreadedCertVerifier(
580 new chromeos::CertVerifyProcChromeOS())); 593 new chromeos::CertVerifyProcChromeOS()));
581 #else 594 #else
582 globals_->cert_verifier.reset(new net::MultiThreadedCertVerifier( 595 globals_->cert_verifier.reset(new net::MultiThreadedCertVerifier(
583 net::CertVerifyProc::CreateDefault())); 596 net::CertVerifyProc::CreateDefault()));
584 #endif 597 #endif
585 598
586 globals_->transport_security_state.reset(new net::TransportSecurityState()); 599 globals_->transport_security_state.reset(new net::TransportSecurityState());
587 #if !defined(USE_OPENSSL) 600 #if !defined(USE_OPENSSL)
588 // For now, Certificate Transparency is only implemented for platforms 601 // For now, Certificate Transparency is only implemented for platforms
589 // that use NSS. 602 // that use NSS.
590 net::MultiLogCTVerifier* ct_verifier = new net::MultiLogCTVerifier(); 603 net::MultiLogCTVerifier* ct_verifier = new net::MultiLogCTVerifier();
591 globals_->cert_transparency_verifier.reset(ct_verifier); 604 globals_->cert_transparency_verifier.reset(ct_verifier);
592 605
593 // Add built-in logs 606 // Add built-in logs
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1380 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1368 for (size_t i = 0; i < supported_versions.size(); ++i) { 1381 for (size_t i = 0; i < supported_versions.size(); ++i) {
1369 net::QuicVersion version = supported_versions[i]; 1382 net::QuicVersion version = supported_versions[i];
1370 if (net::QuicVersionToString(version) == quic_version) { 1383 if (net::QuicVersionToString(version) == quic_version) {
1371 return version; 1384 return version;
1372 } 1385 }
1373 } 1386 }
1374 1387
1375 return net::QUIC_VERSION_UNSUPPORTED; 1388 return net::QUIC_VERSION_UNSUPPORTED;
1376 } 1389 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698