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

Unified Diff: chrome/browser/profiles/profile_io_data.cc

Issue 10537056: Replaced static URLRequestFtpJob factory with non-static protocol handler for FTP jobs. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed whitespace Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_io_data.cc
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index af845e7971f4fe18e4f23a89f7a234cc232ab9ec..678457d4a0926304959db71049145380f614c20e 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -509,35 +509,66 @@ void ProfileIOData::LazyInitialize() const {
command_line.GetSwitchValueASCII(switches::kHstsHosts);
transport_security_persister_.get()->DeserializeFromCommandLine(serialized);
+ // Take ownership over these parameters.
+ cookie_settings_ = profile_params_->cookie_settings;
+#if defined(ENABLE_NOTIFICATIONS)
+ notification_service_ = profile_params_->notification_service;
+#endif
+ extension_info_map_ = profile_params_->extension_info_map;
+
+ resource_context_->host_resolver_ = io_thread_globals->host_resolver.get();
+ resource_context_->request_context_ = main_request_context_.get();
+
+ if (profile_params_->resource_prefetch_predictor_observer_.get()) {
+ resource_prefetch_predictor_observer_.reset(
+ profile_params_->resource_prefetch_predictor_observer_.release());
+ }
+
+ LazyInitializeInternal(profile_params_.get());
+
+ profile_params_.reset();
+ initialized_ = true;
+}
+
+void ProfileIOData::ApplyProfileParamsToContext(
+ ChromeURLRequestContext* context) const {
+ context->set_is_incognito(is_incognito());
+ context->set_accept_language(profile_params_->accept_language);
+ context->set_accept_charset(profile_params_->accept_charset);
+ context->set_referrer_charset(profile_params_->referrer_charset);
+ context->set_ssl_config_service(profile_params_->ssl_config_service);
+}
+
+void ProfileIOData::SetUpJobFactoryDefaults(
+ net::URLRequestJobFactory* job_factory) const {
// NOTE(willchan): Keep these protocol handlers in sync with
// ProfileIOData::IsHandledProtocol().
- job_factory_.reset(new net::URLRequestJobFactory);
if (profile_params_->protocol_handler_registry) {
- job_factory_->AddInterceptor(
+ job_factory->AddInterceptor(
new ProtocolHandlerRegistryInterceptor(
profile_params_->protocol_handler_registry));
}
- bool set_protocol = job_factory_->SetProtocolHandler(
+ bool set_protocol = job_factory->SetProtocolHandler(
chrome::kExtensionScheme,
CreateExtensionProtocolHandler(is_incognito(),
profile_params_->extension_info_map));
DCHECK(set_protocol);
- set_protocol = job_factory_->SetProtocolHandler(
+ set_protocol = job_factory->SetProtocolHandler(
chrome::kExtensionResourceScheme,
CreateExtensionResourceProtocolHandler());
DCHECK(set_protocol);
- set_protocol = job_factory_->SetProtocolHandler(
+ set_protocol = job_factory->SetProtocolHandler(
chrome::kChromeUIScheme,
ChromeURLDataManagerBackend::CreateProtocolHandler(
chrome_url_data_manager_backend_.get()));
DCHECK(set_protocol);
- set_protocol = job_factory_->SetProtocolHandler(
+ set_protocol = job_factory->SetProtocolHandler(
chrome::kChromeDevToolsScheme,
CreateDevToolsProtocolHandler(chrome_url_data_manager_backend_.get()));
DCHECK(set_protocol);
#if defined(OS_CHROMEOS)
if (!is_incognito()) {
- set_protocol = job_factory_->SetProtocolHandler(
+ set_protocol = job_factory->SetProtocolHandler(
chrome::kDriveScheme, new gdata::GDataProtocolHandler());
DCHECK(set_protocol);
}
@@ -546,38 +577,9 @@ void ProfileIOData::LazyInitialize() const {
// of compatible documents (PDF, etc) to the GView document viewer.
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
if (parsed_command_line.HasSwitch(switches::kEnableGView))
- job_factory_->AddInterceptor(new chromeos::GViewRequestInterceptor);
+ job_factory->AddInterceptor(new chromeos::GViewRequestInterceptor);
#endif // !defined(GOOGLE_CHROME_BUILD)
#endif // defined(OS_CHROMEOS)
-
- // Take ownership over these parameters.
- cookie_settings_ = profile_params_->cookie_settings;
-#if defined(ENABLE_NOTIFICATIONS)
- notification_service_ = profile_params_->notification_service;
-#endif
- extension_info_map_ = profile_params_->extension_info_map;
-
- resource_context_->host_resolver_ = io_thread_globals->host_resolver.get();
- resource_context_->request_context_ = main_request_context_.get();
-
- if (profile_params_->resource_prefetch_predictor_observer_.get()) {
- resource_prefetch_predictor_observer_.reset(
- profile_params_->resource_prefetch_predictor_observer_.release());
- }
-
- LazyInitializeInternal(profile_params_.get());
-
- profile_params_.reset();
- initialized_ = true;
-}
-
-void ProfileIOData::ApplyProfileParamsToContext(
- ChromeURLRequestContext* context) const {
- context->set_is_incognito(is_incognito());
- context->set_accept_language(profile_params_->accept_language);
- context->set_accept_charset(profile_params_->accept_charset);
- context->set_referrer_charset(profile_params_->referrer_charset);
- context->set_ssl_config_service(profile_params_->ssl_config_service);
}
void ProfileIOData::ShutdownOnUIThread() {

Powered by Google App Engine
This is Rietveld 408576698