Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: chrome/browser/metrics/metrics_service.cc

Issue 289373007: Rename MetricsServiceHelper to ChromeMetricsServiceAccessor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 1907
1908 RecordPluginChanges(pref); 1908 RecordPluginChanges(pref);
1909 } 1909 }
1910 1910
1911 // static 1911 // static
1912 bool MetricsService::IsPluginProcess(int process_type) { 1912 bool MetricsService::IsPluginProcess(int process_type) {
1913 return (process_type == content::PROCESS_TYPE_PLUGIN || 1913 return (process_type == content::PROCESS_TYPE_PLUGIN ||
1914 process_type == content::PROCESS_TYPE_PPAPI_PLUGIN || 1914 process_type == content::PROCESS_TYPE_PPAPI_PLUGIN ||
1915 process_type == content::PROCESS_TYPE_PPAPI_BROKER); 1915 process_type == content::PROCESS_TYPE_PPAPI_BROKER);
1916 } 1916 }
1917
1918 // static
1919 bool MetricsServiceHelper::IsMetricsReportingEnabled() {
1920 bool result = false;
1921 const PrefService* local_state = g_browser_process->local_state();
1922 if (local_state) {
1923 const PrefService::Preference* uma_pref =
1924 local_state->FindPreference(prefs::kMetricsReportingEnabled);
1925 if (uma_pref) {
1926 bool success = uma_pref->GetValue()->GetAsBoolean(&result);
1927 DCHECK(success);
1928 }
1929 }
1930 return result;
1931 }
1932
1933 bool MetricsServiceHelper::IsCrashReportingEnabled() {
1934 #if defined(GOOGLE_CHROME_BUILD)
1935 #if defined(OS_CHROMEOS)
1936 bool reporting_enabled = false;
1937 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
1938 &reporting_enabled);
1939 return reporting_enabled;
1940 #elif defined(OS_ANDROID)
1941 // Android has its own settings for metrics / crash uploading.
1942 const PrefService* prefs = g_browser_process->local_state();
1943 return prefs->GetBoolean(prefs::kCrashReportingEnabled);
1944 #else
1945 return MetricsServiceHelper::IsMetricsReportingEnabled();
1946 #endif
1947 #else
1948 return false;
1949 #endif
1950 }
1951
1952 void MetricsServiceHelper::AddMetricsServiceObserver(
1953 MetricsServiceObserver* observer) {
1954 MetricsService* metrics_service = g_browser_process->metrics_service();
1955 if (metrics_service)
1956 metrics_service->AddObserver(observer);
1957 }
1958
1959 void MetricsServiceHelper::RemoveMetricsServiceObserver(
1960 MetricsServiceObserver* observer) {
1961 MetricsService* metrics_service = g_browser_process->metrics_service();
1962 if (metrics_service)
1963 metrics_service->RemoveObserver(observer);
1964 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698