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

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

Issue 2653693004: UKM Sync Observer (Closed)
Patch Set: Suppress recording and fix tests Created 3 years, 10 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_CLIENT_H_ 5 #ifndef CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_
6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ 6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <deque> 10 #include <deque>
11 #include <memory> 11 #include <memory>
12 #include <queue> 12 #include <queue>
13 #include <string> 13 #include <string>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "chrome/browser/metrics/metrics_memory_details.h" 20 #include "chrome/browser/metrics/metrics_memory_details.h"
21 #include "components/metrics/metrics_service_client.h" 21 #include "components/metrics/metrics_service_client.h"
22 #include "components/metrics/profiler/tracking_synchronizer_observer.h" 22 #include "components/metrics/profiler/tracking_synchronizer_observer.h"
23 #include "components/metrics/proto/system_profile.pb.h" 23 #include "components/metrics/proto/system_profile.pb.h"
24 #include "components/omnibox/browser/omnibox_event_global_tracker.h" 24 #include "components/omnibox/browser/omnibox_event_global_tracker.h"
25 #include "components/ukm/observers/history_delete_observer.h" 25 #include "components/ukm/observers/history_delete_observer.h"
26 #include "components/ukm/observers/sync_disable_observer.h"
26 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
27 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
28 #include "ppapi/features/features.h" 29 #include "ppapi/features/features.h"
29 30
30 class AntiVirusMetricsProvider; 31 class AntiVirusMetricsProvider;
31 class ChromeOSMetricsProvider; 32 class ChromeOSMetricsProvider;
32 class GoogleUpdateMetricsProviderWin; 33 class GoogleUpdateMetricsProviderWin;
33 class PluginMetricsProvider; 34 class PluginMetricsProvider;
34 class Profile; 35 class Profile;
35 class PrefRegistrySimple; 36 class PrefRegistrySimple;
36 37
37 namespace browser_watcher { 38 namespace browser_watcher {
38 class WatcherMetricsProviderWin; 39 class WatcherMetricsProviderWin;
39 } // namespace browser_watcher 40 } // namespace browser_watcher
40 41
41 namespace metrics { 42 namespace metrics {
42 class DriveMetricsProvider; 43 class DriveMetricsProvider;
43 class MetricsService; 44 class MetricsService;
44 class MetricsStateManager; 45 class MetricsStateManager;
45 class ProfilerMetricsProvider; 46 class ProfilerMetricsProvider;
46 } // namespace metrics 47 } // namespace metrics
47 48
48 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient 49 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient
49 // that depends on chrome/. 50 // that depends on chrome/.
50 class ChromeMetricsServiceClient : public metrics::MetricsServiceClient, 51 class ChromeMetricsServiceClient : public metrics::MetricsServiceClient,
51 public metrics::TrackingSynchronizerObserver, 52 public metrics::TrackingSynchronizerObserver,
52 public content::NotificationObserver, 53 public content::NotificationObserver,
53 public ukm::HistoryDeleteObserver { 54 public ukm::HistoryDeleteObserver,
55 public ukm::SyncDisableObserver {
54 public: 56 public:
55 ~ChromeMetricsServiceClient() override; 57 ~ChromeMetricsServiceClient() override;
56 58
57 // Factory function. 59 // Factory function.
58 static std::unique_ptr<ChromeMetricsServiceClient> Create( 60 static std::unique_ptr<ChromeMetricsServiceClient> Create(
59 metrics::MetricsStateManager* state_manager); 61 metrics::MetricsStateManager* state_manager);
60 62
61 // Registers local state prefs used by this class. 63 // Registers local state prefs used by this class.
62 static void RegisterPrefs(PrefRegistrySimple* registry); 64 static void RegisterPrefs(PrefRegistrySimple* registry);
63 65
(...skipping 15 matching lines...) Expand all
79 const std::string& server_url, 81 const std::string& server_url,
80 const std::string& mime_type, 82 const std::string& mime_type,
81 const base::Callback<void(int)>& on_upload_complete) override; 83 const base::Callback<void(int)>& on_upload_complete) override;
82 base::TimeDelta GetStandardUploadInterval() override; 84 base::TimeDelta GetStandardUploadInterval() override;
83 base::string16 GetRegistryBackupKey() override; 85 base::string16 GetRegistryBackupKey() override;
84 void OnPluginLoadingError(const base::FilePath& plugin_path) override; 86 void OnPluginLoadingError(const base::FilePath& plugin_path) override;
85 bool IsReportingPolicyManaged() override; 87 bool IsReportingPolicyManaged() override;
86 metrics::EnableMetricsDefault GetMetricsReportingDefaultState() override; 88 metrics::EnableMetricsDefault GetMetricsReportingDefaultState() override;
87 bool IsUMACellularUploadLogicEnabled() override; 89 bool IsUMACellularUploadLogicEnabled() override;
88 90
89 // ukm::HistoryDeleteObserver 91 // ukm::HistoryDeleteObserver:
90 void OnHistoryDeleted() override; 92 void OnHistoryDeleted() override;
91 93
94 // ukm::SyncDisableObserver:
95 void OnSyncPrefsChanged(bool must_purge) override;
96
92 // Persistent browser metrics need to be persisted somewhere. This constant 97 // Persistent browser metrics need to be persisted somewhere. This constant
93 // provides a known string to be used for both the allocator's internal name 98 // provides a known string to be used for both the allocator's internal name
94 // and for a file on disk (relative to chrome::DIR_USER_DATA) to which they 99 // and for a file on disk (relative to chrome::DIR_USER_DATA) to which they
95 // can be saved. 100 // can be saved.
96 static const char kBrowserMetricsName[]; 101 static const char kBrowserMetricsName[];
97 102
98 private: 103 private:
99 explicit ChromeMetricsServiceClient( 104 explicit ChromeMetricsServiceClient(
100 metrics::MetricsStateManager* state_manager); 105 metrics::MetricsStateManager* state_manager);
101 106
(...skipping 25 matching lines...) Expand all
127 132
128 // Records metrics about the switches present on the command line. 133 // Records metrics about the switches present on the command line.
129 void RecordCommandLineMetrics(); 134 void RecordCommandLineMetrics();
130 135
131 // Registers |this| as an observer for notifications which indicate that a 136 // Registers |this| as an observer for notifications which indicate that a
132 // user is performing work. This is useful to allow some features to sleep, 137 // user is performing work. This is useful to allow some features to sleep,
133 // until the machine becomes active, such as precluding UMA uploads unless 138 // until the machine becomes active, such as precluding UMA uploads unless
134 // there was recent activity. 139 // there was recent activity.
135 void RegisterForNotifications(); 140 void RegisterForNotifications();
136 141
137 // Call to listen for history deletions by the selected profile. 142 // Call to listen for events on the selected profile's services.
138 void RegisterForHistoryDeletions(Profile* profile); 143 void RegisterForProfileEvents(Profile* profile);
139 144
140 // content::NotificationObserver: 145 // content::NotificationObserver:
141 void Observe(int type, 146 void Observe(int type,
142 const content::NotificationSource& source, 147 const content::NotificationSource& source,
143 const content::NotificationDetails& details) override; 148 const content::NotificationDetails& details) override;
144 149
145 // Called when a URL is opened from the Omnibox. 150 // Called when a URL is opened from the Omnibox.
146 void OnURLOpenedFromOmnibox(OmniboxLog* log); 151 void OnURLOpenedFromOmnibox(OmniboxLog* log);
147 152
148 #if defined(OS_WIN) 153 #if defined(OS_WIN)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Whether this client has already uploaded profiler data during this session. 235 // Whether this client has already uploaded profiler data during this session.
231 // Profiler data is uploaded at most once per session. 236 // Profiler data is uploaded at most once per session.
232 bool has_uploaded_profiler_data_; 237 bool has_uploaded_profiler_data_;
233 238
234 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_; 239 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_;
235 240
236 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient); 241 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient);
237 }; 242 };
238 243
239 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ 244 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698