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

Side by Side Diff: chrome/browser/metrics/chrome_metrics_service_accessor.h

Issue 506663003: Consolidates accessing and setting the UMA pref to be within metrics code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android check removed Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ 5 #ifndef CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_
6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ 6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "chrome/browser/metrics/metrics_reporting_state.h"
13 #include "chrome/browser/metrics/metrics_service_accessor.h" 14 #include "chrome/browser/metrics/metrics_service_accessor.h"
14 15
15 class PrefService; 16 class PrefService;
16 class Profile; 17 class Profile;
17 18
18 namespace { 19 namespace {
19 class CrashesDOMHandler; 20 class CrashesDOMHandler;
20 class FlashDOMHandler; 21 class FlashDOMHandler;
21 } 22 }
22 23
(...skipping 10 matching lines...) Expand all
33 } 34 }
34 35
35 namespace prerender { 36 namespace prerender {
36 bool IsOmniboxEnabled(Profile* profile); 37 bool IsOmniboxEnabled(Profile* profile);
37 } 38 }
38 39
39 namespace system_logs { 40 namespace system_logs {
40 class ChromeInternalLogSource; 41 class ChromeInternalLogSource;
41 } 42 }
42 43
44 namespace options {
45 class BrowserOptionsHandler;
46 }
47
43 // This class limits and documents access to metrics service helper methods. 48 // This class limits and documents access to metrics service helper methods.
44 // Since these methods are private, each user has to be explicitly declared 49 // Since these methods are private, each user has to be explicitly declared
45 // as a 'friend' below. 50 // as a 'friend' below.
46 class ChromeMetricsServiceAccessor : public MetricsServiceAccessor { 51 class ChromeMetricsServiceAccessor : public MetricsServiceAccessor {
47 private: 52 private:
48 friend void component_updater::RegisterSwReporterComponent( 53 friend void component_updater::RegisterSwReporterComponent(
49 component_updater::ComponentUpdateService* cus, 54 component_updater::ComponentUpdateService* cus,
50 PrefService* prefs); 55 PrefService* prefs);
51 friend bool prerender::IsOmniboxEnabled(Profile* profile); 56 friend bool prerender::IsOmniboxEnabled(Profile* profile);
52 friend class ChromeRenderMessageFilter; 57 friend class ChromeRenderMessageFilter;
53 friend class ::CrashesDOMHandler; 58 friend class ::CrashesDOMHandler;
54 friend class DataReductionProxyChromeSettings; 59 friend class DataReductionProxyChromeSettings;
55 friend class extensions::ExtensionDownloader; 60 friend class extensions::ExtensionDownloader;
56 friend class extensions::ManifestFetchData; 61 friend class extensions::ManifestFetchData;
57 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction; 62 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction;
58 friend class ::FlashDOMHandler; 63 friend class ::FlashDOMHandler;
59 friend class system_logs::ChromeInternalLogSource; 64 friend class system_logs::ChromeInternalLogSource;
60 friend class UmaSessionStats; 65 friend class UmaSessionStats;
66 friend class options::BrowserOptionsHandler;
67 friend void InitiateMetricsReportingChange(
68 bool, const OnMetricsReportingCallbackType&);
61 69
62 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, 70 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest,
63 MetricsReportingEnabled); 71 MetricsReportingEnabled);
64 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest, 72 FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest,
65 CrashReportingEnabled); 73 CrashReportingEnabled);
66 74
67 // Returns true if prefs::kMetricsReportingEnabled is set. 75 // Returns true if prefs::kMetricsReportingEnabled is set.
68 // TODO(asvitkine): Consolidate the method in MetricsStateManager. 76 // TODO(asvitkine): Consolidate the method in MetricsStateManager.
69 // TODO(asvitkine): This function does not report the correct value on 77 // TODO(asvitkine): This function does not report the correct value on
70 // Android and ChromeOS, see http://crbug.com/362192. 78 // Android and ChromeOS, see http://crbug.com/362192.
(...skipping 17 matching lines...) Expand all
88 // Same as RegisterSyntheticFieldTrial above, but takes a hash for the trial 96 // Same as RegisterSyntheticFieldTrial above, but takes a hash for the trial
89 // name, rather than computing it from the string. 97 // name, rather than computing it from the string.
90 static bool RegisterSyntheticFieldTrialWithNameHash( 98 static bool RegisterSyntheticFieldTrialWithNameHash(
91 uint32_t trial_name_hash, 99 uint32_t trial_name_hash,
92 const std::string& group_name); 100 const std::string& group_name);
93 101
94 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor); 102 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor);
95 }; 103 };
96 104
97 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_ 105 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/device_settings_provider.cc ('k') | chrome/browser/metrics/metrics_reporting_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698