Index: chrome/browser/prefs/pref_metrics_service.h |
diff --git a/chrome/browser/prefs/pref_metrics_service.h b/chrome/browser/prefs/pref_metrics_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4b820de92521c83ff56fc8f2fd3eed6dc043b4fe |
--- /dev/null |
+++ b/chrome/browser/prefs/pref_metrics_service.h |
@@ -0,0 +1,44 @@ |
+// Copyright (c) 2013 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_PREFS_PREF_METRICS_SERVICE_H_ |
+#define CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_ |
+ |
+#include "base/memory/singleton.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "components/browser_context_keyed_service/browser_context_keyed_service.h" |
+#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h" |
+ |
+// PrefMetricsService is responsible for recording prefs-related UMA stats. |
+class PrefMetricsService : public BrowserContextKeyedService { |
+ public: |
+ explicit PrefMetricsService(Profile* profile); |
+ virtual ~PrefMetricsService(); |
+ |
+ class Factory : public BrowserContextKeyedServiceFactory { |
+ public: |
+ static Factory* GetInstance(); |
+ static PrefMetricsService* GetForProfile(Profile* profile); |
+ private: |
+ friend struct DefaultSingletonTraits<Factory>; |
+ |
+ Factory(); |
+ virtual ~Factory(); |
+ |
+ // BrowserContextKeyedServiceFactory implementation |
+ virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
+ content::BrowserContext* profile) const OVERRIDE; |
+ virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; |
+ virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; |
+ virtual content::BrowserContext* GetBrowserContextToUse( |
+ content::BrowserContext* context) const OVERRIDE; |
+ }; |
+ private: |
+ // Record prefs state on browser context creation. |
+ void RecordLaunchPrefs(); |
+ |
+ Profile* profile_; |
+}; |
+ |
+#endif // CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_ |