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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "chrome/browser/profiles/profile_manager.h" | 48 #include "chrome/browser/profiles/profile_manager.h" |
49 #include "chrome/browser/signin/signin_names_io_thread.h" | 49 #include "chrome/browser/signin/signin_names_io_thread.h" |
50 #include "chrome/common/chrome_paths.h" | 50 #include "chrome/common/chrome_paths.h" |
51 #include "chrome/common/chrome_switches.h" | 51 #include "chrome/common/chrome_switches.h" |
52 #include "chrome/common/pref_names.h" | 52 #include "chrome/common/pref_names.h" |
53 #include "chrome/common/url_constants.h" | 53 #include "chrome/common/url_constants.h" |
54 #include "components/content_settings/core/browser/content_settings_provider.h" | 54 #include "components/content_settings/core/browser/content_settings_provider.h" |
55 #include "components/content_settings/core/browser/host_content_settings_map.h" | 55 #include "components/content_settings/core/browser/host_content_settings_map.h" |
56 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_service.h" | 56 #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
igurator.h" | 57 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" |
| 58 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" |
58 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 59 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
59 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 60 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
60 #include "components/dom_distiller/core/url_constants.h" | 61 #include "components/dom_distiller/core/url_constants.h" |
61 #include "components/startup_metric_utils/startup_metric_utils.h" | 62 #include "components/startup_metric_utils/startup_metric_utils.h" |
62 #include "components/sync_driver/pref_names.h" | 63 #include "components/sync_driver/pref_names.h" |
63 #include "components/url_fixer/url_fixer.h" | 64 #include "components/url_fixer/url_fixer.h" |
64 #include "content/public/browser/browser_thread.h" | 65 #include "content/public/browser/browser_thread.h" |
65 #include "content/public/browser/host_zoom_map.h" | 66 #include "content/public/browser/host_zoom_map.h" |
66 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
67 #include "content/public/browser/resource_context.h" | 68 #include "content/public/browser/resource_context.h" |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 CHECK(profile_params_.get()); | 1003 CHECK(profile_params_.get()); |
1003 | 1004 |
1004 IOThread* const io_thread = profile_params_->io_thread; | 1005 IOThread* const io_thread = profile_params_->io_thread; |
1005 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 1006 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
1006 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1007 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
1007 | 1008 |
1008 // Create the common request contexts. | 1009 // Create the common request contexts. |
1009 main_request_context_.reset(new net::URLRequestContext()); | 1010 main_request_context_.reset(new net::URLRequestContext()); |
1010 extensions_request_context_.reset(new net::URLRequestContext()); | 1011 extensions_request_context_.reset(new net::URLRequestContext()); |
1011 | 1012 |
1012 ChromeNetworkDelegate* network_delegate = | 1013 scoped_ptr<ChromeNetworkDelegate> network_delegate( |
1013 new ChromeNetworkDelegate( | 1014 new ChromeNetworkDelegate( |
1014 #if defined(ENABLE_EXTENSIONS) | 1015 #if defined(ENABLE_EXTENSIONS) |
1015 io_thread_globals->extension_event_router_forwarder.get(), | 1016 io_thread_globals->extension_event_router_forwarder.get(), |
1016 #else | 1017 #else |
1017 NULL, | 1018 NULL, |
1018 #endif | 1019 #endif |
1019 &enable_referrers_); | 1020 &enable_referrers_)); |
1020 if (command_line.HasSwitch(switches::kEnableClientHints)) | 1021 if (command_line.HasSwitch(switches::kEnableClientHints)) |
1021 network_delegate->SetEnableClientHints(); | 1022 network_delegate->SetEnableClientHints(); |
1022 #if defined(ENABLE_EXTENSIONS) | 1023 #if defined(ENABLE_EXTENSIONS) |
1023 network_delegate->set_extension_info_map( | 1024 network_delegate->set_extension_info_map( |
1024 profile_params_->extension_info_map.get()); | 1025 profile_params_->extension_info_map.get()); |
1025 #endif | 1026 #endif |
1026 #if defined(ENABLE_CONFIGURATION_POLICY) | 1027 #if defined(ENABLE_CONFIGURATION_POLICY) |
1027 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); | 1028 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); |
1028 #endif | 1029 #endif |
1029 network_delegate->set_profile(profile_params_->profile); | 1030 network_delegate->set_profile(profile_params_->profile); |
1030 network_delegate->set_profile_path(profile_params_->path); | 1031 network_delegate->set_profile_path(profile_params_->path); |
1031 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); | 1032 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); |
1032 network_delegate->set_enable_do_not_track(&enable_do_not_track_); | 1033 network_delegate->set_enable_do_not_track(&enable_do_not_track_); |
1033 network_delegate->set_force_safe_search(&force_safesearch_); | 1034 network_delegate->set_force_safe_search(&force_safesearch_); |
1034 network_delegate->set_force_google_safe_search(&force_google_safesearch_); | 1035 network_delegate->set_force_google_safe_search(&force_google_safesearch_); |
1035 network_delegate->set_force_youtube_safety_mode(&force_youtube_safety_mode_); | 1036 network_delegate->set_force_youtube_safety_mode(&force_youtube_safety_mode_); |
1036 network_delegate->set_prerender_tracker(profile_params_->prerender_tracker); | 1037 network_delegate->set_prerender_tracker(profile_params_->prerender_tracker); |
1037 network_delegate_.reset(network_delegate); | |
1038 | |
1039 fraudulent_certificate_reporter_.reset( | 1038 fraudulent_certificate_reporter_.reset( |
1040 new chrome_browser_net::ChromeFraudulentCertificateReporter( | 1039 new chrome_browser_net::ChromeFraudulentCertificateReporter( |
1041 main_request_context_.get())); | 1040 main_request_context_.get())); |
1042 | 1041 |
1043 // NOTE: Proxy service uses the default io thread network delegate, not the | 1042 // NOTE: Proxy service uses the default io thread network delegate, not the |
1044 // delegate just created. | 1043 // delegate just created. |
1045 proxy_service_.reset( | 1044 proxy_service_.reset( |
1046 ProxyServiceFactory::CreateProxyService( | 1045 ProxyServiceFactory::CreateProxyService( |
1047 io_thread->net_log(), | 1046 io_thread->net_log(), |
1048 io_thread_globals->proxy_script_fetcher_context.get(), | 1047 io_thread_globals->proxy_script_fetcher_context.get(), |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 } else { | 1094 } else { |
1096 cert_verifier_.reset(new net::MultiThreadedCertVerifier(verify_proc.get())); | 1095 cert_verifier_.reset(new net::MultiThreadedCertVerifier(verify_proc.get())); |
1097 } | 1096 } |
1098 main_request_context_->set_cert_verifier(cert_verifier_.get()); | 1097 main_request_context_->set_cert_verifier(cert_verifier_.get()); |
1099 #else | 1098 #else |
1100 main_request_context_->set_cert_verifier( | 1099 main_request_context_->set_cert_verifier( |
1101 io_thread_globals->cert_verifier.get()); | 1100 io_thread_globals->cert_verifier.get()); |
1102 #endif | 1101 #endif |
1103 | 1102 |
1104 InitializeInternal( | 1103 InitializeInternal( |
1105 profile_params_.get(), protocol_handlers, request_interceptors.Pass()); | 1104 network_delegate.Pass(), profile_params_.get(), |
| 1105 protocol_handlers, request_interceptors.Pass()); |
1106 | 1106 |
1107 profile_params_.reset(); | 1107 profile_params_.reset(); |
1108 initialized_ = true; | 1108 initialized_ = true; |
1109 } | 1109 } |
1110 | 1110 |
1111 void ProfileIOData::ApplyProfileParamsToContext( | 1111 void ProfileIOData::ApplyProfileParamsToContext( |
1112 net::URLRequestContext* context) const { | 1112 net::URLRequestContext* context) const { |
1113 context->set_http_user_agent_settings( | 1113 context->set_http_user_agent_settings( |
1114 chrome_http_user_agent_settings_.get()); | 1114 chrome_http_user_agent_settings_.get()); |
1115 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); | 1115 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 void ProfileIOData::SetCookieSettingsForTesting( | 1303 void ProfileIOData::SetCookieSettingsForTesting( |
1304 CookieSettings* cookie_settings) { | 1304 CookieSettings* cookie_settings) { |
1305 DCHECK(!cookie_settings_.get()); | 1305 DCHECK(!cookie_settings_.get()); |
1306 cookie_settings_ = cookie_settings; | 1306 cookie_settings_ = cookie_settings; |
1307 } | 1307 } |
1308 | 1308 |
1309 void ProfileIOData::set_signin_names_for_testing( | 1309 void ProfileIOData::set_signin_names_for_testing( |
1310 SigninNamesOnIOThread* signin_names) { | 1310 SigninNamesOnIOThread* signin_names) { |
1311 signin_names_.reset(signin_names); | 1311 signin_names_.reset(signin_names); |
1312 } | 1312 } |
OLD | NEW |