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 "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 IOThread::IOThread( | 304 IOThread::IOThread( |
305 PrefService* local_state, | 305 PrefService* local_state, |
306 policy::PolicyService* policy_service, | 306 policy::PolicyService* policy_service, |
307 net_log::ChromeNetLog* net_log, | 307 net_log::ChromeNetLog* net_log, |
308 extensions::EventRouterForwarder* extension_event_router_forwarder) | 308 extensions::EventRouterForwarder* extension_event_router_forwarder) |
309 : net_log_(net_log), | 309 : net_log_(net_log), |
310 #if defined(ENABLE_EXTENSIONS) | 310 #if defined(ENABLE_EXTENSIONS) |
311 extension_event_router_forwarder_(extension_event_router_forwarder), | 311 extension_event_router_forwarder_(extension_event_router_forwarder), |
312 #endif | 312 #endif |
313 globals_(NULL), | 313 globals_(NULL), |
314 is_spdy_allowed_by_policy_(true), | |
315 is_quic_allowed_by_policy_(true), | 314 is_quic_allowed_by_policy_(true), |
316 creation_time_(base::TimeTicks::Now()), | 315 creation_time_(base::TimeTicks::Now()), |
317 weak_factory_(this) { | 316 weak_factory_(this) { |
318 scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy = | 317 scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy = |
319 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 318 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
320 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); | 319 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); |
321 negotiate_disable_cname_lookup_.Init( | 320 negotiate_disable_cname_lookup_.Init( |
322 prefs::kDisableAuthNegotiateCnameLookup, local_state, | 321 prefs::kDisableAuthNegotiateCnameLookup, local_state, |
323 base::Bind(&IOThread::UpdateNegotiateDisableCnameLookup, | 322 base::Bind(&IOThread::UpdateNegotiateDisableCnameLookup, |
324 base::Unretained(this))); | 323 base::Unretained(this))); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 dns_client_enabled_.MoveToThread(io_thread_proxy); | 373 dns_client_enabled_.MoveToThread(io_thread_proxy); |
375 | 374 |
376 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, | 375 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, |
377 local_state); | 376 local_state); |
378 quick_check_enabled_.MoveToThread(io_thread_proxy); | 377 quick_check_enabled_.MoveToThread(io_thread_proxy); |
379 | 378 |
380 pac_https_url_stripping_enabled_.Init(prefs::kPacHttpsUrlStrippingEnabled, | 379 pac_https_url_stripping_enabled_.Init(prefs::kPacHttpsUrlStrippingEnabled, |
381 local_state); | 380 local_state); |
382 pac_https_url_stripping_enabled_.MoveToThread(io_thread_proxy); | 381 pac_https_url_stripping_enabled_.MoveToThread(io_thread_proxy); |
383 | 382 |
384 is_spdy_allowed_by_policy_ = | |
385 policy_service | |
386 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | |
387 std::string())) | |
388 .Get(policy::key::kDisableSpdy) == nullptr; | |
389 | |
390 const base::Value* value = policy_service->GetPolicies( | 383 const base::Value* value = policy_service->GetPolicies( |
391 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 384 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
392 std::string())).GetValue(policy::key::kQuicAllowed); | 385 std::string())).GetValue(policy::key::kQuicAllowed); |
393 if (value) | 386 if (value) |
394 value->GetAsBoolean(&is_quic_allowed_by_policy_); | 387 value->GetAsBoolean(&is_quic_allowed_by_policy_); |
395 | 388 |
396 // Some unit tests use IOThread but do not initialize MetricsService. In that | 389 // Some unit tests use IOThread but do not initialize MetricsService. In that |
397 // case it is fine not to have |metrics_data_use_forwarder_|. | 390 // case it is fine not to have |metrics_data_use_forwarder_|. |
398 if (g_browser_process->metrics_service()) { | 391 if (g_browser_process->metrics_service()) { |
399 // Callback for updating data use prefs should be obtained on UI thread. | 392 // Callback for updating data use prefs should be obtained on UI thread. |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 // constructed from a NetworkSession::Params, to allow us to move this option | 621 // constructed from a NetworkSession::Params, to allow us to move this option |
629 // to IOThread::Globals & HttpNetworkSession::Params. | 622 // to IOThread::Globals & HttpNetworkSession::Params. |
630 std::string quic_user_agent_id = chrome::GetChannelString(); | 623 std::string quic_user_agent_id = chrome::GetChannelString(); |
631 if (!quic_user_agent_id.empty()) | 624 if (!quic_user_agent_id.empty()) |
632 quic_user_agent_id.push_back(' '); | 625 quic_user_agent_id.push_back(' '); |
633 quic_user_agent_id.append( | 626 quic_user_agent_id.append( |
634 version_info::GetProductNameAndVersionForUserAgent()); | 627 version_info::GetProductNameAndVersionForUserAgent()); |
635 quic_user_agent_id.push_back(' '); | 628 quic_user_agent_id.push_back(' '); |
636 quic_user_agent_id.append(content::BuildOSCpuInfo()); | 629 quic_user_agent_id.append(content::BuildOSCpuInfo()); |
637 network_session_configurator::ParseFieldTrialsAndCommandLine( | 630 network_session_configurator::ParseFieldTrialsAndCommandLine( |
638 is_spdy_allowed_by_policy_, is_quic_allowed_by_policy_, | 631 is_quic_allowed_by_policy_, quic_user_agent_id, ¶ms_); |
639 quic_user_agent_id, ¶ms_); | |
640 | 632 |
641 bool always_enable_tfo_if_supported = | 633 bool always_enable_tfo_if_supported = |
642 command_line.HasSwitch(switches::kEnableTcpFastOpen); | 634 command_line.HasSwitch(switches::kEnableTcpFastOpen); |
643 // Check for OS support of TCP FastOpen, and turn it on for all connections if | 635 // Check for OS support of TCP FastOpen, and turn it on for all connections if |
644 // indicated by user. | 636 // indicated by user. |
645 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported); | 637 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported); |
646 | 638 |
647 TRACE_EVENT_BEGIN0("startup", | 639 TRACE_EVENT_BEGIN0("startup", |
648 "IOThread::Init:ProxyScriptFetcherRequestContext"); | 640 "IOThread::Init:ProxyScriptFetcherRequestContext"); |
649 globals_->proxy_script_fetcher_context.reset( | 641 globals_->proxy_script_fetcher_context.reset( |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 990 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
999 // system URLRequestContext too. There's no reason this should be tied to a | 991 // system URLRequestContext too. There's no reason this should be tied to a |
1000 // profile. | 992 // profile. |
1001 return context; | 993 return context; |
1002 } | 994 } |
1003 | 995 |
1004 const metrics::UpdateUsagePrefCallbackType& | 996 const metrics::UpdateUsagePrefCallbackType& |
1005 IOThread::GetMetricsDataUseForwarder() { | 997 IOThread::GetMetricsDataUseForwarder() { |
1006 return metrics_data_use_forwarder_; | 998 return metrics_data_use_forwarder_; |
1007 } | 999 } |
OLD | NEW |