| 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 29 matching lines...) Expand all Loading... |
| 40 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 40 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
| 41 #include "chrome/browser/net/transport_security_persister.h" | 41 #include "chrome/browser/net/transport_security_persister.h" |
| 42 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 42 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 43 #include "chrome/browser/policy/url_blacklist_manager.h" | 43 #include "chrome/browser/policy/url_blacklist_manager.h" |
| 44 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 44 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
| 45 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" | 45 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" |
| 46 #include "chrome/browser/prefs/pref_service.h" | 46 #include "chrome/browser/prefs/pref_service.h" |
| 47 #include "chrome/browser/profiles/profile.h" | 47 #include "chrome/browser/profiles/profile.h" |
| 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/browser/ui/webui/chrome_url_data_manager_backend.h" | |
| 51 #include "chrome/common/chrome_notification_types.h" | 50 #include "chrome/common/chrome_notification_types.h" |
| 52 #include "chrome/common/chrome_paths.h" | 51 #include "chrome/common/chrome_paths.h" |
| 53 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
| 54 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
| 55 #include "chrome/common/startup_metric_utils.h" | 54 #include "chrome/common/startup_metric_utils.h" |
| 56 #include "chrome/common/url_constants.h" | 55 #include "chrome/common/url_constants.h" |
| 57 #include "content/public/browser/browser_thread.h" | 56 #include "content/public/browser/browser_thread.h" |
| 58 #include "content/public/browser/host_zoom_map.h" | 57 #include "content/public/browser/host_zoom_map.h" |
| 59 #include "content/public/browser/notification_service.h" | 58 #include "content/public/browser/notification_service.h" |
| 60 #include "content/public/browser/resource_context.h" | 59 #include "content/public/browser/resource_context.h" |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 return true; | 452 return true; |
| 454 } | 453 } |
| 455 | 454 |
| 456 return IsHandledProtocol(url.scheme()); | 455 return IsHandledProtocol(url.scheme()); |
| 457 } | 456 } |
| 458 | 457 |
| 459 content::ResourceContext* ProfileIOData::GetResourceContext() const { | 458 content::ResourceContext* ProfileIOData::GetResourceContext() const { |
| 460 return resource_context_.get(); | 459 return resource_context_.get(); |
| 461 } | 460 } |
| 462 | 461 |
| 463 ChromeURLDataManagerBackend* | |
| 464 ProfileIOData::GetChromeURLDataManagerBackend() const { | |
| 465 LazyInitialize(); | |
| 466 return chrome_url_data_manager_backend_.get(); | |
| 467 } | |
| 468 | |
| 469 ChromeURLRequestContext* | 462 ChromeURLRequestContext* |
| 470 ProfileIOData::GetMainRequestContext() const { | 463 ProfileIOData::GetMainRequestContext() const { |
| 471 LazyInitialize(); | 464 LazyInitialize(); |
| 472 return main_request_context_.get(); | 465 return main_request_context_.get(); |
| 473 } | 466 } |
| 474 | 467 |
| 475 ChromeURLRequestContext* | 468 ChromeURLRequestContext* |
| 476 ProfileIOData::GetMediaRequestContext() const { | 469 ProfileIOData::GetMediaRequestContext() const { |
| 477 LazyInitialize(); | 470 LazyInitialize(); |
| 478 ChromeURLRequestContext* context = | 471 ChromeURLRequestContext* context = |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 626 |
| 634 // Create the common request contexts. | 627 // Create the common request contexts. |
| 635 main_request_context_.reset( | 628 main_request_context_.reset( |
| 636 new ChromeURLRequestContext(ChromeURLRequestContext::CONTEXT_TYPE_MAIN, | 629 new ChromeURLRequestContext(ChromeURLRequestContext::CONTEXT_TYPE_MAIN, |
| 637 load_time_stats_)); | 630 load_time_stats_)); |
| 638 extensions_request_context_.reset( | 631 extensions_request_context_.reset( |
| 639 new ChromeURLRequestContext( | 632 new ChromeURLRequestContext( |
| 640 ChromeURLRequestContext::CONTEXT_TYPE_EXTENSIONS, | 633 ChromeURLRequestContext::CONTEXT_TYPE_EXTENSIONS, |
| 641 load_time_stats_)); | 634 load_time_stats_)); |
| 642 | 635 |
| 643 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend); | |
| 644 | |
| 645 ChromeNetworkDelegate* network_delegate = | 636 ChromeNetworkDelegate* network_delegate = |
| 646 new ChromeNetworkDelegate( | 637 new ChromeNetworkDelegate( |
| 647 io_thread_globals->extension_event_router_forwarder.get(), | 638 io_thread_globals->extension_event_router_forwarder.get(), |
| 648 &enable_referrers_); | 639 &enable_referrers_); |
| 649 network_delegate->set_extension_info_map(profile_params_->extension_info_map); | 640 network_delegate->set_extension_info_map(profile_params_->extension_info_map); |
| 650 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); | 641 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); |
| 651 network_delegate->set_profile(profile_params_->profile); | 642 network_delegate->set_profile(profile_params_->profile); |
| 652 network_delegate->set_cookie_settings(profile_params_->cookie_settings); | 643 network_delegate->set_cookie_settings(profile_params_->cookie_settings); |
| 653 network_delegate->set_enable_do_not_track(&enable_do_not_track_); | 644 network_delegate->set_enable_do_not_track(&enable_do_not_track_); |
| 654 network_delegate->set_force_google_safe_search(&force_safesearch_); | 645 network_delegate->set_force_google_safe_search(&force_safesearch_); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 net::NetworkDelegate* network_delegate, | 705 net::NetworkDelegate* network_delegate, |
| 715 net::FtpTransactionFactory* ftp_transaction_factory, | 706 net::FtpTransactionFactory* ftp_transaction_factory, |
| 716 net::FtpAuthCache* ftp_auth_cache) const { | 707 net::FtpAuthCache* ftp_auth_cache) const { |
| 717 // NOTE(willchan): Keep these protocol handlers in sync with | 708 // NOTE(willchan): Keep these protocol handlers in sync with |
| 718 // ProfileIOData::IsHandledProtocol(). | 709 // ProfileIOData::IsHandledProtocol(). |
| 719 bool set_protocol = job_factory->SetProtocolHandler( | 710 bool set_protocol = job_factory->SetProtocolHandler( |
| 720 chrome::kFileScheme, new net::FileProtocolHandler()); | 711 chrome::kFileScheme, new net::FileProtocolHandler()); |
| 721 DCHECK(set_protocol); | 712 DCHECK(set_protocol); |
| 722 | 713 |
| 723 set_protocol = job_factory->SetProtocolHandler( | 714 set_protocol = job_factory->SetProtocolHandler( |
| 724 chrome::kChromeDevToolsScheme, | |
| 725 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(), | |
| 726 network_delegate, is_incognito())); | |
| 727 DCHECK(set_protocol); | |
| 728 set_protocol = job_factory->SetProtocolHandler( | |
| 729 extensions::kExtensionScheme, | 715 extensions::kExtensionScheme, |
| 730 CreateExtensionProtocolHandler(is_incognito(), GetExtensionInfoMap())); | 716 CreateExtensionProtocolHandler(is_incognito(), GetExtensionInfoMap())); |
| 731 DCHECK(set_protocol); | 717 DCHECK(set_protocol); |
| 732 set_protocol = job_factory->SetProtocolHandler( | 718 set_protocol = job_factory->SetProtocolHandler( |
| 733 chrome::kExtensionResourceScheme, | 719 chrome::kExtensionResourceScheme, |
| 734 CreateExtensionResourceProtocolHandler()); | 720 CreateExtensionResourceProtocolHandler()); |
| 735 DCHECK(set_protocol); | 721 DCHECK(set_protocol); |
| 736 set_protocol = job_factory->SetProtocolHandler( | 722 set_protocol = job_factory->SetProtocolHandler( |
| 737 chrome::kChromeUIScheme, | |
| 738 ChromeURLDataManagerBackend::CreateProtocolHandler( | |
| 739 chrome_url_data_manager_backend_.get(), | |
| 740 is_incognito())); | |
| 741 DCHECK(set_protocol); | |
| 742 set_protocol = job_factory->SetProtocolHandler( | |
| 743 chrome::kDataScheme, new net::DataProtocolHandler()); | 723 chrome::kDataScheme, new net::DataProtocolHandler()); |
| 744 DCHECK(set_protocol); | 724 DCHECK(set_protocol); |
| 745 #if defined(OS_CHROMEOS) | 725 #if defined(OS_CHROMEOS) |
| 746 if (!is_incognito() && profile_params_.get()) { | 726 if (!is_incognito() && profile_params_.get()) { |
| 747 set_protocol = job_factory->SetProtocolHandler( | 727 set_protocol = job_factory->SetProtocolHandler( |
| 748 chrome::kDriveScheme, | 728 chrome::kDriveScheme, |
| 749 new drive::DriveProtocolHandler(profile_params_->profile)); | 729 new drive::DriveProtocolHandler(profile_params_->profile)); |
| 750 DCHECK(set_protocol); | 730 DCHECK(set_protocol); |
| 751 } | 731 } |
| 752 #endif // defined(OS_CHROMEOS) | 732 #endif // defined(OS_CHROMEOS) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 void ProfileIOData::SetCookieSettingsForTesting( | 821 void ProfileIOData::SetCookieSettingsForTesting( |
| 842 CookieSettings* cookie_settings) { | 822 CookieSettings* cookie_settings) { |
| 843 DCHECK(!cookie_settings_.get()); | 823 DCHECK(!cookie_settings_.get()); |
| 844 cookie_settings_ = cookie_settings; | 824 cookie_settings_ = cookie_settings; |
| 845 } | 825 } |
| 846 | 826 |
| 847 void ProfileIOData::set_signin_names_for_testing( | 827 void ProfileIOData::set_signin_names_for_testing( |
| 848 SigninNamesOnIOThread* signin_names) { | 828 SigninNamesOnIOThread* signin_names) { |
| 849 signin_names_.reset(signin_names); | 829 signin_names_.reset(signin_names); |
| 850 } | 830 } |
| OLD | NEW |