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

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

Issue 2887133003: predictors: Refactor resource_prefetch_predictor triggering. (Closed)
Patch Set: . Created 3 years, 7 months 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
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 20 matching lines...) Expand all
31 #include "chrome/browser/content_settings/cookie_settings_factory.h" 31 #include "chrome/browser/content_settings/cookie_settings_factory.h"
32 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 32 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
33 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 33 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
34 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 34 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
35 #include "chrome/browser/devtools/devtools_network_controller.h" 35 #include "chrome/browser/devtools/devtools_network_controller.h"
36 #include "chrome/browser/devtools/devtools_network_transaction_factory.h" 36 #include "chrome/browser/devtools/devtools_network_transaction_factory.h"
37 #include "chrome/browser/io_thread.h" 37 #include "chrome/browser/io_thread.h"
38 #include "chrome/browser/net/chrome_http_user_agent_settings.h" 38 #include "chrome/browser/net/chrome_http_user_agent_settings.h"
39 #include "chrome/browser/net/chrome_network_delegate.h" 39 #include "chrome/browser/net/chrome_network_delegate.h"
40 #include "chrome/browser/net/chrome_url_request_context_getter.h" 40 #include "chrome/browser/net/chrome_url_request_context_getter.h"
41 #include "chrome/browser/net/loading_predictor_observer.h"
41 #include "chrome/browser/net/proxy_service_factory.h" 42 #include "chrome/browser/net/proxy_service_factory.h"
42 #include "chrome/browser/net/resource_prefetch_predictor_observer.h"
43 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" 43 #include "chrome/browser/policy/cloud/policy_header_service_factory.h"
44 #include "chrome/browser/policy/policy_helpers.h" 44 #include "chrome/browser/policy/policy_helpers.h"
45 #include "chrome/browser/predictors/loading_predictor.h" 45 #include "chrome/browser/predictors/loading_predictor.h"
46 #include "chrome/browser/predictors/loading_predictor_factory.h" 46 #include "chrome/browser/predictors/loading_predictor_factory.h"
47 #include "chrome/browser/profiles/net_http_session_params_observer.h" 47 #include "chrome/browser/profiles/net_http_session_params_observer.h"
48 #include "chrome/browser/profiles/profile.h" 48 #include "chrome/browser/profiles/profile.h"
49 #include "chrome/browser/profiles/profile_manager.h" 49 #include "chrome/browser/profiles/profile_manager.h"
50 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" 50 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h"
51 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" 51 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h"
52 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" 52 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 params->ssl_config_service = profile->GetSSLConfigService(); 385 params->ssl_config_service = profile->GetSSLConfigService();
386 386
387 #if BUILDFLAG(ENABLE_EXTENSIONS) 387 #if BUILDFLAG(ENABLE_EXTENSIONS)
388 params->extension_info_map = 388 params->extension_info_map =
389 extensions::ExtensionSystem::Get(profile)->info_map(); 389 extensions::ExtensionSystem::Get(profile)->info_map();
390 params->cookie_monster_delegate = new ExtensionCookieMonsterDelegate(profile); 390 params->cookie_monster_delegate = new ExtensionCookieMonsterDelegate(profile);
391 #endif 391 #endif
392 392
393 if (auto* loading_predictor = 393 if (auto* loading_predictor =
394 predictors::LoadingPredictorFactory::GetForProfile(profile)) { 394 predictors::LoadingPredictorFactory::GetForProfile(profile)) {
395 resource_prefetch_predictor_observer_.reset( 395 loading_predictor_observer_ =
396 new chrome_browser_net::ResourcePrefetchPredictorObserver( 396 base::MakeUnique<chrome_browser_net::LoadingPredictorObserver>(
397 loading_predictor->resource_prefetch_predictor())); 397 loading_predictor);
398 } 398 }
399 399
400 ProtocolHandlerRegistry* protocol_handler_registry = 400 ProtocolHandlerRegistry* protocol_handler_registry =
401 ProtocolHandlerRegistryFactory::GetForBrowserContext(profile); 401 ProtocolHandlerRegistryFactory::GetForBrowserContext(profile);
402 DCHECK(protocol_handler_registry); 402 DCHECK(protocol_handler_registry);
403 403
404 // The profile instance is only available here in the InitializeOnUIThread 404 // The profile instance is only available here in the InitializeOnUIThread
405 // method, so we create the url job factory here, then save it for 405 // method, so we create the url job factory here, then save it for
406 // later delivery to the job factory in Init(). 406 // later delivery to the job factory in Init().
407 params->protocol_handler_interceptor = 407 params->protocol_handler_interceptor =
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 // Take ownership over these parameters. 1094 // Take ownership over these parameters.
1095 cookie_settings_ = profile_params_->cookie_settings; 1095 cookie_settings_ = profile_params_->cookie_settings;
1096 host_content_settings_map_ = profile_params_->host_content_settings_map; 1096 host_content_settings_map_ = profile_params_->host_content_settings_map;
1097 #if BUILDFLAG(ENABLE_EXTENSIONS) 1097 #if BUILDFLAG(ENABLE_EXTENSIONS)
1098 extension_info_map_ = profile_params_->extension_info_map; 1098 extension_info_map_ = profile_params_->extension_info_map;
1099 #endif 1099 #endif
1100 1100
1101 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); 1101 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get();
1102 resource_context_->request_context_ = main_request_context_.get(); 1102 resource_context_->request_context_ = main_request_context_.get();
1103 1103
1104 if (profile_params_->resource_prefetch_predictor_observer_) { 1104 if (profile_params_->loading_predictor_observer_) {
1105 resource_prefetch_predictor_observer_.reset( 1105 loading_predictor_observer_ =
1106 profile_params_->resource_prefetch_predictor_observer_.release()); 1106 std::move(profile_params_->loading_predictor_observer_);
1107 } 1107 }
1108 1108
1109 #if defined(OS_CHROMEOS) 1109 #if defined(OS_CHROMEOS)
1110 username_hash_ = profile_params_->username_hash; 1110 username_hash_ = profile_params_->username_hash;
1111 use_system_key_slot_ = profile_params_->use_system_key_slot; 1111 use_system_key_slot_ = profile_params_->use_system_key_slot;
1112 if (use_system_key_slot_) 1112 if (use_system_key_slot_)
1113 EnableNSSSystemKeySlotForResourceContext(resource_context_.get()); 1113 EnableNSSSystemKeySlotForResourceContext(resource_context_.get());
1114 1114
1115 certificate_provider_ = std::move(profile_params_->certificate_provider); 1115 certificate_provider_ = std::move(profile_params_->certificate_provider);
1116 #endif 1116 #endif
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 void ProfileIOData::SetCookieSettingsForTesting( 1355 void ProfileIOData::SetCookieSettingsForTesting(
1356 content_settings::CookieSettings* cookie_settings) { 1356 content_settings::CookieSettings* cookie_settings) {
1357 DCHECK(!cookie_settings_.get()); 1357 DCHECK(!cookie_settings_.get());
1358 cookie_settings_ = cookie_settings; 1358 cookie_settings_ = cookie_settings;
1359 } 1359 }
1360 1360
1361 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( 1361 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState(
1362 const GURL& url) const { 1362 const GURL& url) const {
1363 return url_blacklist_manager_->GetURLBlacklistState(url); 1363 return url_blacklist_manager_->GetURLBlacklistState(url);
1364 } 1364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698