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

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

Issue 287193005: [Metrics] Move non-idle notifications from MetricsService to ChromeMetricsServiceClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: break! 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
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_service_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/chrome_metrics_service_client.h
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.h b/chrome/browser/metrics/chrome_metrics_service_client.h
index 4e11165e718e8a279895f1288e46769f484860a8..9b0c86881102203fea8c28275f1516a028ea93ed 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.h
+++ b/chrome/browser/metrics/chrome_metrics_service_client.h
@@ -8,11 +8,17 @@
#include <string>
#include "base/basictypes.h"
+#include "base/threading/thread_checker.h"
#include "components/metrics/metrics_service_client.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+
+class MetricsService;
// ChromeMetricsServiceClient provides an implementation of MetricsServiceClient
// that depends on chrome/.
-class ChromeMetricsServiceClient : public metrics::MetricsServiceClient {
+class ChromeMetricsServiceClient : public metrics::MetricsServiceClient,
+ public content::NotificationObserver {
public:
ChromeMetricsServiceClient();
virtual ~ChromeMetricsServiceClient();
@@ -25,7 +31,29 @@ class ChromeMetricsServiceClient : public metrics::MetricsServiceClient {
virtual metrics::SystemProfileProto::Channel GetChannel() OVERRIDE;
virtual std::string GetVersionString() OVERRIDE;
+ // Stores a weak pointer to the given |service|.
+ // TODO(isherman): Fix the memory ownership model so that this method is not
+ // needed: http://crbug.com/375248
+ void set_service(MetricsService* service) { service_ = service; }
+
private:
+ // Registers |this| as an observer for notifications which indicate that a
+ // user is performing work. This is useful to allow some features to sleep,
+ // until the machine becomes active, such as precluding UMA uploads unless
+ // there was recent activity.
+ void RegisterForNotifications();
+
+ // content::NotificationObserver:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ // The MetricsService that |this| is a client of. Weak pointer.
+ MetricsService* service_;
+
+ content::NotificationRegistrar registrar_;
+ base::ThreadChecker thread_checker_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient);
};
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698