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

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

Issue 2820163002: Move MediaDeviceIDSalt from ProfileIOData to ProfileImpl. (Closed)
Patch Set: merge Created 3 years, 8 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
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | content/browser/browser_context.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 18 matching lines...) Expand all
29 #include "chrome/browser/chrome_notification_types.h" 29 #include "chrome/browser/chrome_notification_types.h"
30 #include "chrome/browser/content_settings/cookie_settings_factory.h" 30 #include "chrome/browser/content_settings/cookie_settings_factory.h"
31 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 31 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
32 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 32 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
33 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 33 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
34 #include "chrome/browser/devtools/devtools_network_controller.h" 34 #include "chrome/browser/devtools/devtools_network_controller.h"
35 #include "chrome/browser/devtools/devtools_network_transaction_factory.h" 35 #include "chrome/browser/devtools/devtools_network_transaction_factory.h"
36 #include "chrome/browser/download/download_service.h" 36 #include "chrome/browser/download/download_service.h"
37 #include "chrome/browser/download/download_service_factory.h" 37 #include "chrome/browser/download/download_service_factory.h"
38 #include "chrome/browser/io_thread.h" 38 #include "chrome/browser/io_thread.h"
39 #include "chrome/browser/media/media_device_id_salt.h"
40 #include "chrome/browser/net/chrome_http_user_agent_settings.h" 39 #include "chrome/browser/net/chrome_http_user_agent_settings.h"
41 #include "chrome/browser/net/chrome_network_delegate.h" 40 #include "chrome/browser/net/chrome_network_delegate.h"
42 #include "chrome/browser/net/chrome_url_request_context_getter.h" 41 #include "chrome/browser/net/chrome_url_request_context_getter.h"
43 #include "chrome/browser/net/proxy_service_factory.h" 42 #include "chrome/browser/net/proxy_service_factory.h"
44 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" 43 #include "chrome/browser/net/resource_prefetch_predictor_observer.h"
45 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" 44 #include "chrome/browser/policy/cloud/policy_header_service_factory.h"
46 #include "chrome/browser/policy/policy_helpers.h" 45 #include "chrome/browser/policy/policy_helpers.h"
47 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 46 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
48 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" 47 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
49 #include "chrome/browser/profiles/net_http_session_params_observer.h" 48 #include "chrome/browser/profiles/net_http_session_params_observer.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 new ChromeHttpUserAgentSettings(pref_service)); 472 new ChromeHttpUserAgentSettings(pref_service));
474 473
475 // These members are used only for sign in, which is not enabled 474 // These members are used only for sign in, which is not enabled
476 // in incognito mode. So no need to initialize them. 475 // in incognito mode. So no need to initialize them.
477 if (!IsOffTheRecord()) { 476 if (!IsOffTheRecord()) {
478 google_services_user_account_id_.Init( 477 google_services_user_account_id_.Init(
479 prefs::kGoogleServicesUserAccountId, pref_service); 478 prefs::kGoogleServicesUserAccountId, pref_service);
480 google_services_user_account_id_.MoveToThread(io_task_runner); 479 google_services_user_account_id_.MoveToThread(io_task_runner);
481 } 480 }
482 481
483 if (!IsOffTheRecord())
484 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service);
485
486 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, 482 network_prediction_options_.Init(prefs::kNetworkPredictionOptions,
487 pref_service); 483 pref_service);
488 484
489 network_prediction_options_.MoveToThread(io_task_runner); 485 network_prediction_options_.MoveToThread(io_task_runner);
490 486
491 #if defined(OS_CHROMEOS) 487 #if defined(OS_CHROMEOS)
492 std::unique_ptr<policy::PolicyCertVerifier> verifier = 488 std::unique_ptr<policy::PolicyCertVerifier> verifier =
493 policy::PolicyCertServiceFactory::CreateForProfile(profile); 489 policy::PolicyCertServiceFactory::CreateForProfile(profile);
494 policy_cert_verifier_ = verifier.get(); 490 policy_cert_verifier_ = verifier.get();
495 cert_verifier_ = std::move(verifier); 491 cert_verifier_ = std::move(verifier);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 // Allow either Init() or SetCookieSettingsForTesting() to initialize. 846 // Allow either Init() or SetCookieSettingsForTesting() to initialize.
851 DCHECK(initialized_ || cookie_settings_.get()); 847 DCHECK(initialized_ || cookie_settings_.get());
852 return cookie_settings_.get(); 848 return cookie_settings_.get();
853 } 849 }
854 850
855 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const { 851 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const {
856 DCHECK(initialized_); 852 DCHECK(initialized_);
857 return host_content_settings_map_.get(); 853 return host_content_settings_map_.get();
858 } 854 }
859 855
860 std::string ProfileIOData::GetMediaDeviceIDSalt() const {
861 DCHECK(media_device_id_salt_);
862 return media_device_id_salt_->GetSalt();
863 }
864
865 bool ProfileIOData::IsOffTheRecord() const { 856 bool ProfileIOData::IsOffTheRecord() const {
866 return profile_type() == Profile::INCOGNITO_PROFILE 857 return profile_type() == Profile::INCOGNITO_PROFILE
867 || profile_type() == Profile::GUEST_PROFILE; 858 || profile_type() == Profile::GUEST_PROFILE;
868 } 859 }
869 860
870 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { 861 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() {
871 DCHECK_CURRENTLY_ON(BrowserThread::UI); 862 DCHECK_CURRENTLY_ON(BrowserThread::UI);
872 // Prep the PrefMember and send it to the IO thread, since this value will be 863 // Prep the PrefMember and send it to the IO thread, since this value will be
873 // read from there. 864 // read from there.
874 enable_metrics_.Init(metrics::prefs::kMetricsReportingEnabled, 865 enable_metrics_.Init(metrics::prefs::kMetricsReportingEnabled,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 DCHECK(io_data_->initialized_); 943 DCHECK(io_data_->initialized_);
953 return host_resolver_; 944 return host_resolver_;
954 } 945 }
955 946
956 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() { 947 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() {
957 DCHECK_CURRENTLY_ON(BrowserThread::IO); 948 DCHECK_CURRENTLY_ON(BrowserThread::IO);
958 DCHECK(io_data_->initialized_); 949 DCHECK(io_data_->initialized_);
959 return request_context_; 950 return request_context_;
960 } 951 }
961 952
962 std::string ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() {
963 if (io_data_->HasMediaDeviceIDSalt())
964 return io_data_->GetMediaDeviceIDSalt();
965
966 return content::ResourceContext::GetMediaDeviceIDSalt();
967 }
968
969 void ProfileIOData::Init( 953 void ProfileIOData::Init(
970 content::ProtocolHandlerMap* protocol_handlers, 954 content::ProtocolHandlerMap* protocol_handlers,
971 content::URLRequestInterceptorScopedVector request_interceptors) const { 955 content::URLRequestInterceptorScopedVector request_interceptors) const {
972 // The basic logic is implemented here. The specific initialization 956 // The basic logic is implemented here. The specific initialization
973 // is done in InitializeInternal(), implemented by subtypes. Static helper 957 // is done in InitializeInternal(), implemented by subtypes. Static helper
974 // functions have been provided to assist in common operations. 958 // functions have been provided to assist in common operations.
975 DCHECK_CURRENTLY_ON(BrowserThread::IO); 959 DCHECK_CURRENTLY_ON(BrowserThread::IO);
976 DCHECK(!initialized_); 960 DCHECK(!initialized_);
977 DCHECK(profile_params_.get()); 961 DCHECK(profile_params_.get());
978 962
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 1203
1220 google_services_user_account_id_.Destroy(); 1204 google_services_user_account_id_.Destroy();
1221 enable_referrers_.Destroy(); 1205 enable_referrers_.Destroy();
1222 enable_do_not_track_.Destroy(); 1206 enable_do_not_track_.Destroy();
1223 force_google_safesearch_.Destroy(); 1207 force_google_safesearch_.Destroy();
1224 force_youtube_restrict_.Destroy(); 1208 force_youtube_restrict_.Destroy();
1225 allowed_domains_for_apps_.Destroy(); 1209 allowed_domains_for_apps_.Destroy();
1226 enable_metrics_.Destroy(); 1210 enable_metrics_.Destroy();
1227 safe_browsing_enabled_.Destroy(); 1211 safe_browsing_enabled_.Destroy();
1228 network_prediction_options_.Destroy(); 1212 network_prediction_options_.Destroy();
1229 if (media_device_id_salt_.get())
1230 media_device_id_salt_->ShutdownOnUIThread();
1231 if (url_blacklist_manager_) 1213 if (url_blacklist_manager_)
1232 url_blacklist_manager_->ShutdownOnUIThread(); 1214 url_blacklist_manager_->ShutdownOnUIThread();
1233 if (ct_policy_manager_) 1215 if (ct_policy_manager_)
1234 ct_policy_manager_->Shutdown(); 1216 ct_policy_manager_->Shutdown();
1235 if (chrome_http_user_agent_settings_) 1217 if (chrome_http_user_agent_settings_)
1236 chrome_http_user_agent_settings_->CleanupOnUIThread(); 1218 chrome_http_user_agent_settings_->CleanupOnUIThread();
1237 incognito_availibility_pref_.Destroy(); 1219 incognito_availibility_pref_.Destroy();
1238 net_http_session_params_observer_.reset(); 1220 net_http_session_params_observer_.reset();
1239 1221
1240 if (!context_getters->empty()) { 1222 if (!context_getters->empty()) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 void ProfileIOData::SetCookieSettingsForTesting( 1292 void ProfileIOData::SetCookieSettingsForTesting(
1311 content_settings::CookieSettings* cookie_settings) { 1293 content_settings::CookieSettings* cookie_settings) {
1312 DCHECK(!cookie_settings_.get()); 1294 DCHECK(!cookie_settings_.get());
1313 cookie_settings_ = cookie_settings; 1295 cookie_settings_ = cookie_settings;
1314 } 1296 }
1315 1297
1316 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( 1298 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState(
1317 const GURL& url) const { 1299 const GURL& url) const {
1318 return url_blacklist_manager_->GetURLBlacklistState(url); 1300 return url_blacklist_manager_->GetURLBlacklistState(url);
1319 } 1301 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | content/browser/browser_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698