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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 prefs::kGoogleServicesUserAccountId, pref_service); | 492 prefs::kGoogleServicesUserAccountId, pref_service); |
493 google_services_user_account_id_.MoveToThread(io_task_runner); | 493 google_services_user_account_id_.MoveToThread(io_task_runner); |
494 | 494 |
495 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); | 495 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); |
496 sync_disabled_.MoveToThread(io_task_runner); | 496 sync_disabled_.MoveToThread(io_task_runner); |
497 | 497 |
498 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); | 498 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); |
499 signin_allowed_.MoveToThread(io_task_runner); | 499 signin_allowed_.MoveToThread(io_task_runner); |
500 } | 500 } |
501 | 501 |
502 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, IsOffTheRecord()); | 502 if (!IsOffTheRecord()) |
| 503 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service); |
503 | 504 |
504 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, | 505 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, |
505 pref_service); | 506 pref_service); |
506 | 507 |
507 network_prediction_options_.MoveToThread(io_task_runner); | 508 network_prediction_options_.MoveToThread(io_task_runner); |
508 | 509 |
509 #if defined(OS_CHROMEOS) | 510 #if defined(OS_CHROMEOS) |
510 std::unique_ptr<policy::PolicyCertVerifier> verifier = | 511 std::unique_ptr<policy::PolicyCertVerifier> verifier = |
511 policy::PolicyCertServiceFactory::CreateForProfile(profile); | 512 policy::PolicyCertServiceFactory::CreateForProfile(profile); |
512 policy_cert_verifier_ = verifier.get(); | 513 policy_cert_verifier_ = verifier.get(); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 // Allow either Init() or SetCookieSettingsForTesting() to initialize. | 859 // Allow either Init() or SetCookieSettingsForTesting() to initialize. |
859 DCHECK(initialized_ || cookie_settings_.get()); | 860 DCHECK(initialized_ || cookie_settings_.get()); |
860 return cookie_settings_.get(); | 861 return cookie_settings_.get(); |
861 } | 862 } |
862 | 863 |
863 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const { | 864 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const { |
864 DCHECK(initialized_); | 865 DCHECK(initialized_); |
865 return host_content_settings_map_.get(); | 866 return host_content_settings_map_.get(); |
866 } | 867 } |
867 | 868 |
868 ResourceContext::SaltCallback ProfileIOData::GetMediaDeviceIDSalt() const { | 869 std::string ProfileIOData::GetMediaDeviceIDSalt() const { |
869 return base::Bind(&MediaDeviceIDSalt::GetSalt, media_device_id_salt_); | 870 DCHECK(media_device_id_salt_); |
| 871 return media_device_id_salt_->GetSalt(); |
870 } | 872 } |
871 | 873 |
872 bool ProfileIOData::IsOffTheRecord() const { | 874 bool ProfileIOData::IsOffTheRecord() const { |
873 return profile_type() == Profile::INCOGNITO_PROFILE | 875 return profile_type() == Profile::INCOGNITO_PROFILE |
874 || profile_type() == Profile::GUEST_PROFILE; | 876 || profile_type() == Profile::GUEST_PROFILE; |
875 } | 877 } |
876 | 878 |
877 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { | 879 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { |
878 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 880 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
879 #if BUILDFLAG(ANDROID_JAVA_UI) | 881 #if BUILDFLAG(ANDROID_JAVA_UI) |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 chrome::kCryptoModulePasswordKeygen, | 998 chrome::kCryptoModulePasswordKeygen, |
997 net::HostPortPair::FromURL(url), | 999 net::HostPortPair::FromURL(url), |
998 this, | 1000 this, |
999 got_delegate_callback); | 1001 got_delegate_callback); |
1000 #else | 1002 #else |
1001 callback.Run(base::WrapUnique( | 1003 callback.Run(base::WrapUnique( |
1002 new net::KeygenHandler(key_size_in_bits, challenge_string, url))); | 1004 new net::KeygenHandler(key_size_in_bits, challenge_string, url))); |
1003 #endif | 1005 #endif |
1004 } | 1006 } |
1005 | 1007 |
1006 ResourceContext::SaltCallback | 1008 std::string ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() { |
1007 ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() { | 1009 if (io_data_->HasMediaDeviceIDSalt()) |
1008 return io_data_->GetMediaDeviceIDSalt(); | 1010 return io_data_->GetMediaDeviceIDSalt(); |
| 1011 |
| 1012 return content::ResourceContext::GetMediaDeviceIDSalt(); |
1009 } | 1013 } |
1010 | 1014 |
1011 void ProfileIOData::Init( | 1015 void ProfileIOData::Init( |
1012 content::ProtocolHandlerMap* protocol_handlers, | 1016 content::ProtocolHandlerMap* protocol_handlers, |
1013 content::URLRequestInterceptorScopedVector request_interceptors) const { | 1017 content::URLRequestInterceptorScopedVector request_interceptors) const { |
1014 // The basic logic is implemented here. The specific initialization | 1018 // The basic logic is implemented here. The specific initialization |
1015 // is done in InitializeInternal(), implemented by subtypes. Static helper | 1019 // is done in InitializeInternal(), implemented by subtypes. Static helper |
1016 // functions have been provided to assist in common operations. | 1020 // functions have been provided to assist in common operations. |
1017 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1021 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1018 DCHECK(!initialized_); | 1022 DCHECK(!initialized_); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 void ProfileIOData::SetCookieSettingsForTesting( | 1359 void ProfileIOData::SetCookieSettingsForTesting( |
1356 content_settings::CookieSettings* cookie_settings) { | 1360 content_settings::CookieSettings* cookie_settings) { |
1357 DCHECK(!cookie_settings_.get()); | 1361 DCHECK(!cookie_settings_.get()); |
1358 cookie_settings_ = cookie_settings; | 1362 cookie_settings_ = cookie_settings; |
1359 } | 1363 } |
1360 | 1364 |
1361 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( | 1365 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( |
1362 const GURL& url) const { | 1366 const GURL& url) const { |
1363 return url_blacklist_manager_->GetURLBlacklistState(url); | 1367 return url_blacklist_manager_->GetURLBlacklistState(url); |
1364 } | 1368 } |
OLD | NEW |