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/profiles/profile_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "chrome/browser/profiles/profile_manager.h" | 49 #include "chrome/browser/profiles/profile_manager.h" |
50 #include "chrome/browser/signin/signin_names_io_thread.h" | 50 #include "chrome/browser/signin/signin_names_io_thread.h" |
51 #include "chrome/common/chrome_paths.h" | 51 #include "chrome/common/chrome_paths.h" |
52 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
53 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
54 #include "chrome/common/url_constants.h" | 54 #include "chrome/common/url_constants.h" |
55 #include "components/content_settings/core/browser/content_settings_provider.h" | 55 #include "components/content_settings/core/browser/content_settings_provider.h" |
56 #include "components/content_settings/core/browser/host_content_settings_map.h" | 56 #include "components/content_settings/core/browser/host_content_settings_map.h" |
57 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_service.h" | 57 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_service.h" |
58 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" | 58 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" |
| 59 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" |
59 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 60 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
60 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 61 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
61 #include "components/dom_distiller/core/url_constants.h" | 62 #include "components/dom_distiller/core/url_constants.h" |
62 #include "components/startup_metric_utils/startup_metric_utils.h" | 63 #include "components/startup_metric_utils/startup_metric_utils.h" |
63 #include "components/sync_driver/pref_names.h" | 64 #include "components/sync_driver/pref_names.h" |
64 #include "components/url_fixer/url_fixer.h" | 65 #include "components/url_fixer/url_fixer.h" |
65 #include "content/public/browser/browser_thread.h" | 66 #include "content/public/browser/browser_thread.h" |
66 #include "content/public/browser/host_zoom_map.h" | 67 #include "content/public/browser/host_zoom_map.h" |
67 #include "content/public/browser/notification_service.h" | 68 #include "content/public/browser/notification_service.h" |
68 #include "content/public/browser/resource_context.h" | 69 #include "content/public/browser/resource_context.h" |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 CHECK(profile_params_.get()); | 1015 CHECK(profile_params_.get()); |
1015 | 1016 |
1016 IOThread* const io_thread = profile_params_->io_thread; | 1017 IOThread* const io_thread = profile_params_->io_thread; |
1017 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 1018 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
1018 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1019 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
1019 | 1020 |
1020 // Create the common request contexts. | 1021 // Create the common request contexts. |
1021 main_request_context_.reset(new net::URLRequestContext()); | 1022 main_request_context_.reset(new net::URLRequestContext()); |
1022 extensions_request_context_.reset(new net::URLRequestContext()); | 1023 extensions_request_context_.reset(new net::URLRequestContext()); |
1023 | 1024 |
1024 ChromeNetworkDelegate* network_delegate = | 1025 scoped_ptr<ChromeNetworkDelegate> network_delegate( |
1025 new ChromeNetworkDelegate( | 1026 new ChromeNetworkDelegate( |
1026 #if defined(ENABLE_EXTENSIONS) | 1027 #if defined(ENABLE_EXTENSIONS) |
1027 io_thread_globals->extension_event_router_forwarder.get(), | 1028 io_thread_globals->extension_event_router_forwarder.get(), |
1028 #else | 1029 #else |
1029 NULL, | 1030 NULL, |
1030 #endif | 1031 #endif |
1031 &enable_referrers_); | 1032 &enable_referrers_)); |
1032 if (command_line.HasSwitch(switches::kEnableClientHints)) | 1033 if (command_line.HasSwitch(switches::kEnableClientHints)) |
1033 network_delegate->SetEnableClientHints(); | 1034 network_delegate->SetEnableClientHints(); |
1034 #if defined(ENABLE_EXTENSIONS) | 1035 #if defined(ENABLE_EXTENSIONS) |
1035 network_delegate->set_extension_info_map( | 1036 network_delegate->set_extension_info_map( |
1036 profile_params_->extension_info_map.get()); | 1037 profile_params_->extension_info_map.get()); |
1037 #endif | 1038 #endif |
1038 #if defined(ENABLE_CONFIGURATION_POLICY) | 1039 #if defined(ENABLE_CONFIGURATION_POLICY) |
1039 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); | 1040 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); |
1040 #endif | 1041 #endif |
1041 network_delegate->set_profile(profile_params_->profile); | 1042 network_delegate->set_profile(profile_params_->profile); |
1042 network_delegate->set_profile_path(profile_params_->path); | 1043 network_delegate->set_profile_path(profile_params_->path); |
1043 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); | 1044 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); |
1044 network_delegate->set_enable_do_not_track(&enable_do_not_track_); | 1045 network_delegate->set_enable_do_not_track(&enable_do_not_track_); |
1045 network_delegate->set_force_safe_search(&force_safesearch_); | 1046 network_delegate->set_force_safe_search(&force_safesearch_); |
1046 network_delegate->set_force_google_safe_search(&force_google_safesearch_); | 1047 network_delegate->set_force_google_safe_search(&force_google_safesearch_); |
1047 network_delegate->set_force_youtube_safety_mode(&force_youtube_safety_mode_); | 1048 network_delegate->set_force_youtube_safety_mode(&force_youtube_safety_mode_); |
1048 network_delegate->set_prerender_tracker(profile_params_->prerender_tracker); | 1049 network_delegate->set_prerender_tracker(profile_params_->prerender_tracker); |
1049 network_delegate_.reset(network_delegate); | |
1050 | |
1051 fraudulent_certificate_reporter_.reset( | 1050 fraudulent_certificate_reporter_.reset( |
1052 new chrome_browser_net::ChromeFraudulentCertificateReporter( | 1051 new chrome_browser_net::ChromeFraudulentCertificateReporter( |
1053 main_request_context_.get())); | 1052 main_request_context_.get())); |
1054 | 1053 |
1055 // NOTE: Proxy service uses the default io thread network delegate, not the | 1054 // NOTE: Proxy service uses the default io thread network delegate, not the |
1056 // delegate just created. | 1055 // delegate just created. |
1057 proxy_service_.reset( | 1056 proxy_service_.reset( |
1058 ProxyServiceFactory::CreateProxyService( | 1057 ProxyServiceFactory::CreateProxyService( |
1059 io_thread->net_log(), | 1058 io_thread->net_log(), |
1060 io_thread_globals->proxy_script_fetcher_context.get(), | 1059 io_thread_globals->proxy_script_fetcher_context.get(), |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 } else { | 1106 } else { |
1108 cert_verifier_.reset(new net::MultiThreadedCertVerifier(verify_proc.get())); | 1107 cert_verifier_.reset(new net::MultiThreadedCertVerifier(verify_proc.get())); |
1109 } | 1108 } |
1110 main_request_context_->set_cert_verifier(cert_verifier_.get()); | 1109 main_request_context_->set_cert_verifier(cert_verifier_.get()); |
1111 #else | 1110 #else |
1112 main_request_context_->set_cert_verifier( | 1111 main_request_context_->set_cert_verifier( |
1113 io_thread_globals->cert_verifier.get()); | 1112 io_thread_globals->cert_verifier.get()); |
1114 #endif | 1113 #endif |
1115 | 1114 |
1116 InitializeInternal( | 1115 InitializeInternal( |
1117 profile_params_.get(), protocol_handlers, request_interceptors.Pass()); | 1116 network_delegate.Pass(), profile_params_.get(), |
| 1117 protocol_handlers, request_interceptors.Pass()); |
1118 | 1118 |
1119 profile_params_.reset(); | 1119 profile_params_.reset(); |
1120 initialized_ = true; | 1120 initialized_ = true; |
1121 } | 1121 } |
1122 | 1122 |
1123 void ProfileIOData::ApplyProfileParamsToContext( | 1123 void ProfileIOData::ApplyProfileParamsToContext( |
1124 net::URLRequestContext* context) const { | 1124 net::URLRequestContext* context) const { |
1125 context->set_http_user_agent_settings( | 1125 context->set_http_user_agent_settings( |
1126 chrome_http_user_agent_settings_.get()); | 1126 chrome_http_user_agent_settings_.get()); |
1127 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); | 1127 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 | 1284 |
1285 params.host_resolver = context->host_resolver(); | 1285 params.host_resolver = context->host_resolver(); |
1286 params.cert_verifier = context->cert_verifier(); | 1286 params.cert_verifier = context->cert_verifier(); |
1287 params.channel_id_service = context->channel_id_service(); | 1287 params.channel_id_service = context->channel_id_service(); |
1288 params.transport_security_state = context->transport_security_state(); | 1288 params.transport_security_state = context->transport_security_state(); |
1289 params.cert_transparency_verifier = context->cert_transparency_verifier(); | 1289 params.cert_transparency_verifier = context->cert_transparency_verifier(); |
1290 params.proxy_service = context->proxy_service(); | 1290 params.proxy_service = context->proxy_service(); |
1291 params.ssl_session_cache_shard = GetSSLSessionCacheShard(); | 1291 params.ssl_session_cache_shard = GetSSLSessionCacheShard(); |
1292 params.ssl_config_service = context->ssl_config_service(); | 1292 params.ssl_config_service = context->ssl_config_service(); |
1293 params.http_auth_handler_factory = context->http_auth_handler_factory(); | 1293 params.http_auth_handler_factory = context->http_auth_handler_factory(); |
1294 params.network_delegate = network_delegate(); | 1294 params.network_delegate = context->network_delegate(); |
1295 params.http_server_properties = context->http_server_properties(); | 1295 params.http_server_properties = context->http_server_properties(); |
1296 params.net_log = context->net_log(); | 1296 params.net_log = context->net_log(); |
1297 | 1297 |
1298 network_controller_.reset(new DevToolsNetworkController()); | 1298 network_controller_.reset(new DevToolsNetworkController()); |
1299 | 1299 |
1300 net::HttpNetworkSession* session = new net::HttpNetworkSession(params); | 1300 net::HttpNetworkSession* session = new net::HttpNetworkSession(params); |
1301 return scoped_ptr<net::HttpCache>(new net::HttpCache( | 1301 return scoped_ptr<net::HttpCache>(new net::HttpCache( |
1302 new DevToolsNetworkTransactionFactory(network_controller_.get(), session), | 1302 new DevToolsNetworkTransactionFactory(network_controller_.get(), session), |
1303 context->net_log(), main_backend)); | 1303 context->net_log(), main_backend)); |
1304 } | 1304 } |
(...skipping 10 matching lines...) Expand all Loading... |
1315 void ProfileIOData::SetCookieSettingsForTesting( | 1315 void ProfileIOData::SetCookieSettingsForTesting( |
1316 CookieSettings* cookie_settings) { | 1316 CookieSettings* cookie_settings) { |
1317 DCHECK(!cookie_settings_.get()); | 1317 DCHECK(!cookie_settings_.get()); |
1318 cookie_settings_ = cookie_settings; | 1318 cookie_settings_ = cookie_settings; |
1319 } | 1319 } |
1320 | 1320 |
1321 void ProfileIOData::set_signin_names_for_testing( | 1321 void ProfileIOData::set_signin_names_for_testing( |
1322 SigninNamesOnIOThread* signin_names) { | 1322 SigninNamesOnIOThread* signin_names) { |
1323 signin_names_.reset(signin_names); | 1323 signin_names_.reset(signin_names); |
1324 } | 1324 } |
OLD | NEW |