| Index: chrome/browser/profiles/profile_impl_io_data.cc
|
| diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
|
| index 952aeaa3bdea202faec50bbb103ce32c02765ed6..879b45b2b819d3902edcf80f30e88afcdfcec3d8 100644
|
| --- a/chrome/browser/profiles/profile_impl_io_data.cc
|
| +++ b/chrome/browser/profiles/profile_impl_io_data.cc
|
| @@ -76,8 +76,6 @@ void ProfileImplIOData::Handle::Init(
|
| const FilePath& profile_path,
|
| const FilePath& infinite_cache_path,
|
| chrome_browser_net::Predictor* predictor,
|
| - PrefService* local_state,
|
| - IOThread* io_thread,
|
| bool restore_old_session_cookies,
|
| quota::SpecialStoragePolicy* special_storage_policy) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| @@ -107,16 +105,6 @@ void ProfileImplIOData::Handle::Init(
|
|
|
| io_data_->predictor_.reset(predictor);
|
|
|
| - if (!main_request_context_getter_) {
|
| - main_request_context_getter_ =
|
| - ChromeURLRequestContextGetter::CreateOriginal(
|
| - profile_, io_data_);
|
| - }
|
| - io_data_->predictor_->InitNetworkPredictor(profile_->GetPrefs(),
|
| - local_state,
|
| - io_thread,
|
| - main_request_context_getter_);
|
| -
|
| io_data_->InitializeMetricsEnabledStateOnUIThread();
|
| }
|
|
|
| @@ -145,19 +133,31 @@ ProfileImplIOData::Handle::GetResourceContextNoInit() const {
|
| }
|
|
|
| scoped_refptr<ChromeURLRequestContextGetter>
|
| -ProfileImplIOData::Handle::GetMainRequestContextGetter() const {
|
| +ProfileImplIOData::Handle::CreateMainRequestContextGetter(
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + blob_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + file_system_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::Interceptor>
|
| + developer_protocol_handler,
|
| + PrefService* local_state,
|
| + IOThread* io_thread) const {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| LazyInitialize();
|
| - if (!main_request_context_getter_) {
|
| - main_request_context_getter_ =
|
| - ChromeURLRequestContextGetter::CreateOriginal(
|
| - profile_, io_data_);
|
| + DCHECK(!main_request_context_getter_);
|
| + main_request_context_getter_ = ChromeURLRequestContextGetter::CreateOriginal(
|
| + profile_, io_data_, blob_protocol_handler.Pass(),
|
| + file_system_protocol_handler.Pass(), developer_protocol_handler.Pass());
|
|
|
| - content::NotificationService::current()->Notify(
|
| - chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED,
|
| - content::Source<Profile>(profile_),
|
| - content::NotificationService::NoDetails());
|
| - }
|
| + io_data_->predictor_->InitNetworkPredictor(profile_->GetPrefs(),
|
| + local_state,
|
| + io_thread,
|
| + main_request_context_getter_);
|
| +
|
| + content::NotificationService::current()->Notify(
|
| + chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED,
|
| + content::Source<Profile>(profile_),
|
| + content::NotificationService::NoDetails());
|
| return main_request_context_getter_;
|
| }
|
|
|
| @@ -186,9 +186,15 @@ ProfileImplIOData::Handle::GetExtensionsRequestContextGetter() const {
|
| }
|
|
|
| scoped_refptr<ChromeURLRequestContextGetter>
|
| -ProfileImplIOData::Handle::GetIsolatedAppRequestContextGetter(
|
| +ProfileImplIOData::Handle::CreateIsolatedAppRequestContextGetter(
|
| const FilePath& partition_path,
|
| - bool in_memory) const {
|
| + bool in_memory,
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + blob_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + file_system_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::Interceptor>
|
| + developer_protocol_handler) const {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| // Check that the partition_path is not the same as the base profile path. We
|
| // expect isolated partition, which will never go to the default profile path.
|
| @@ -209,7 +215,9 @@ ProfileImplIOData::Handle::GetIsolatedAppRequestContextGetter(
|
| ChromeURLRequestContextGetter* context =
|
| ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
|
| profile_, io_data_, descriptor,
|
| - protocol_handler_interceptor.Pass());
|
| + protocol_handler_interceptor.Pass(), blob_protocol_handler.Pass(),
|
| + file_system_protocol_handler.Pass(),
|
| + developer_protocol_handler.Pass());
|
| app_request_context_getter_map_[descriptor] = context;
|
|
|
| return context;
|
| @@ -234,8 +242,10 @@ ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter(
|
|
|
| // Get the app context as the starting point for the media context, so that
|
| // it uses the app's cookie store.
|
| - ChromeURLRequestContextGetter* app_context =
|
| - GetIsolatedAppRequestContextGetter(partition_path, in_memory);
|
| + ChromeURLRequestContextGetterMap::const_iterator app_iter =
|
| + app_request_context_getter_map_.find(descriptor);
|
| + DCHECK(app_iter != app_request_context_getter_map_.end());
|
| + ChromeURLRequestContextGetter* app_context = app_iter->second;
|
| ChromeURLRequestContextGetter* context =
|
| ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia(
|
| profile_, app_context, io_data_, descriptor);
|
| @@ -301,8 +311,14 @@ ProfileImplIOData::~ProfileImplIOData() {
|
| media_request_context_->AssertNoURLRequests();
|
| }
|
|
|
| -void ProfileImplIOData::LazyInitializeInternal(
|
| - ProfileParams* profile_params) const {
|
| +void ProfileImplIOData::InitializeInternal(
|
| + ProfileParams* profile_params,
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + blob_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + file_system_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::Interceptor>
|
| + developer_protocol_handler) const {
|
| ChromeURLRequestContext* main_context = main_request_context();
|
|
|
| IOThread* const io_thread = profile_params->io_thread;
|
| @@ -420,6 +436,11 @@ void ProfileImplIOData::LazyInitializeInternal(
|
|
|
| scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
|
| new net::URLRequestJobFactoryImpl());
|
| + main_job_factory->SetProtocolHandler(
|
| + chrome::kBlobScheme, blob_protocol_handler.release());
|
| + main_job_factory->SetProtocolHandler(
|
| + chrome::kFileSystemScheme, file_system_protocol_handler.release());
|
| + main_job_factory->AddInterceptor(developer_protocol_handler.release());
|
| main_job_factory_ = SetUpJobFactoryDefaults(
|
| main_job_factory.Pass(),
|
| profile_params->protocol_handler_interceptor.Pass(),
|
| @@ -493,7 +514,13 @@ ProfileImplIOData::InitializeAppRequestContext(
|
| ChromeURLRequestContext* main_context,
|
| const StoragePartitionDescriptor& partition_descriptor,
|
| scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
|
| - protocol_handler_interceptor) const {
|
| + protocol_handler_interceptor,
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + blob_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + file_system_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::Interceptor>
|
| + developer_protocol_handler) const {
|
| // Copy most state from the main context.
|
| AppRequestContext* context = new AppRequestContext(load_time_stats());
|
| context->CopyFrom(main_context);
|
| @@ -558,6 +585,11 @@ ProfileImplIOData::InitializeAppRequestContext(
|
|
|
| scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
|
| new net::URLRequestJobFactoryImpl());
|
| + job_factory->SetProtocolHandler(chrome::kBlobScheme,
|
| + blob_protocol_handler.release());
|
| + job_factory->SetProtocolHandler(chrome::kFileSystemScheme,
|
| + file_system_protocol_handler.release());
|
| + job_factory->AddInterceptor(developer_protocol_handler.release());
|
| scoped_ptr<net::URLRequestJobFactory> top_job_factory;
|
| // Overwrite the job factory that we inherit from the main context so
|
| // that we can later provide our own handlers for storage related protocols.
|
| @@ -636,11 +668,20 @@ ProfileImplIOData::AcquireIsolatedAppRequestContext(
|
| ChromeURLRequestContext* main_context,
|
| const StoragePartitionDescriptor& partition_descriptor,
|
| scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
|
| - protocol_handler_interceptor) const {
|
| + protocol_handler_interceptor,
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + blob_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
| + file_system_protocol_handler,
|
| + scoped_ptr<net::URLRequestJobFactory::Interceptor>
|
| + developer_protocol_handler) const {
|
| // We create per-app contexts on demand, unlike the others above.
|
| ChromeURLRequestContext* app_request_context =
|
| InitializeAppRequestContext(main_context, partition_descriptor,
|
| - protocol_handler_interceptor.Pass());
|
| + protocol_handler_interceptor.Pass(),
|
| + blob_protocol_handler.Pass(),
|
| + file_system_protocol_handler.Pass(),
|
| + developer_protocol_handler.Pass());
|
| DCHECK(app_request_context);
|
| return app_request_context;
|
| }
|
| @@ -665,7 +706,7 @@ void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
|
| base::Time time,
|
| const base::Closure& completion) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - LazyInitialize();
|
| + DCHECK(initialized());
|
|
|
| DCHECK(transport_security_state());
|
| transport_security_state()->DeleteSince(time); // Completes synchronously.
|
|
|