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