| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 return base::Bind(&MediaDeviceIDSalt::GetSalt, media_device_id_salt_); | 859 return base::Bind(&MediaDeviceIDSalt::GetSalt, media_device_id_salt_); |
| 860 } | 860 } |
| 861 | 861 |
| 862 bool ProfileIOData::IsOffTheRecord() const { | 862 bool ProfileIOData::IsOffTheRecord() const { |
| 863 return profile_type() == Profile::INCOGNITO_PROFILE | 863 return profile_type() == Profile::INCOGNITO_PROFILE |
| 864 || profile_type() == Profile::GUEST_PROFILE; | 864 || profile_type() == Profile::GUEST_PROFILE; |
| 865 } | 865 } |
| 866 | 866 |
| 867 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { | 867 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { |
| 868 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 868 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 869 #if defined(OS_CHROMEOS) | 869 #if defined(OS_ANDROID) |
| 870 // Just fetch the value from ChromeOS' settings while we're on the UI thread. | |
| 871 // TODO(stevet): For now, this value is only set on profile initialization. | |
| 872 // We will want to do something similar to the PrefMember method below in the | |
| 873 // future to more accurately capture this state. | |
| 874 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | |
| 875 &enable_metrics_); | |
| 876 #elif defined(OS_ANDROID) | |
| 877 // TODO(dwkang): rename or unify the pref for UMA once we have conclusion | 870 // TODO(dwkang): rename or unify the pref for UMA once we have conclusion |
| 878 // in crbugs.com/246495. | 871 // in crbugs.com/246495. |
| 879 // Android has it's own preferences for metrics / crash uploading. | 872 // Android has it's own preferences for metrics / crash uploading. |
| 880 enable_metrics_.Init(prefs::kCrashReportingEnabled, | 873 enable_metrics_.Init(prefs::kCrashReportingEnabled, |
| 881 g_browser_process->local_state()); | 874 g_browser_process->local_state()); |
| 882 enable_metrics_.MoveToThread( | 875 enable_metrics_.MoveToThread( |
| 883 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 876 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 884 #else | 877 #else |
| 885 // Prep the PrefMember and send it to the IO thread, since this value will be | 878 // Prep the PrefMember and send it to the IO thread, since this value will be |
| 886 // read from there. | 879 // read from there. |
| 887 enable_metrics_.Init(metrics::prefs::kMetricsReportingEnabled, | 880 enable_metrics_.Init(metrics::prefs::kMetricsReportingEnabled, |
| 888 g_browser_process->local_state()); | 881 g_browser_process->local_state()); |
| 889 enable_metrics_.MoveToThread( | 882 enable_metrics_.MoveToThread( |
| 890 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 883 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 891 #endif // defined(OS_CHROMEOS) | 884 #endif // defined(OS_ANDROID) |
| 892 } | 885 } |
| 893 | 886 |
| 894 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { | 887 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { |
| 895 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 888 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 896 #if defined(OS_CHROMEOS) | |
| 897 return enable_metrics_; | |
| 898 #else | |
| 899 return enable_metrics_.GetValue(); | 889 return enable_metrics_.GetValue(); |
| 900 #endif // defined(OS_CHROMEOS) | |
| 901 } | 890 } |
| 902 | 891 |
| 903 bool ProfileIOData::IsDataReductionProxyEnabled() const { | 892 bool ProfileIOData::IsDataReductionProxyEnabled() const { |
| 904 return data_reduction_proxy_io_data() && | 893 return data_reduction_proxy_io_data() && |
| 905 data_reduction_proxy_io_data()->IsEnabled(); | 894 data_reduction_proxy_io_data()->IsEnabled(); |
| 906 } | 895 } |
| 907 | 896 |
| 908 void ProfileIOData::set_data_reduction_proxy_io_data( | 897 void ProfileIOData::set_data_reduction_proxy_io_data( |
| 909 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> | 898 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| 910 data_reduction_proxy_io_data) const { | 899 data_reduction_proxy_io_data) const { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 | 1240 |
| 1252 void ProfileIOData::ShutdownOnUIThread( | 1241 void ProfileIOData::ShutdownOnUIThread( |
| 1253 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters) { | 1242 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters) { |
| 1254 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1243 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1255 | 1244 |
| 1256 google_services_user_account_id_.Destroy(); | 1245 google_services_user_account_id_.Destroy(); |
| 1257 enable_referrers_.Destroy(); | 1246 enable_referrers_.Destroy(); |
| 1258 enable_do_not_track_.Destroy(); | 1247 enable_do_not_track_.Destroy(); |
| 1259 force_google_safesearch_.Destroy(); | 1248 force_google_safesearch_.Destroy(); |
| 1260 force_youtube_safety_mode_.Destroy(); | 1249 force_youtube_safety_mode_.Destroy(); |
| 1261 #if !defined(OS_CHROMEOS) | |
| 1262 enable_metrics_.Destroy(); | 1250 enable_metrics_.Destroy(); |
| 1263 #endif | |
| 1264 safe_browsing_enabled_.Destroy(); | 1251 safe_browsing_enabled_.Destroy(); |
| 1265 sync_disabled_.Destroy(); | 1252 sync_disabled_.Destroy(); |
| 1266 signin_allowed_.Destroy(); | 1253 signin_allowed_.Destroy(); |
| 1267 network_prediction_options_.Destroy(); | 1254 network_prediction_options_.Destroy(); |
| 1268 quick_check_enabled_.Destroy(); | 1255 quick_check_enabled_.Destroy(); |
| 1269 if (media_device_id_salt_.get()) | 1256 if (media_device_id_salt_.get()) |
| 1270 media_device_id_salt_->ShutdownOnUIThread(); | 1257 media_device_id_salt_->ShutdownOnUIThread(); |
| 1271 session_startup_pref_.Destroy(); | 1258 session_startup_pref_.Destroy(); |
| 1272 #if defined(ENABLE_CONFIGURATION_POLICY) | 1259 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 1273 if (url_blacklist_manager_) | 1260 if (url_blacklist_manager_) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 make_scoped_ptr(new DevToolsNetworkTransactionFactory( | 1326 make_scoped_ptr(new DevToolsNetworkTransactionFactory( |
| 1340 network_controller_handle_.GetController(), shared_session)), | 1327 network_controller_handle_.GetController(), shared_session)), |
| 1341 backend.Pass(), true /* set_up_quic_server_info */)); | 1328 backend.Pass(), true /* set_up_quic_server_info */)); |
| 1342 } | 1329 } |
| 1343 | 1330 |
| 1344 void ProfileIOData::SetCookieSettingsForTesting( | 1331 void ProfileIOData::SetCookieSettingsForTesting( |
| 1345 content_settings::CookieSettings* cookie_settings) { | 1332 content_settings::CookieSettings* cookie_settings) { |
| 1346 DCHECK(!cookie_settings_.get()); | 1333 DCHECK(!cookie_settings_.get()); |
| 1347 cookie_settings_ = cookie_settings; | 1334 cookie_settings_ = cookie_settings; |
| 1348 } | 1335 } |
| OLD | NEW |