| 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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
| 6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
| 7 // | 7 // |
| 8 // OVERVIEW | 8 // OVERVIEW |
| 9 // | 9 // |
| 10 // A MetricsService instance is typically created at application startup. It is | 10 // A MetricsService instance is typically created at application startup. It is |
| (...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 } | 1860 } |
| 1861 | 1861 |
| 1862 #if defined(OS_CHROMEOS) | 1862 #if defined(OS_CHROMEOS) |
| 1863 void MetricsService::StartExternalMetrics() { | 1863 void MetricsService::StartExternalMetrics() { |
| 1864 external_metrics_ = new chromeos::ExternalMetrics; | 1864 external_metrics_ = new chromeos::ExternalMetrics; |
| 1865 external_metrics_->Start(); | 1865 external_metrics_->Start(); |
| 1866 } | 1866 } |
| 1867 #endif | 1867 #endif |
| 1868 | 1868 |
| 1869 bool MetricsService::GzipProtobufsBeforeUploading() { | 1869 bool MetricsService::GzipProtobufsBeforeUploading() { |
| 1870 if (!gzipped_protobufs_trial_) { | 1870 if (!gzipped_protobufs_trial_.get()) { |
| 1871 gzipped_protobufs_trial_ = base::FieldTrialList::FactoryGetFieldTrial( | 1871 gzipped_protobufs_trial_ = base::FieldTrialList::FactoryGetFieldTrial( |
| 1872 kGzippedProtobufsTrialName, | 1872 kGzippedProtobufsTrialName, |
| 1873 kGzippedProtobufsTrialDivisor, | 1873 kGzippedProtobufsTrialDivisor, |
| 1874 kNonGzippedProtobufsGroupName, | 1874 kNonGzippedProtobufsGroupName, |
| 1875 2013, | 1875 2013, |
| 1876 8, | 1876 8, |
| 1877 1, | 1877 1, |
| 1878 NULL); | 1878 NULL); |
| 1879 gzipped_protobufs_group_ = gzipped_protobufs_trial_->AppendGroup( | 1879 gzipped_protobufs_group_ = gzipped_protobufs_trial_->AppendGroup( |
| 1880 kGzippedProtobufsGroupName, | 1880 kGzippedProtobufsGroupName, |
| 1881 kGzippedProtobufsTrialQuotient); | 1881 kGzippedProtobufsTrialQuotient); |
| 1882 } | 1882 } |
| 1883 return gzipped_protobufs_trial_->group() == gzipped_protobufs_group_; | 1883 return gzipped_protobufs_trial_->group() == gzipped_protobufs_group_; |
| 1884 } | 1884 } |
| 1885 | 1885 |
| 1886 // static | 1886 // static |
| 1887 bool MetricsServiceHelper::IsMetricsReportingEnabled() { | 1887 bool MetricsServiceHelper::IsMetricsReportingEnabled() { |
| 1888 bool result = false; | 1888 bool result = false; |
| 1889 const PrefService* local_state = g_browser_process->local_state(); | 1889 const PrefService* local_state = g_browser_process->local_state(); |
| 1890 if (local_state) { | 1890 if (local_state) { |
| 1891 const PrefService::Preference* uma_pref = | 1891 const PrefService::Preference* uma_pref = |
| 1892 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1892 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1893 if (uma_pref) { | 1893 if (uma_pref) { |
| 1894 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1894 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1895 DCHECK(success); | 1895 DCHECK(success); |
| 1896 } | 1896 } |
| 1897 } | 1897 } |
| 1898 return result; | 1898 return result; |
| 1899 } | 1899 } |
| OLD | NEW |