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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 11308362: Add StoragePartition's ProtocolHandlers at URLRequestContext construction time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid DCHECK in GetExtensionInfoMap() during Init() Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const FilePath& cookie_path, 69 const FilePath& cookie_path,
70 const FilePath& server_bound_cert_path, 70 const FilePath& server_bound_cert_path,
71 const FilePath& cache_path, 71 const FilePath& cache_path,
72 int cache_max_size, 72 int cache_max_size,
73 const FilePath& media_cache_path, 73 const FilePath& media_cache_path,
74 int media_cache_max_size, 74 int media_cache_max_size,
75 const FilePath& extensions_cookie_path, 75 const FilePath& extensions_cookie_path,
76 const FilePath& profile_path, 76 const FilePath& profile_path,
77 const FilePath& infinite_cache_path, 77 const FilePath& infinite_cache_path,
78 chrome_browser_net::Predictor* predictor, 78 chrome_browser_net::Predictor* predictor,
79 PrefService* local_state,
80 IOThread* io_thread,
81 bool restore_old_session_cookies, 79 bool restore_old_session_cookies,
82 quota::SpecialStoragePolicy* special_storage_policy) { 80 quota::SpecialStoragePolicy* special_storage_policy) {
83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
84 DCHECK(!io_data_->lazy_params_.get()); 82 DCHECK(!io_data_->lazy_params_.get());
85 DCHECK(predictor); 83 DCHECK(predictor);
86 84
87 LazyParams* lazy_params = new LazyParams; 85 LazyParams* lazy_params = new LazyParams;
88 86
89 lazy_params->cookie_path = cookie_path; 87 lazy_params->cookie_path = cookie_path;
90 lazy_params->server_bound_cert_path = server_bound_cert_path; 88 lazy_params->server_bound_cert_path = server_bound_cert_path;
91 lazy_params->cache_path = cache_path; 89 lazy_params->cache_path = cache_path;
92 lazy_params->cache_max_size = cache_max_size; 90 lazy_params->cache_max_size = cache_max_size;
93 lazy_params->media_cache_path = media_cache_path; 91 lazy_params->media_cache_path = media_cache_path;
94 lazy_params->media_cache_max_size = media_cache_max_size; 92 lazy_params->media_cache_max_size = media_cache_max_size;
95 lazy_params->extensions_cookie_path = extensions_cookie_path; 93 lazy_params->extensions_cookie_path = extensions_cookie_path;
96 lazy_params->infinite_cache_path = infinite_cache_path; 94 lazy_params->infinite_cache_path = infinite_cache_path;
97 lazy_params->restore_old_session_cookies = restore_old_session_cookies; 95 lazy_params->restore_old_session_cookies = restore_old_session_cookies;
98 lazy_params->special_storage_policy = special_storage_policy; 96 lazy_params->special_storage_policy = special_storage_policy;
99 97
100 io_data_->lazy_params_.reset(lazy_params); 98 io_data_->lazy_params_.reset(lazy_params);
101 99
102 // Keep track of profile path and cache sizes separately so we can use them 100 // Keep track of profile path and cache sizes separately so we can use them
103 // on demand when creating storage isolated URLRequestContextGetters. 101 // on demand when creating storage isolated URLRequestContextGetters.
104 io_data_->profile_path_ = profile_path; 102 io_data_->profile_path_ = profile_path;
105 io_data_->app_cache_max_size_ = cache_max_size; 103 io_data_->app_cache_max_size_ = cache_max_size;
106 io_data_->app_media_cache_max_size_ = media_cache_max_size; 104 io_data_->app_media_cache_max_size_ = media_cache_max_size;
107 105
108 io_data_->predictor_.reset(predictor); 106 io_data_->predictor_.reset(predictor);
109 107
110 if (!main_request_context_getter_) {
111 main_request_context_getter_ =
112 ChromeURLRequestContextGetter::CreateOriginal(
113 profile_, io_data_);
114 }
115 io_data_->predictor_->InitNetworkPredictor(profile_->GetPrefs(),
116 local_state,
117 io_thread,
118 main_request_context_getter_);
119
120 io_data_->InitializeMetricsEnabledStateOnUIThread(); 108 io_data_->InitializeMetricsEnabledStateOnUIThread();
121 } 109 }
122 110
123 base::Callback<ChromeURLDataManagerBackend*(void)> 111 base::Callback<ChromeURLDataManagerBackend*(void)>
124 ProfileImplIOData::Handle::GetChromeURLDataManagerBackendGetter() const { 112 ProfileImplIOData::Handle::GetChromeURLDataManagerBackendGetter() const {
125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
126 LazyInitialize(); 114 LazyInitialize();
127 return base::Bind(&ProfileIOData::GetChromeURLDataManagerBackend, 115 return base::Bind(&ProfileIOData::GetChromeURLDataManagerBackend,
128 base::Unretained(io_data_)); 116 base::Unretained(io_data_));
129 } 117 }
(...skipping 11 matching lines...) Expand all
141 // Don't call LazyInitialize here, since the resource context is created at 129 // Don't call LazyInitialize here, since the resource context is created at
142 // the beginning of initalization and is used by some members while they're 130 // the beginning of initalization and is used by some members while they're
143 // being initialized (i.e. AppCacheService). 131 // being initialized (i.e. AppCacheService).
144 return io_data_->GetResourceContext(); 132 return io_data_->GetResourceContext();
145 } 133 }
146 134
147 scoped_refptr<ChromeURLRequestContextGetter> 135 scoped_refptr<ChromeURLRequestContextGetter>
148 ProfileImplIOData::Handle::GetMainRequestContextGetter() const { 136 ProfileImplIOData::Handle::GetMainRequestContextGetter() const {
149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
150 LazyInitialize(); 138 LazyInitialize();
151 if (!main_request_context_getter_) { 139 DCHECK(main_request_context_getter_);
152 main_request_context_getter_ =
153 ChromeURLRequestContextGetter::CreateOriginal(
154 profile_, io_data_);
155
156 content::NotificationService::current()->Notify(
157 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED,
158 content::Source<Profile>(profile_),
159 content::NotificationService::NoDetails());
160 }
161 return main_request_context_getter_; 140 return main_request_context_getter_;
162 } 141 }
163 142
143 scoped_refptr<ChromeURLRequestContextGetter>
144 ProfileImplIOData::Handle::CreateMainRequestContextGetter(
145 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
146 blob_protocol_handler,
147 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
148 file_system_protocol_handler,
149 scoped_ptr<net::URLRequestJobFactory::Interceptor>
150 developer_protocol_handler,
151 PrefService* local_state,
152 IOThread* io_thread) const {
153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
154 LazyInitialize();
155 DCHECK(!main_request_context_getter_);
156 main_request_context_getter_ = ChromeURLRequestContextGetter::CreateOriginal(
157 profile_, io_data_, blob_protocol_handler.Pass(),
158 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass());
159
160 io_data_->predictor_->InitNetworkPredictor(profile_->GetPrefs(),
161 local_state,
162 io_thread,
163 main_request_context_getter_);
164
165 content::NotificationService::current()->Notify(
166 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED,
167 content::Source<Profile>(profile_),
168 content::NotificationService::NoDetails());
169 return main_request_context_getter_;
170 }
171
164 scoped_refptr<ChromeURLRequestContextGetter> 172 scoped_refptr<ChromeURLRequestContextGetter>
165 ProfileImplIOData::Handle::GetMediaRequestContextGetter() const { 173 ProfileImplIOData::Handle::GetMediaRequestContextGetter() const {
166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
167 LazyInitialize(); 175 LazyInitialize();
168 if (!media_request_context_getter_) { 176 if (!media_request_context_getter_) {
169 media_request_context_getter_ = 177 media_request_context_getter_ =
170 ChromeURLRequestContextGetter::CreateOriginalForMedia( 178 ChromeURLRequestContextGetter::CreateOriginalForMedia(
171 profile_, io_data_); 179 profile_, io_data_);
172 } 180 }
173 return media_request_context_getter_; 181 return media_request_context_getter_;
174 } 182 }
175 183
176 scoped_refptr<ChromeURLRequestContextGetter> 184 scoped_refptr<ChromeURLRequestContextGetter>
177 ProfileImplIOData::Handle::GetExtensionsRequestContextGetter() const { 185 ProfileImplIOData::Handle::GetExtensionsRequestContextGetter() const {
178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
179 LazyInitialize(); 187 LazyInitialize();
180 if (!extensions_request_context_getter_) { 188 if (!extensions_request_context_getter_) {
181 extensions_request_context_getter_ = 189 extensions_request_context_getter_ =
182 ChromeURLRequestContextGetter::CreateOriginalForExtensions( 190 ChromeURLRequestContextGetter::CreateOriginalForExtensions(
183 profile_, io_data_); 191 profile_, io_data_);
184 } 192 }
185 return extensions_request_context_getter_; 193 return extensions_request_context_getter_;
186 } 194 }
187 195
188 scoped_refptr<ChromeURLRequestContextGetter> 196 scoped_refptr<ChromeURLRequestContextGetter>
189 ProfileImplIOData::Handle::GetIsolatedAppRequestContextGetter( 197 ProfileImplIOData::Handle::CreateIsolatedAppRequestContextGetter(
190 const FilePath& partition_path, 198 const FilePath& partition_path,
191 bool in_memory) const { 199 bool in_memory,
200 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
201 blob_protocol_handler,
202 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
203 file_system_protocol_handler,
204 scoped_ptr<net::URLRequestJobFactory::Interceptor>
205 developer_protocol_handler) const {
192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
193 // Check that the partition_path is not the same as the base profile path. We 207 // Check that the partition_path is not the same as the base profile path. We
194 // expect isolated partition, which will never go to the default profile path. 208 // expect isolated partition, which will never go to the default profile path.
195 CHECK(partition_path != profile_->GetPath()); 209 CHECK(partition_path != profile_->GetPath());
196 LazyInitialize(); 210 LazyInitialize();
197 211
198 // Keep a map of request context getters, one per requested storage partition. 212 // Keep a map of request context getters, one per requested storage partition.
199 StoragePartitionDescriptor descriptor(partition_path, in_memory); 213 StoragePartitionDescriptor descriptor(partition_path, in_memory);
200 ChromeURLRequestContextGetterMap::iterator iter = 214 ChromeURLRequestContextGetterMap::iterator iter =
201 app_request_context_getter_map_.find(descriptor); 215 app_request_context_getter_map_.find(descriptor);
202 if (iter != app_request_context_getter_map_.end()) 216 if (iter != app_request_context_getter_map_.end())
203 return iter->second; 217 return iter->second;
204 218
205 scoped_ptr<net::URLRequestJobFactory::Interceptor> 219 scoped_ptr<net::URLRequestJobFactory::Interceptor>
206 protocol_handler_interceptor( 220 protocol_handler_interceptor(
207 ProtocolHandlerRegistryFactory::GetForProfile(profile_)-> 221 ProtocolHandlerRegistryFactory::GetForProfile(profile_)->
208 CreateURLInterceptor()); 222 CreateURLInterceptor());
209 ChromeURLRequestContextGetter* context = 223 ChromeURLRequestContextGetter* context =
210 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( 224 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
211 profile_, io_data_, descriptor, 225 profile_, io_data_, descriptor,
212 protocol_handler_interceptor.Pass()); 226 protocol_handler_interceptor.Pass(), blob_protocol_handler.Pass(),
227 file_system_protocol_handler.Pass(),
228 developer_protocol_handler.Pass());
213 app_request_context_getter_map_[descriptor] = context; 229 app_request_context_getter_map_[descriptor] = context;
214 230
215 return context; 231 return context;
216 } 232 }
217 233
218 scoped_refptr<ChromeURLRequestContextGetter> 234 scoped_refptr<ChromeURLRequestContextGetter>
219 ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter( 235 ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter(
220 const FilePath& partition_path, 236 const FilePath& partition_path,
221 bool in_memory) const { 237 bool in_memory) const {
222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
223 // We must have a non-default path, or this will act like the default media 239 // We must have a non-default path, or this will act like the default media
224 // context. 240 // context.
225 CHECK(partition_path != profile_->GetPath()); 241 CHECK(partition_path != profile_->GetPath());
226 LazyInitialize(); 242 LazyInitialize();
227 243
228 // Keep a map of request context getters, one per requested storage partition. 244 // Keep a map of request context getters, one per requested storage partition.
229 StoragePartitionDescriptor descriptor(partition_path, in_memory); 245 StoragePartitionDescriptor descriptor(partition_path, in_memory);
230 ChromeURLRequestContextGetterMap::iterator iter = 246 ChromeURLRequestContextGetterMap::iterator iter =
231 isolated_media_request_context_getter_map_.find(descriptor); 247 isolated_media_request_context_getter_map_.find(descriptor);
232 if (iter != isolated_media_request_context_getter_map_.end()) 248 if (iter != isolated_media_request_context_getter_map_.end())
233 return iter->second; 249 return iter->second;
234 250
235 // Get the app context as the starting point for the media context, so that 251 // Get the app context as the starting point for the media context, so that
236 // it uses the app's cookie store. 252 // it uses the app's cookie store.
237 ChromeURLRequestContextGetter* app_context = 253 ChromeURLRequestContextGetterMap::const_iterator app_iter =
238 GetIsolatedAppRequestContextGetter(partition_path, in_memory); 254 app_request_context_getter_map_.find(descriptor);
255 DCHECK(app_iter != app_request_context_getter_map_.end());
256 ChromeURLRequestContextGetter* app_context = app_iter->second;
239 ChromeURLRequestContextGetter* context = 257 ChromeURLRequestContextGetter* context =
240 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( 258 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia(
241 profile_, app_context, io_data_, descriptor); 259 profile_, app_context, io_data_, descriptor);
242 isolated_media_request_context_getter_map_[descriptor] = context; 260 isolated_media_request_context_getter_map_[descriptor] = context;
243 261
244 return context; 262 return context;
245 } 263 }
246 264
247 void ProfileImplIOData::Handle::ClearNetworkingHistorySince( 265 void ProfileImplIOData::Handle::ClearNetworkingHistorySince(
248 base::Time time, 266 base::Time time,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 311
294 ProfileImplIOData::ProfileImplIOData() 312 ProfileImplIOData::ProfileImplIOData()
295 : ProfileIOData(false) {} 313 : ProfileIOData(false) {}
296 ProfileImplIOData::~ProfileImplIOData() { 314 ProfileImplIOData::~ProfileImplIOData() {
297 DestroyResourceContext(); 315 DestroyResourceContext();
298 316
299 if (media_request_context_.get()) 317 if (media_request_context_.get())
300 media_request_context_->AssertNoURLRequests(); 318 media_request_context_->AssertNoURLRequests();
301 } 319 }
302 320
303 void ProfileImplIOData::LazyInitializeInternal( 321 void ProfileImplIOData::InitializeInternal(
304 ProfileParams* profile_params) const { 322 ProfileParams* profile_params,
323 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
324 blob_protocol_handler,
325 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
326 file_system_protocol_handler,
327 scoped_ptr<net::URLRequestJobFactory::Interceptor>
328 developer_protocol_handler) const {
305 ChromeURLRequestContext* main_context = main_request_context(); 329 ChromeURLRequestContext* main_context = main_request_context();
306 330
307 IOThread* const io_thread = profile_params->io_thread; 331 IOThread* const io_thread = profile_params->io_thread;
308 IOThread::Globals* const io_thread_globals = io_thread->globals(); 332 IOThread::Globals* const io_thread_globals = io_thread->globals();
309 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 333 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
310 // Only allow Record Mode if we are in a Debug build or where we are running 334 // Only allow Record Mode if we are in a Debug build or where we are running
311 // a cycle, and the user has limited control. 335 // a cycle, and the user has limited control.
312 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && 336 bool record_mode = command_line.HasSwitch(switches::kRecordMode) &&
313 (chrome::kRecordModeEnabled || 337 (chrome::kRecordModeEnabled ||
314 command_line.HasSwitch(switches::kVisitURLs)); 338 command_line.HasSwitch(switches::kVisitURLs));
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 ftp_factory_.reset( 437 ftp_factory_.reset(
414 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); 438 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get()));
415 main_context->set_ftp_transaction_factory(ftp_factory_.get()); 439 main_context->set_ftp_transaction_factory(ftp_factory_.get());
416 #endif // !defined(DISABLE_FTP_SUPPORT) 440 #endif // !defined(DISABLE_FTP_SUPPORT)
417 441
418 main_context->set_chrome_url_data_manager_backend( 442 main_context->set_chrome_url_data_manager_backend(
419 chrome_url_data_manager_backend()); 443 chrome_url_data_manager_backend());
420 444
421 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory( 445 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
422 new net::URLRequestJobFactoryImpl()); 446 new net::URLRequestJobFactoryImpl());
447 main_job_factory->SetProtocolHandler(
448 chrome::kBlobScheme, blob_protocol_handler.release());
449 main_job_factory->SetProtocolHandler(
450 chrome::kFileSystemScheme, file_system_protocol_handler.release());
451 main_job_factory->AddInterceptor(developer_protocol_handler.release());
423 SetUpJobFactory(main_job_factory.get(), 452 SetUpJobFactory(main_job_factory.get(),
424 profile_params->protocol_handler_interceptor.Pass(), 453 profile_params->protocol_handler_interceptor.Pass(),
425 network_delegate(), 454 network_delegate(),
426 main_context->ftp_transaction_factory(), 455 main_context->ftp_transaction_factory(),
427 main_context->ftp_auth_cache()); 456 main_context->ftp_auth_cache());
428 main_job_factory_ = main_job_factory.Pass(); 457 main_job_factory_ = main_job_factory.Pass();
429 main_context->set_job_factory(main_job_factory_.get()); 458 main_context->set_job_factory(main_job_factory_.get());
430 459
431 #if defined(ENABLE_EXTENSIONS) 460 #if defined(ENABLE_EXTENSIONS)
432 InitializeExtensionsRequestContext(profile_params); 461 InitializeExtensionsRequestContext(profile_params);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 extensions_context->ftp_auth_cache()); 515 extensions_context->ftp_auth_cache());
487 extensions_job_factory_ = extensions_job_factory.Pass(); 516 extensions_job_factory_ = extensions_job_factory.Pass();
488 extensions_context->set_job_factory(extensions_job_factory_.get()); 517 extensions_context->set_job_factory(extensions_job_factory_.get());
489 } 518 }
490 519
491 ChromeURLRequestContext* 520 ChromeURLRequestContext*
492 ProfileImplIOData::InitializeAppRequestContext( 521 ProfileImplIOData::InitializeAppRequestContext(
493 ChromeURLRequestContext* main_context, 522 ChromeURLRequestContext* main_context,
494 const StoragePartitionDescriptor& partition_descriptor, 523 const StoragePartitionDescriptor& partition_descriptor,
495 scoped_ptr<net::URLRequestJobFactory::Interceptor> 524 scoped_ptr<net::URLRequestJobFactory::Interceptor>
496 protocol_handler_interceptor) const { 525 protocol_handler_interceptor,
526 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
527 blob_protocol_handler,
528 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
529 file_system_protocol_handler,
530 scoped_ptr<net::URLRequestJobFactory::Interceptor>
531 developer_protocol_handler) const {
497 // Copy most state from the main context. 532 // Copy most state from the main context.
498 AppRequestContext* context = new AppRequestContext(load_time_stats()); 533 AppRequestContext* context = new AppRequestContext(load_time_stats());
499 context->CopyFrom(main_context); 534 context->CopyFrom(main_context);
500 535
501 FilePath cookie_path = partition_descriptor.path.Append( 536 FilePath cookie_path = partition_descriptor.path.Append(
502 chrome::kCookieFilename); 537 chrome::kCookieFilename);
503 FilePath cache_path = partition_descriptor.path.Append(chrome::kCacheDirname); 538 FilePath cache_path = partition_descriptor.path.Append(chrome::kCacheDirname);
504 539
505 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 540 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
506 // Only allow Record Mode if we are in a Debug build or where we are running 541 // Only allow Record Mode if we are in a Debug build or where we are running
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 context->SetCookieStore(cookie_store); 590 context->SetCookieStore(cookie_store);
556 context->SetHttpTransactionFactory( 591 context->SetHttpTransactionFactory(
557 scoped_ptr<net::HttpTransactionFactory>(app_http_cache)); 592 scoped_ptr<net::HttpTransactionFactory>(app_http_cache));
558 593
559 // Overwrite the job factory that we inherit from the main context so 594 // Overwrite the job factory that we inherit from the main context so
560 // that we can later provide our own handles for storage related protocols. 595 // that we can later provide our own handles for storage related protocols.
561 // Install all the usual protocol handlers unless we are in a browser plugin 596 // Install all the usual protocol handlers unless we are in a browser plugin
562 // guest process, in which case only web-safe schemes are allowed. 597 // guest process, in which case only web-safe schemes are allowed.
563 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( 598 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
564 new net::URLRequestJobFactoryImpl()); 599 new net::URLRequestJobFactoryImpl());
600 job_factory->SetProtocolHandler(chrome::kBlobScheme,
601 blob_protocol_handler.release());
602 job_factory->SetProtocolHandler(chrome::kFileSystemScheme,
603 file_system_protocol_handler.release());
604 job_factory->AddInterceptor(developer_protocol_handler.release());
565 if (!partition_descriptor.in_memory) { 605 if (!partition_descriptor.in_memory) {
566 SetUpJobFactory(job_factory.get(), protocol_handler_interceptor.Pass(), 606 SetUpJobFactory(job_factory.get(), protocol_handler_interceptor.Pass(),
567 network_delegate(), 607 network_delegate(),
568 context->ftp_transaction_factory(), 608 context->ftp_transaction_factory(),
569 context->ftp_auth_cache()); 609 context->ftp_auth_cache());
570 } 610 }
571 context->SetJobFactory(job_factory.PassAs<net::URLRequestJobFactory>()); 611 context->SetJobFactory(job_factory.PassAs<net::URLRequestJobFactory>());
572 612
573 return context; 613 return context;
574 } 614 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 ProfileImplIOData::AcquireMediaRequestContext() const { 665 ProfileImplIOData::AcquireMediaRequestContext() const {
626 DCHECK(media_request_context_.get()); 666 DCHECK(media_request_context_.get());
627 return media_request_context_.get(); 667 return media_request_context_.get();
628 } 668 }
629 669
630 ChromeURLRequestContext* 670 ChromeURLRequestContext*
631 ProfileImplIOData::AcquireIsolatedAppRequestContext( 671 ProfileImplIOData::AcquireIsolatedAppRequestContext(
632 ChromeURLRequestContext* main_context, 672 ChromeURLRequestContext* main_context,
633 const StoragePartitionDescriptor& partition_descriptor, 673 const StoragePartitionDescriptor& partition_descriptor,
634 scoped_ptr<net::URLRequestJobFactory::Interceptor> 674 scoped_ptr<net::URLRequestJobFactory::Interceptor>
635 protocol_handler_interceptor) const { 675 protocol_handler_interceptor,
676 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
677 blob_protocol_handler,
678 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
679 file_system_protocol_handler,
680 scoped_ptr<net::URLRequestJobFactory::Interceptor>
681 developer_protocol_handler) const {
636 // We create per-app contexts on demand, unlike the others above. 682 // We create per-app contexts on demand, unlike the others above.
637 ChromeURLRequestContext* app_request_context = 683 ChromeURLRequestContext* app_request_context =
638 InitializeAppRequestContext(main_context, partition_descriptor, 684 InitializeAppRequestContext(main_context, partition_descriptor,
639 protocol_handler_interceptor.Pass()); 685 protocol_handler_interceptor.Pass(),
686 blob_protocol_handler.Pass(),
687 file_system_protocol_handler.Pass(),
688 developer_protocol_handler.Pass());
640 DCHECK(app_request_context); 689 DCHECK(app_request_context);
641 return app_request_context; 690 return app_request_context;
642 } 691 }
643 692
644 ChromeURLRequestContext* 693 ChromeURLRequestContext*
645 ProfileImplIOData::AcquireIsolatedMediaRequestContext( 694 ProfileImplIOData::AcquireIsolatedMediaRequestContext(
646 ChromeURLRequestContext* app_context, 695 ChromeURLRequestContext* app_context,
647 const StoragePartitionDescriptor& partition_descriptor) const { 696 const StoragePartitionDescriptor& partition_descriptor) const {
648 // We create per-app media contexts on demand, unlike the others above. 697 // We create per-app media contexts on demand, unlike the others above.
649 ChromeURLRequestContext* media_request_context = 698 ChromeURLRequestContext* media_request_context =
(...skipping 21 matching lines...) Expand all
671 job_factory->AddInterceptor( 720 job_factory->AddInterceptor(
672 new chrome_browser_net::ConnectInterceptor(predictor_.get())); 721 new chrome_browser_net::ConnectInterceptor(predictor_.get()));
673 job_factory->AddInterceptor( 722 job_factory->AddInterceptor(
674 new DoubleGetExperimentInterceptor(NULL)); 723 new DoubleGetExperimentInterceptor(NULL));
675 } 724 }
676 725
677 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 726 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
678 base::Time time, 727 base::Time time,
679 const base::Closure& completion) { 728 const base::Closure& completion) {
680 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 729 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
681 LazyInitialize(); 730 DCHECK(initialized());
682 731
683 DCHECK(transport_security_state()); 732 DCHECK(transport_security_state());
684 transport_security_state()->DeleteSince(time); // Completes synchronously. 733 transport_security_state()->DeleteSince(time); // Completes synchronously.
685 DCHECK(http_server_properties_manager_); 734 DCHECK(http_server_properties_manager_);
686 http_server_properties_manager_->Clear(completion); 735 http_server_properties_manager_->Clear(completion);
687 } 736 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698