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

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

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" 75 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
76 #include "components/prefs/pref_service.h" 76 #include "components/prefs/pref_service.h"
77 #include "components/signin/core/common/signin_pref_names.h" 77 #include "components/signin/core/common/signin_pref_names.h"
78 #include "components/sync/base/pref_names.h" 78 #include "components/sync/base/pref_names.h"
79 #include "components/url_formatter/url_fixer.h" 79 #include "components/url_formatter/url_fixer.h"
80 #include "content/public/browser/browser_thread.h" 80 #include "content/public/browser/browser_thread.h"
81 #include "content/public/browser/host_zoom_map.h" 81 #include "content/public/browser/host_zoom_map.h"
82 #include "content/public/browser/notification_service.h" 82 #include "content/public/browser/notification_service.h"
83 #include "content/public/browser/resource_context.h" 83 #include "content/public/browser/resource_context.h"
84 #include "content/public/common/content_switches.h" 84 #include "content/public/common/content_switches.h"
85 #include "extensions/features/features.h"
85 #include "net/base/keygen_handler.h" 86 #include "net/base/keygen_handler.h"
86 #include "net/cert/cert_verifier.h" 87 #include "net/cert/cert_verifier.h"
87 #include "net/cert/ct_log_verifier.h" 88 #include "net/cert/ct_log_verifier.h"
88 #include "net/cert/multi_log_ct_verifier.h" 89 #include "net/cert/multi_log_ct_verifier.h"
89 #include "net/cookies/canonical_cookie.h" 90 #include "net/cookies/canonical_cookie.h"
90 #include "net/http/http_network_session.h" 91 #include "net/http/http_network_session.h"
91 #include "net/http/http_transaction_factory.h" 92 #include "net/http/http_transaction_factory.h"
92 #include "net/http/http_util.h" 93 #include "net/http/http_util.h"
93 #include "net/http/transport_security_persister.h" 94 #include "net/http/transport_security_persister.h"
94 #include "net/net_features.h" 95 #include "net/net_features.h"
(...skipping 10 matching lines...) Expand all
105 #include "net/url_request/url_request.h" 106 #include "net/url_request/url_request.h"
106 #include "net/url_request/url_request_context.h" 107 #include "net/url_request/url_request_context.h"
107 #include "net/url_request/url_request_context_builder.h" 108 #include "net/url_request/url_request_context_builder.h"
108 #include "net/url_request/url_request_context_storage.h" 109 #include "net/url_request/url_request_context_storage.h"
109 #include "net/url_request/url_request_file_job.h" 110 #include "net/url_request/url_request_file_job.h"
110 #include "net/url_request/url_request_intercepting_job_factory.h" 111 #include "net/url_request/url_request_intercepting_job_factory.h"
111 #include "net/url_request/url_request_interceptor.h" 112 #include "net/url_request/url_request_interceptor.h"
112 #include "net/url_request/url_request_job_factory_impl.h" 113 #include "net/url_request/url_request_job_factory_impl.h"
113 #include "third_party/WebKit/public/public_features.h" 114 #include "third_party/WebKit/public/public_features.h"
114 115
115 #if defined(ENABLE_EXTENSIONS) 116 #if BUILDFLAG(ENABLE_EXTENSIONS)
116 #include "chrome/browser/extensions/extension_cookie_monster_delegate.h" 117 #include "chrome/browser/extensions/extension_cookie_monster_delegate.h"
117 #include "chrome/browser/extensions/extension_resource_protocols.h" 118 #include "chrome/browser/extensions/extension_resource_protocols.h"
118 #include "extensions/browser/extension_protocols.h" 119 #include "extensions/browser/extension_protocols.h"
119 #include "extensions/browser/extension_system.h" 120 #include "extensions/browser/extension_system.h"
120 #include "extensions/browser/extension_throttle_manager.h" 121 #include "extensions/browser/extension_throttle_manager.h"
121 #include "extensions/browser/info_map.h" 122 #include "extensions/browser/info_map.h"
122 #include "extensions/common/constants.h" 123 #include "extensions/common/constants.h"
123 #endif 124 #endif
124 125
125 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 126 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 std::unique_ptr<ProfileParams> params(new ProfileParams); 396 std::unique_ptr<ProfileParams> params(new ProfileParams);
396 params->path = profile->GetPath(); 397 params->path = profile->GetPath();
397 398
398 params->io_thread = g_browser_process->io_thread(); 399 params->io_thread = g_browser_process->io_thread();
399 400
400 params->cookie_settings = CookieSettingsFactory::GetForProfile(profile); 401 params->cookie_settings = CookieSettingsFactory::GetForProfile(profile);
401 params->host_content_settings_map = 402 params->host_content_settings_map =
402 HostContentSettingsMapFactory::GetForProfile(profile); 403 HostContentSettingsMapFactory::GetForProfile(profile);
403 params->ssl_config_service = profile->GetSSLConfigService(); 404 params->ssl_config_service = profile->GetSSLConfigService();
404 405
405 #if defined(ENABLE_EXTENSIONS) 406 #if BUILDFLAG(ENABLE_EXTENSIONS)
406 params->extension_info_map = 407 params->extension_info_map =
407 extensions::ExtensionSystem::Get(profile)->info_map(); 408 extensions::ExtensionSystem::Get(profile)->info_map();
408 params->cookie_monster_delegate = new ExtensionCookieMonsterDelegate(profile); 409 params->cookie_monster_delegate = new ExtensionCookieMonsterDelegate(profile);
409 #endif 410 #endif
410 411
411 if (predictors::ResourcePrefetchPredictor* predictor = 412 if (predictors::ResourcePrefetchPredictor* predictor =
412 predictors::ResourcePrefetchPredictorFactory::GetForProfile( 413 predictors::ResourcePrefetchPredictorFactory::GetForProfile(
413 profile)) { 414 profile)) {
414 resource_prefetch_predictor_observer_.reset( 415 resource_prefetch_predictor_observer_.reset(
415 new chrome_browser_net::ResourcePrefetchPredictorObserver(predictor)); 416 new chrome_browser_net::ResourcePrefetchPredictorObserver(predictor));
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 return (static_cast<ResourceContext*>(rc))->io_data_; 725 return (static_cast<ResourceContext*>(rc))->io_data_;
725 } 726 }
726 727
727 // static 728 // static
728 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { 729 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
729 DCHECK_EQ(scheme, base::ToLowerASCII(scheme)); 730 DCHECK_EQ(scheme, base::ToLowerASCII(scheme));
730 static const char* const kProtocolList[] = { 731 static const char* const kProtocolList[] = {
731 url::kFileScheme, 732 url::kFileScheme,
732 content::kChromeDevToolsScheme, 733 content::kChromeDevToolsScheme,
733 dom_distiller::kDomDistillerScheme, 734 dom_distiller::kDomDistillerScheme,
734 #if defined(ENABLE_EXTENSIONS) 735 #if BUILDFLAG(ENABLE_EXTENSIONS)
735 extensions::kExtensionScheme, 736 extensions::kExtensionScheme,
736 extensions::kExtensionResourceScheme, 737 extensions::kExtensionResourceScheme,
737 #endif 738 #endif
738 content::kChromeUIScheme, 739 content::kChromeUIScheme,
739 url::kDataScheme, 740 url::kDataScheme,
740 #if defined(OS_CHROMEOS) 741 #if defined(OS_CHROMEOS)
741 content::kExternalFileScheme, 742 content::kExternalFileScheme,
742 #endif // defined(OS_CHROMEOS) 743 #endif // defined(OS_CHROMEOS)
743 #if defined(OS_ANDROID) 744 #if defined(OS_ANDROID)
744 url::kContentScheme, 745 url::kContentScheme,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 context = AcquireIsolatedMediaRequestContext(app_context, 845 context = AcquireIsolatedMediaRequestContext(app_context,
845 partition_descriptor); 846 partition_descriptor);
846 isolated_media_request_context_map_[partition_descriptor] = context; 847 isolated_media_request_context_map_[partition_descriptor] = context;
847 } 848 }
848 DCHECK(context); 849 DCHECK(context);
849 return context; 850 return context;
850 } 851 }
851 852
852 extensions::InfoMap* ProfileIOData::GetExtensionInfoMap() const { 853 extensions::InfoMap* ProfileIOData::GetExtensionInfoMap() const {
853 DCHECK(initialized_) << "ExtensionSystem not initialized"; 854 DCHECK(initialized_) << "ExtensionSystem not initialized";
854 #if defined(ENABLE_EXTENSIONS) 855 #if BUILDFLAG(ENABLE_EXTENSIONS)
855 return extension_info_map_.get(); 856 return extension_info_map_.get();
856 #else 857 #else
857 return nullptr; 858 return nullptr;
858 #endif 859 #endif
859 } 860 }
860 861
861 extensions::ExtensionThrottleManager* 862 extensions::ExtensionThrottleManager*
862 ProfileIOData::GetExtensionThrottleManager() const { 863 ProfileIOData::GetExtensionThrottleManager() const {
863 DCHECK(initialized_) << "ExtensionSystem not initialized"; 864 DCHECK(initialized_) << "ExtensionSystem not initialized";
864 #if defined(ENABLE_EXTENSIONS) 865 #if BUILDFLAG(ENABLE_EXTENSIONS)
865 return extension_throttle_manager_.get(); 866 return extension_throttle_manager_.get();
866 #else 867 #else
867 return nullptr; 868 return nullptr;
868 #endif 869 #endif
869 } 870 }
870 871
871 content_settings::CookieSettings* ProfileIOData::GetCookieSettings() const { 872 content_settings::CookieSettings* ProfileIOData::GetCookieSettings() const {
872 // Allow either Init() or SetCookieSettingsForTesting() to initialize. 873 // Allow either Init() or SetCookieSettingsForTesting() to initialize.
873 DCHECK(initialized_ || cookie_settings_.get()); 874 DCHECK(initialized_ || cookie_settings_.get());
874 return cookie_settings_.get(); 875 return cookie_settings_.get();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 // Create the common request contexts. 1021 // Create the common request contexts.
1021 main_request_context_.reset(new net::URLRequestContext()); 1022 main_request_context_.reset(new net::URLRequestContext());
1022 main_request_context_storage_.reset( 1023 main_request_context_storage_.reset(
1023 new net::URLRequestContextStorage(main_request_context_.get())); 1024 new net::URLRequestContextStorage(main_request_context_.get()));
1024 extensions_request_context_.reset(new net::URLRequestContext()); 1025 extensions_request_context_.reset(new net::URLRequestContext());
1025 1026
1026 main_request_context_->set_enable_brotli(io_thread_globals->enable_brotli); 1027 main_request_context_->set_enable_brotli(io_thread_globals->enable_brotli);
1027 1028
1028 std::unique_ptr<ChromeNetworkDelegate> network_delegate( 1029 std::unique_ptr<ChromeNetworkDelegate> network_delegate(
1029 new ChromeNetworkDelegate( 1030 new ChromeNetworkDelegate(
1030 #if defined(ENABLE_EXTENSIONS) 1031 #if BUILDFLAG(ENABLE_EXTENSIONS)
1031 io_thread_globals->extension_event_router_forwarder.get(), 1032 io_thread_globals->extension_event_router_forwarder.get(),
1032 #else 1033 #else
1033 NULL, 1034 NULL,
1034 #endif 1035 #endif
1035 &enable_referrers_, io_thread->GetMetricsDataUseForwarder())); 1036 &enable_referrers_, io_thread->GetMetricsDataUseForwarder()));
1036 #if defined(ENABLE_EXTENSIONS) 1037 #if BUILDFLAG(ENABLE_EXTENSIONS)
1037 network_delegate->set_extension_info_map( 1038 network_delegate->set_extension_info_map(
1038 profile_params_->extension_info_map.get()); 1039 profile_params_->extension_info_map.get());
1039 if (!command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) { 1040 if (!command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) {
1040 extension_throttle_manager_.reset( 1041 extension_throttle_manager_.reset(
1041 new extensions::ExtensionThrottleManager()); 1042 new extensions::ExtensionThrottleManager());
1042 } 1043 }
1043 #endif 1044 #endif
1044 1045
1045 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); 1046 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get());
1046 network_delegate->set_profile(profile_params_->profile); 1047 network_delegate->set_profile(profile_params_->profile);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 expect_ct_reporter_.reset( 1081 expect_ct_reporter_.reset(
1081 new ChromeExpectCTReporter(main_request_context_.get())); 1082 new ChromeExpectCTReporter(main_request_context_.get()));
1082 transport_security_state_->SetExpectCTReporter(expect_ct_reporter_.get()); 1083 transport_security_state_->SetExpectCTReporter(expect_ct_reporter_.get());
1083 1084
1084 transport_security_state_->SetRequireCTDelegate( 1085 transport_security_state_->SetRequireCTDelegate(
1085 ct_policy_manager_->GetDelegate()); 1086 ct_policy_manager_->GetDelegate());
1086 1087
1087 // Take ownership over these parameters. 1088 // Take ownership over these parameters.
1088 cookie_settings_ = profile_params_->cookie_settings; 1089 cookie_settings_ = profile_params_->cookie_settings;
1089 host_content_settings_map_ = profile_params_->host_content_settings_map; 1090 host_content_settings_map_ = profile_params_->host_content_settings_map;
1090 #if defined(ENABLE_EXTENSIONS) 1091 #if BUILDFLAG(ENABLE_EXTENSIONS)
1091 extension_info_map_ = profile_params_->extension_info_map; 1092 extension_info_map_ = profile_params_->extension_info_map;
1092 #endif 1093 #endif
1093 1094
1094 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); 1095 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get();
1095 resource_context_->request_context_ = main_request_context_.get(); 1096 resource_context_->request_context_ = main_request_context_.get();
1096 1097
1097 if (profile_params_->resource_prefetch_predictor_observer_) { 1098 if (profile_params_->resource_prefetch_predictor_observer_) {
1098 resource_prefetch_predictor_observer_.reset( 1099 resource_prefetch_predictor_observer_.reset(
1099 profile_params_->resource_prefetch_predictor_observer_.release()); 1100 profile_params_->resource_prefetch_predictor_observer_.release());
1100 } 1101 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 // NOTE(willchan): Keep these protocol handlers in sync with 1183 // NOTE(willchan): Keep these protocol handlers in sync with
1183 // ProfileIOData::IsHandledProtocol(). 1184 // ProfileIOData::IsHandledProtocol().
1184 bool set_protocol = job_factory->SetProtocolHandler( 1185 bool set_protocol = job_factory->SetProtocolHandler(
1185 url::kFileScheme, 1186 url::kFileScheme,
1186 base::MakeUnique<net::FileProtocolHandler>( 1187 base::MakeUnique<net::FileProtocolHandler>(
1187 content::BrowserThread::GetBlockingPool() 1188 content::BrowserThread::GetBlockingPool()
1188 ->GetTaskRunnerWithShutdownBehavior( 1189 ->GetTaskRunnerWithShutdownBehavior(
1189 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); 1190 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
1190 DCHECK(set_protocol); 1191 DCHECK(set_protocol);
1191 1192
1192 #if defined(ENABLE_EXTENSIONS) 1193 #if BUILDFLAG(ENABLE_EXTENSIONS)
1193 DCHECK(extension_info_map_.get()); 1194 DCHECK(extension_info_map_.get());
1194 // Check only for incognito (and not Chrome OS guest mode GUEST_PROFILE). 1195 // Check only for incognito (and not Chrome OS guest mode GUEST_PROFILE).
1195 bool is_incognito = profile_type() == Profile::INCOGNITO_PROFILE; 1196 bool is_incognito = profile_type() == Profile::INCOGNITO_PROFILE;
1196 set_protocol = job_factory->SetProtocolHandler( 1197 set_protocol = job_factory->SetProtocolHandler(
1197 extensions::kExtensionScheme, 1198 extensions::kExtensionScheme,
1198 extensions::CreateExtensionProtocolHandler(is_incognito, 1199 extensions::CreateExtensionProtocolHandler(is_incognito,
1199 extension_info_map_.get())); 1200 extension_info_map_.get()));
1200 DCHECK(set_protocol); 1201 DCHECK(set_protocol);
1201 set_protocol = job_factory->SetProtocolHandler( 1202 set_protocol = job_factory->SetProtocolHandler(
1202 extensions::kExtensionResourceScheme, 1203 extensions::kExtensionResourceScheme,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 void ProfileIOData::SetCookieSettingsForTesting( 1355 void ProfileIOData::SetCookieSettingsForTesting(
1355 content_settings::CookieSettings* cookie_settings) { 1356 content_settings::CookieSettings* cookie_settings) {
1356 DCHECK(!cookie_settings_.get()); 1357 DCHECK(!cookie_settings_.get());
1357 cookie_settings_ = cookie_settings; 1358 cookie_settings_ = cookie_settings;
1358 } 1359 }
1359 1360
1360 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( 1361 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState(
1361 const GURL& url) const { 1362 const GURL& url) const {
1362 return url_blacklist_manager_->GetURLBlacklistState(url); 1363 return url_blacklist_manager_->GetURLBlacklistState(url);
1363 } 1364 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698