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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 network_controller_handle_.GetController(), shared_session), | 1337 network_controller_handle_.GetController(), shared_session), |
1349 shared_session->net_log(), backend, | 1338 shared_session->net_log(), backend, |
1350 true /* set_up_quic_server_info */)); | 1339 true /* set_up_quic_server_info */)); |
1351 } | 1340 } |
1352 | 1341 |
1353 void ProfileIOData::SetCookieSettingsForTesting( | 1342 void ProfileIOData::SetCookieSettingsForTesting( |
1354 content_settings::CookieSettings* cookie_settings) { | 1343 content_settings::CookieSettings* cookie_settings) { |
1355 DCHECK(!cookie_settings_.get()); | 1344 DCHECK(!cookie_settings_.get()); |
1356 cookie_settings_ = cookie_settings; | 1345 cookie_settings_ = cookie_settings; |
1357 } | 1346 } |
OLD | NEW |