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