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_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" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/threading/worker_pool.h" | 12 #include "base/threading/worker_pool.h" |
13 #include "chrome/browser/api/prefs/pref_member.h" | 13 #include "chrome/browser/api/prefs/pref_member.h" |
14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | |
15 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | |
14 #include "chrome/browser/io_thread.h" | 16 #include "chrome/browser/io_thread.h" |
15 #include "chrome/browser/net/about_protocol_handler.h" | |
16 #include "chrome/browser/net/chrome_net_log.h" | 17 #include "chrome/browser/net/chrome_net_log.h" |
17 #include "chrome/browser/net/clear_on_exit_policy.h" | 18 #include "chrome/browser/net/clear_on_exit_policy.h" |
18 #include "chrome/browser/net/connect_interceptor.h" | 19 #include "chrome/browser/net/connect_interceptor.h" |
19 #include "chrome/browser/net/http_server_properties_manager.h" | 20 #include "chrome/browser/net/http_server_properties_manager.h" |
20 #include "chrome/browser/net/predictor.h" | 21 #include "chrome/browser/net/predictor.h" |
21 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" | 22 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" |
22 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" | 23 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" |
23 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 26 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
26 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
27 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
30 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
31 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
32 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
33 #include "content/public/browser/resource_context.h" | 34 #include "content/public/browser/resource_context.h" |
34 #include "content/public/browser/storage_partition.h" | 35 #include "content/public/browser/storage_partition.h" |
35 #include "net/base/server_bound_cert_service.h" | 36 #include "net/base/server_bound_cert_service.h" |
36 #include "net/ftp/ftp_network_layer.h" | 37 #include "net/ftp/ftp_network_layer.h" |
37 #include "net/http/http_cache.h" | 38 #include "net/http/http_cache.h" |
38 #include "net/url_request/file_protocol_handler.h" | |
39 #include "net/url_request/ftp_protocol_handler.h" | |
40 #include "net/url_request/url_request_job_factory_impl.h" | 39 #include "net/url_request/url_request_job_factory_impl.h" |
41 #include "webkit/quota/special_storage_policy.h" | 40 #include "webkit/quota/special_storage_policy.h" |
42 | 41 |
43 using content::BrowserThread; | 42 using content::BrowserThread; |
44 | 43 |
45 ProfileImplIOData::Handle::Handle(Profile* profile) | 44 ProfileImplIOData::Handle::Handle(Profile* profile) |
46 : io_data_(new ProfileImplIOData), | 45 : io_data_(new ProfileImplIOData), |
47 profile_(profile), | 46 profile_(profile), |
48 initialized_(false) { | 47 initialized_(false) { |
49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 48 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 212 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
214 CHECK(!app_id.empty()); | 213 CHECK(!app_id.empty()); |
215 LazyInitialize(); | 214 LazyInitialize(); |
216 | 215 |
217 // Keep a map of request context getters, one per requested app ID. | 216 // Keep a map of request context getters, one per requested app ID. |
218 ChromeURLRequestContextGetterMap::iterator iter = | 217 ChromeURLRequestContextGetterMap::iterator iter = |
219 app_request_context_getter_map_.find(app_id); | 218 app_request_context_getter_map_.find(app_id); |
220 if (iter != app_request_context_getter_map_.end()) | 219 if (iter != app_request_context_getter_map_.end()) |
221 return iter->second; | 220 return iter->second; |
222 | 221 |
222 scoped_ptr<net::URLRequestJobFactory::Interceptor> | |
223 protocol_handler_interceptor( | |
224 ProtocolHandlerRegistryFactory::GetForProfile(profile_)-> | |
225 CreateURLInterceptor()); | |
223 ChromeURLRequestContextGetter* context = | 226 ChromeURLRequestContextGetter* context = |
224 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( | 227 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( |
225 profile_, io_data_, app_id); | 228 profile_, io_data_, app_id, protocol_handler_interceptor.Pass()); |
226 app_request_context_getter_map_[app_id] = context; | 229 app_request_context_getter_map_[app_id] = context; |
227 | 230 |
228 return context; | 231 return context; |
229 } | 232 } |
230 | 233 |
231 scoped_refptr<ChromeURLRequestContextGetter> | 234 scoped_refptr<ChromeURLRequestContextGetter> |
232 ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter( | 235 ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter( |
233 const std::string& app_id) const { | 236 const std::string& app_id) const { |
234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
235 // We must have an app ID, or this will act like the default media context. | 238 // We must have an app ID, or this will act like the default media context. |
236 CHECK(!app_id.empty()); | 239 CHECK(!app_id.empty()); |
237 LazyInitialize(); | 240 LazyInitialize(); |
238 | 241 |
239 // Keep a map of request context getters, one per requested app ID. | 242 // Keep a map of request context getters, one per requested app ID. |
240 ChromeURLRequestContextGetterMap::iterator iter = | 243 ChromeURLRequestContextGetterMap::iterator iter = |
241 isolated_media_request_context_getter_map_.find(app_id); | 244 isolated_media_request_context_getter_map_.find(app_id); |
242 if (iter != isolated_media_request_context_getter_map_.end()) | 245 if (iter != isolated_media_request_context_getter_map_.end()) |
243 return iter->second; | 246 return iter->second; |
244 | 247 |
248 // Get the app context as the starting point for the media context, so that | |
249 // it uses the app's cookie store. | |
250 ChromeURLRequestContextGetter* app_context = | |
251 GetIsolatedAppRequestContextGetter(app_id); | |
245 ChromeURLRequestContextGetter* context = | 252 ChromeURLRequestContextGetter* context = |
246 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( | 253 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( |
247 profile_, io_data_, app_id); | 254 profile_, app_context, io_data_, app_id); |
248 isolated_media_request_context_getter_map_[app_id] = context; | 255 isolated_media_request_context_getter_map_[app_id] = context; |
249 | 256 |
250 return context; | 257 return context; |
251 } | 258 } |
252 | 259 |
253 void ProfileImplIOData::Handle::ClearNetworkingHistorySince( | 260 void ProfileImplIOData::Handle::ClearNetworkingHistorySince( |
254 base::Time time) { | 261 base::Time time) { |
255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
256 LazyInitialize(); | 263 LazyInitialize(); |
257 | 264 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); | 430 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); |
424 } | 431 } |
425 | 432 |
426 main_http_factory_.reset(main_cache); | 433 main_http_factory_.reset(main_cache); |
427 main_context->set_http_transaction_factory(main_cache); | 434 main_context->set_http_transaction_factory(main_cache); |
428 | 435 |
429 #if !defined(DISABLE_FTP_SUPPORT) | 436 #if !defined(DISABLE_FTP_SUPPORT) |
430 ftp_factory_.reset( | 437 ftp_factory_.reset( |
431 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); | 438 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); |
432 main_context->set_ftp_transaction_factory(ftp_factory_.get()); | 439 main_context->set_ftp_transaction_factory(ftp_factory_.get()); |
440 extensions_context->set_ftp_transaction_factory(ftp_factory_.get()); | |
willchan no longer on Chromium
2012/09/21 00:05:24
Extensions shouldn't need this. That said, we do c
| |
433 #endif // !defined(DISABLE_FTP_SUPPORT) | 441 #endif // !defined(DISABLE_FTP_SUPPORT) |
434 | 442 |
435 main_context->set_chrome_url_data_manager_backend( | 443 main_context->set_chrome_url_data_manager_backend( |
436 chrome_url_data_manager_backend()); | 444 chrome_url_data_manager_backend()); |
437 | 445 |
438 // Create a media request context based on the main context, but using a | 446 // Create a media request context based on the main context, but using a |
439 // media cache. | 447 // media cache. |
440 media_request_context_.reset(InitializeMediaRequestContext(main_context, "")); | 448 media_request_context_.reset(InitializeMediaRequestContext(main_context, "")); |
441 | 449 |
442 main_job_factory_.reset(new net::URLRequestJobFactoryImpl); | 450 main_job_factory_.reset(new net::URLRequestJobFactoryImpl); |
443 media_request_job_factory_.reset(new net::URLRequestJobFactoryImpl); | 451 media_request_job_factory_.reset(new net::URLRequestJobFactoryImpl); |
444 extensions_job_factory_.reset(new net::URLRequestJobFactoryImpl); | 452 extensions_job_factory_.reset(new net::URLRequestJobFactoryImpl); |
445 | 453 |
446 int set_protocol = main_job_factory_->SetProtocolHandler( | 454 SetUpJobFactory(main_job_factory_.get(), |
447 chrome::kFileScheme, new net::FileProtocolHandler()); | 455 profile_params->protocol_handler_interceptor.Pass(), |
448 DCHECK(set_protocol); | 456 network_delegate(), |
449 set_protocol = media_request_job_factory_->SetProtocolHandler( | 457 main_context->ftp_transaction_factory(), |
willchan no longer on Chromium
2012/09/21 00:05:24
Actually, this sorta makes me change my mind. We'r
awong
2012/09/21 00:09:12
Agreed. Honestly, I'd like to change it so you ca
| |
450 chrome::kFileScheme, new net::FileProtocolHandler()); | 458 main_context->ftp_auth_cache()); |
451 DCHECK(set_protocol); | 459 SetUpJobFactory(media_request_job_factory_.get(), |
460 scoped_ptr<net::URLRequestJobFactoryImpl::Interceptor>(NULL), | |
461 network_delegate(), | |
462 media_request_context_->ftp_transaction_factory(), | |
463 media_request_context_->ftp_auth_cache()); | |
452 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. | 464 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. |
453 // Without a network_delegate, this protocol handler will never | 465 // Without a network_delegate, this protocol handler will never |
454 // handle file: requests, but as a side effect it makes | 466 // handle file: requests, but as a side effect it makes |
455 // job_factory::IsHandledProtocol return true, which prevents attempts to | 467 // job_factory::IsHandledProtocol return true, which prevents attempts to |
456 // handle the protocol externally. | 468 // handle the protocol externally. We pass NULL in to |
457 set_protocol = extensions_job_factory_->SetProtocolHandler( | 469 // SetUpJobFactory() to get this effect. |
458 chrome::kFileScheme, new net::FileProtocolHandler()); | 470 SetUpJobFactory(extensions_job_factory_.get(), |
459 DCHECK(set_protocol); | 471 scoped_ptr<net::URLRequestJobFactoryImpl::Interceptor>(NULL), |
460 | 472 NULL, |
461 set_protocol = main_job_factory_->SetProtocolHandler( | 473 extensions_context->ftp_transaction_factory(), |
462 chrome::kChromeDevToolsScheme, | 474 extensions_context->ftp_auth_cache()); |
463 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(), | |
464 network_delegate())); | |
465 DCHECK(set_protocol); | |
466 set_protocol = media_request_job_factory_->SetProtocolHandler( | |
467 chrome::kChromeDevToolsScheme, | |
468 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(), | |
469 network_delegate())); | |
470 DCHECK(set_protocol); | |
471 set_protocol = extensions_job_factory_->SetProtocolHandler( | |
472 chrome::kChromeDevToolsScheme, | |
473 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(), NULL)); | |
474 DCHECK(set_protocol); | |
475 | |
476 net::URLRequestJobFactory* job_factories[3]; | |
477 job_factories[0] = main_job_factory_.get(); | |
478 job_factories[1] = media_request_job_factory_.get(); | |
479 job_factories[2] = extensions_job_factory_.get(); | |
480 | |
481 net::FtpAuthCache* ftp_auth_caches[3]; | |
482 ftp_auth_caches[0] = main_context->ftp_auth_cache(); | |
483 ftp_auth_caches[1] = media_request_context_->ftp_auth_cache(); | |
484 ftp_auth_caches[2] = extensions_context->ftp_auth_cache(); | |
485 | |
486 for (int i = 0; i < 3; i++) { | |
487 SetUpJobFactoryDefaults(job_factories[i]); | |
488 job_factories[i]->SetProtocolHandler(chrome::kAboutScheme, | |
489 new net::AboutProtocolHandler()); | |
490 CreateFtpProtocolHandler(job_factories[i], ftp_auth_caches[i]); | |
491 job_factories[i]->AddInterceptor( | |
492 new chrome_browser_net::ConnectInterceptor(predictor_.get())); | |
493 } | |
494 | 475 |
495 main_context->set_job_factory(main_job_factory_.get()); | 476 main_context->set_job_factory(main_job_factory_.get()); |
496 media_request_context_->set_job_factory(media_request_job_factory_.get()); | 477 media_request_context_->set_job_factory(media_request_job_factory_.get()); |
497 extensions_context->set_job_factory(extensions_job_factory_.get()); | 478 extensions_context->set_job_factory(extensions_job_factory_.get()); |
498 | 479 |
499 lazy_params_.reset(); | 480 lazy_params_.reset(); |
500 } | 481 } |
501 | 482 |
502 ChromeURLRequestContext* | 483 ChromeURLRequestContext* |
503 ProfileImplIOData::InitializeAppRequestContext( | 484 ProfileImplIOData::InitializeAppRequestContext( |
504 ChromeURLRequestContext* main_context, | 485 ChromeURLRequestContext* main_context, |
505 const std::string& app_id) const { | 486 const std::string& app_id, |
487 scoped_ptr<net::URLRequestJobFactory::Interceptor> | |
488 protocol_handler_interceptor) const { | |
506 // If this is for a guest process, we should not persist cookies and http | 489 // If this is for a guest process, we should not persist cookies and http |
507 // cache. | 490 // cache. |
508 bool is_guest_process = (app_id.find("guest-") != std::string::npos); | 491 bool is_guest_process = (app_id.find("guest-") != std::string::npos); |
509 | 492 |
510 // Copy most state from the main context. | 493 // Copy most state from the main context. |
511 AppRequestContext* context = new AppRequestContext(load_time_stats()); | 494 AppRequestContext* context = new AppRequestContext(load_time_stats()); |
512 context->CopyFrom(main_context); | 495 context->CopyFrom(main_context); |
513 | 496 |
514 using content::StoragePartition; | 497 using content::StoragePartition; |
515 FilePath app_path = | 498 FilePath app_path = |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 scoped_refptr<SQLitePersistentCookieStore> cookie_db = | 545 scoped_refptr<SQLitePersistentCookieStore> cookie_db = |
563 new SQLitePersistentCookieStore(cookie_path, false, NULL); | 546 new SQLitePersistentCookieStore(cookie_path, false, NULL); |
564 // TODO(creis): We should have a cookie delegate for notifying the cookie | 547 // TODO(creis): We should have a cookie delegate for notifying the cookie |
565 // extensions API, but we need to update it to understand isolated apps | 548 // extensions API, but we need to update it to understand isolated apps |
566 // first. | 549 // first. |
567 cookie_store = new net::CookieMonster(cookie_db.get(), NULL); | 550 cookie_store = new net::CookieMonster(cookie_db.get(), NULL); |
568 } | 551 } |
569 | 552 |
570 // Transfer ownership of the cookies and cache to AppRequestContext. | 553 // Transfer ownership of the cookies and cache to AppRequestContext. |
571 context->SetCookieStore(cookie_store); | 554 context->SetCookieStore(cookie_store); |
572 context->SetHttpTransactionFactory(app_http_cache); | 555 context->SetHttpTransactionFactory( |
556 scoped_ptr<net::HttpTransactionFactory>(app_http_cache)); | |
557 | |
558 // Overwrite the job factory that we inherit from the main context so | |
559 // that we can later provide our own handles for storage related protocols. | |
560 scoped_ptr<net::URLRequestJobFactory> job_factory( | |
561 new net::URLRequestJobFactoryImpl()); | |
562 SetUpJobFactory(job_factory.get(), protocol_handler_interceptor.Pass(), | |
563 network_delegate(), | |
564 context->ftp_transaction_factory(), | |
565 context->ftp_auth_cache()); | |
566 context->SetJobFactory(job_factory.Pass()); | |
573 | 567 |
574 return context; | 568 return context; |
575 } | 569 } |
576 | 570 |
577 ChromeURLRequestContext* | 571 ChromeURLRequestContext* |
578 ProfileImplIOData::InitializeMediaRequestContext( | 572 ProfileImplIOData::InitializeMediaRequestContext( |
579 ChromeURLRequestContext* original_context, | 573 ChromeURLRequestContext* original_context, |
580 const std::string& app_id) const { | 574 const std::string& app_id) const { |
581 // If this is for a guest process, we do not persist storage, so we can | 575 // If this is for a guest process, we do not persist storage, so we can |
582 // simply use the app's in-memory cache (like off-the-record mode). | 576 // simply use the app's in-memory cache (like off-the-record mode). |
(...skipping 19 matching lines...) Expand all Loading... | |
602 | 596 |
603 // Use a separate HTTP disk cache for isolated apps. | 597 // Use a separate HTTP disk cache for isolated apps. |
604 net::HttpCache::BackendFactory* media_backend = | 598 net::HttpCache::BackendFactory* media_backend = |
605 new net::HttpCache::DefaultBackend( | 599 new net::HttpCache::DefaultBackend( |
606 net::MEDIA_CACHE, | 600 net::MEDIA_CACHE, |
607 cache_path, | 601 cache_path, |
608 cache_max_size, | 602 cache_max_size, |
609 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 603 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
610 net::HttpNetworkSession* main_network_session = | 604 net::HttpNetworkSession* main_network_session = |
611 main_http_factory_->GetSession(); | 605 main_http_factory_->GetSession(); |
612 net::HttpCache* media_http_cache = | 606 scoped_ptr<net::HttpTransactionFactory> media_http_cache( |
613 new net::HttpCache(main_network_session, media_backend); | 607 new net::HttpCache(main_network_session, media_backend)); |
614 | 608 |
615 // Transfer ownership of the cache to MediaRequestContext. | 609 // Transfer ownership of the cache to MediaRequestContext. |
616 context->SetHttpTransactionFactory(media_http_cache); | 610 context->SetHttpTransactionFactory(media_http_cache.Pass()); |
611 | |
612 // Note that we do not create a new URLRequestJobFactory because | |
613 // the media context should behave exactly like its parent context | |
614 // in all respects except for cache behavior on media subresources. | |
615 // The CopyFrom() step above means that our media context will use | |
616 // the same URLRequestJobFactory instance that our parent context does. | |
617 | 617 |
618 return context; | 618 return context; |
619 } | 619 } |
620 | 620 |
621 ChromeURLRequestContext* | 621 ChromeURLRequestContext* |
622 ProfileImplIOData::AcquireMediaRequestContext() const { | 622 ProfileImplIOData::AcquireMediaRequestContext() const { |
623 DCHECK(media_request_context_.get()); | 623 DCHECK(media_request_context_.get()); |
624 return media_request_context_.get(); | 624 return media_request_context_.get(); |
625 } | 625 } |
626 | 626 |
627 ChromeURLRequestContext* | 627 ChromeURLRequestContext* |
628 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 628 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
629 ChromeURLRequestContext* main_context, | 629 ChromeURLRequestContext* main_context, |
630 const std::string& app_id) const { | 630 const std::string& app_id, |
631 scoped_ptr<net::URLRequestJobFactory::Interceptor> | |
632 protocol_handler_interceptor) const { | |
631 // We create per-app contexts on demand, unlike the others above. | 633 // We create per-app contexts on demand, unlike the others above. |
632 ChromeURLRequestContext* app_request_context = | 634 ChromeURLRequestContext* app_request_context = |
633 InitializeAppRequestContext(main_context, app_id); | 635 InitializeAppRequestContext(main_context, app_id, |
636 protocol_handler_interceptor.Pass()); | |
634 DCHECK(app_request_context); | 637 DCHECK(app_request_context); |
635 return app_request_context; | 638 return app_request_context; |
636 } | 639 } |
637 | 640 |
638 ChromeURLRequestContext* | 641 ChromeURLRequestContext* |
639 ProfileImplIOData::AcquireIsolatedMediaRequestContext( | 642 ProfileImplIOData::AcquireIsolatedMediaRequestContext( |
640 ChromeURLRequestContext* app_context, | 643 ChromeURLRequestContext* app_context, |
641 const std::string& app_id) const { | 644 const std::string& app_id) const { |
642 // We create per-app media contexts on demand, unlike the others above. | 645 // We create per-app media contexts on demand, unlike the others above. |
643 ChromeURLRequestContext* media_request_context = | 646 ChromeURLRequestContext* media_request_context = |
644 InitializeMediaRequestContext(app_context, app_id); | 647 InitializeMediaRequestContext(app_context, app_id); |
645 DCHECK(media_request_context); | 648 DCHECK(media_request_context); |
646 return media_request_context; | 649 return media_request_context; |
647 } | 650 } |
648 | 651 |
649 chrome_browser_net::LoadTimeStats* ProfileImplIOData::GetLoadTimeStats( | 652 chrome_browser_net::LoadTimeStats* ProfileImplIOData::GetLoadTimeStats( |
650 IOThread::Globals* io_thread_globals) const { | 653 IOThread::Globals* io_thread_globals) const { |
651 return io_thread_globals->load_time_stats.get(); | 654 return io_thread_globals->load_time_stats.get(); |
652 } | 655 } |
653 | 656 |
654 void ProfileImplIOData::CreateFtpProtocolHandler( | 657 void ProfileImplIOData::SetUpJobFactory( |
655 net::URLRequestJobFactory* job_factory, | 658 net::URLRequestJobFactory* job_factory, |
659 scoped_ptr<net::URLRequestJobFactory::Interceptor> | |
660 protocol_handler_interceptor, | |
661 net::NetworkDelegate* network_delegate, | |
662 net::FtpTransactionFactory* ftp_transaction_factory, | |
656 net::FtpAuthCache* ftp_auth_cache) const { | 663 net::FtpAuthCache* ftp_auth_cache) const { |
657 #if !defined(DISABLE_FTP_SUPPORT) | 664 SetUpJobFactoryDefaults(job_factory, protocol_handler_interceptor.Pass(), |
658 job_factory->SetProtocolHandler( | 665 network_delegate, ftp_transaction_factory, |
659 chrome::kFtpScheme, | 666 ftp_auth_cache); |
660 new net::FtpProtocolHandler(ftp_factory_.get(), | 667 |
661 ftp_auth_cache)); | 668 job_factory->AddInterceptor( |
662 #endif // !defined(DISABLE_FTP_SUPPORT) | 669 new chrome_browser_net::ConnectInterceptor(predictor_.get())); |
663 } | 670 } |
664 | 671 |
665 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 672 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
666 base::Time time) { | 673 base::Time time) { |
667 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 674 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
668 LazyInitialize(); | 675 LazyInitialize(); |
669 | 676 |
670 DCHECK(transport_security_state()); | 677 DCHECK(transport_security_state()); |
671 transport_security_state()->DeleteSince(time); | 678 transport_security_state()->DeleteSince(time); |
672 DCHECK(http_server_properties_manager()); | 679 DCHECK(http_server_properties_manager()); |
673 http_server_properties_manager()->Clear(); | 680 http_server_properties_manager()->Clear(); |
674 } | 681 } |
OLD | NEW |