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

Unified Diff: chrome/browser/metrics/chrome_metrics_service_accessor.h

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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/chrome_metrics_service_accessor.h
diff --git a/chrome/browser/metrics/chrome_metrics_service_accessor.h b/chrome/browser/metrics/chrome_metrics_service_accessor.h
new file mode 100644
index 0000000000000000000000000000000000000000..533ef3406f8c70124fa019b23c842278649940ad
--- /dev/null
+++ b/chrome/browser/metrics/chrome_metrics_service_accessor.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_
+#define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_
+
+#include "base/gtest_prod_util.h"
+#include "chrome/browser/metrics/metrics_service_observer.h"
Ilya Sherman 2014/05/20 15:18:11 nit: This file has moved; you'll need to update th
Ilya Sherman 2014/05/20 15:18:11 nit: Can this class be forward-declared, and the #
motek. 2014/05/20 15:54:39 Done.
motek. 2014/05/20 15:54:39 It would appear that it cannot on the account of D
Ilya Sherman 2014/05/20 15:56:44 For that macro, you can "#include base/macros.h" i
+
+class ChromeBrowserMetricsServiceObserver;
+class Profile;
+
+namespace {
+class CrashesDOMHandler;
+class FlashDOMHandler;
+}
+
+namespace extensions {
+class ExtensionDownloader;
+class ManifestFetchData;
+class MetricsPrivateGetIsCrashReportingEnabledFunction;
+}
+
+namespace prerender {
+bool IsOmniboxEnabled(Profile* profile);
+}
+
+namespace system_logs {
+class ChromeInternalLogSource;
+}
+
+// This class limits and documents access to metrics service helper methods.
+// Since these methods are private, each user has to be explicitly declared
+// as a 'friend' below.
+class ChromeMetricsServiceAccessor {
+ private:
+ friend bool prerender::IsOmniboxEnabled(Profile* profile);
+ friend class ::ChromeBrowserMetricsServiceObserver;
+ friend class ChromeRenderMessageFilter;
+ friend class ::CrashesDOMHandler;
+ friend class extensions::ExtensionDownloader;
+ friend class extensions::ManifestFetchData;
+ friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction;
+ friend class ::FlashDOMHandler;
+ friend class system_logs::ChromeInternalLogSource;
+
+ FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest,
+ MetricsReportingEnabled);
+ FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceAccessorTest,
+ CrashReportingEnabled);
+
+ // Returns true if prefs::kMetricsReportingEnabled is set.
+ // TODO(asvitkine): Consolidate the method in MetricsStateManager.
+ // TODO(asvitkine): This function does not report the correct value on
+ // Android and ChromeOS, see http://crbug.com/362192.
+ static bool IsMetricsReportingEnabled();
+
+ // Returns true if crash reporting is enabled. This is set at the platform
+ // level for Android and ChromeOS, and otherwise is the same as
+ // IsMetricsReportingEnabled for desktop Chrome.
+ static bool IsCrashReportingEnabled();
+
+ // Registers/unregisters |observer| to receive MetricsLog notifications
+ // from metrics service.
+ static void AddMetricsServiceObserver(MetricsServiceObserver* observer);
+ static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer);
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeMetricsServiceAccessor);
+};
+
+#endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_ACCESSOR_H_

Powered by Google App Engine
This is Rietveld 408576698