Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PREFS_PREF_METRICS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_ |
| 6 #define CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" | 16 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" |
| 17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
| 18 #include "components/syncable_prefs/synced_pref_change_registrar.h" | 18 #include "components/syncable_prefs/synced_pref_change_registrar.h" |
| 19 | 19 |
| 20 class PrefRegistrySimple; | 20 class PrefRegistrySimple; |
| 21 | 21 |
| 22 // PrefMetricsService is responsible for recording prefs-related UMA stats. | 22 // PrefMetricsService is responsible for recording prefs-related UMA stats. |
| 23 class PrefMetricsService : public KeyedService { | 23 class PrefMetricsService : public KeyedService { |
| 24 public: | 24 public: |
| 25 explicit PrefMetricsService(Profile* profile); | 25 explicit PrefMetricsService(Profile* profile); |
| 26 ~PrefMetricsService() override; | 26 ~PrefMetricsService() override; |
| 27 | 27 |
| 28 // Records metrics about the state of the homepage on launch. On all | |
| 29 // platforms except Android this will be triggered automatically as part of | |
| 30 // initializing the PrefMetricsService. | |
| 31 // | |
| 32 // On Android, determining whether the homepage is enabled requires waiting | |
| 33 // for a response from a third party provider installed on the device. Thus, | |
| 34 // this functionality is exposed to allow it to be called once all the | |
|
Mark P
2016/05/24 19:07:17
nit: extra space
Ted C
2016/05/24 19:55:53
Done.
| |
| 35 // necessary information is available. | |
| 36 static void RecordHomePageLaunchMetrics(bool show_home_button, | |
| 37 bool homepage_is_ntp, | |
| 38 const GURL& homepage_url); | |
| 39 | |
| 28 class Factory : public BrowserContextKeyedServiceFactory { | 40 class Factory : public BrowserContextKeyedServiceFactory { |
| 29 public: | 41 public: |
| 30 static Factory* GetInstance(); | 42 static Factory* GetInstance(); |
| 31 static PrefMetricsService* GetForProfile(Profile* profile); | 43 static PrefMetricsService* GetForProfile(Profile* profile); |
| 32 private: | 44 private: |
| 33 friend struct base::DefaultSingletonTraits<Factory>; | 45 friend struct base::DefaultSingletonTraits<Factory>; |
| 34 | 46 |
| 35 Factory(); | 47 Factory(); |
| 36 ~Factory() override; | 48 ~Factory() override; |
| 37 | 49 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 | 98 |
| 87 std::unique_ptr<syncable_prefs::SyncedPrefChangeRegistrar> | 99 std::unique_ptr<syncable_prefs::SyncedPrefChangeRegistrar> |
| 88 synced_pref_change_registrar_; | 100 synced_pref_change_registrar_; |
| 89 | 101 |
| 90 base::WeakPtrFactory<PrefMetricsService> weak_factory_; | 102 base::WeakPtrFactory<PrefMetricsService> weak_factory_; |
| 91 | 103 |
| 92 DISALLOW_COPY_AND_ASSIGN(PrefMetricsService); | 104 DISALLOW_COPY_AND_ASSIGN(PrefMetricsService); |
| 93 }; | 105 }; |
| 94 | 106 |
| 95 #endif // CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_ | 107 #endif // CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_ |
| OLD | NEW |