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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_service_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/threading/thread_checker.h"
11 #include "components/metrics/metrics_service_client.h" 12 #include "components/metrics/metrics_service_client.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15
16 class MetricsService;
12 17
13 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient 18 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient
14 // that depends on chrome/. 19 // that depends on chrome/.
15 class ChromeMetricsServiceClient : public metrics::MetricsServiceClient { 20 class ChromeMetricsServiceClient : public metrics::MetricsServiceClient,
21 public content::NotificationObserver {
16 public: 22 public:
17 ChromeMetricsServiceClient(); 23 ChromeMetricsServiceClient();
18 virtual ~ChromeMetricsServiceClient(); 24 virtual ~ChromeMetricsServiceClient();
19 25
20 // metrics::MetricsServiceClient: 26 // metrics::MetricsServiceClient:
21 virtual void SetClientID(const std::string& client_id) OVERRIDE; 27 virtual void SetClientID(const std::string& client_id) OVERRIDE;
22 virtual bool IsOffTheRecordSessionActive() OVERRIDE; 28 virtual bool IsOffTheRecordSessionActive() OVERRIDE;
23 virtual std::string GetApplicationLocale() OVERRIDE; 29 virtual std::string GetApplicationLocale() OVERRIDE;
24 virtual bool GetBrand(std::string* brand_code) OVERRIDE; 30 virtual bool GetBrand(std::string* brand_code) OVERRIDE;
25 virtual metrics::SystemProfileProto::Channel GetChannel() OVERRIDE; 31 virtual metrics::SystemProfileProto::Channel GetChannel() OVERRIDE;
26 virtual std::string GetVersionString() OVERRIDE; 32 virtual std::string GetVersionString() OVERRIDE;
27 33
34 // Stores a weak pointer to the given |service|.
35 // TODO(isherman): Fix the memory ownership model so that this method is not
36 // needed: http://crbug.com/375248
37 void set_service(MetricsService* service) { service_ = service; }
38
28 private: 39 private:
40 // Registers |this| as an observer for notifications which indicate that a
41 // user is performing work. This is useful to allow some features to sleep,
42 // until the machine becomes active, such as precluding UMA uploads unless
43 // there was recent activity.
44 void RegisterForNotifications();
45
46 // content::NotificationObserver:
47 virtual void Observe(int type,
48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) OVERRIDE;
50
51 // The MetricsService that |this| is a client of. Weak pointer.
52 MetricsService* service_;
53
54 content::NotificationRegistrar registrar_;
55 base::ThreadChecker thread_checker_;
56
29 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient); 57 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient);
30 }; 58 };
31 59
32 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ 60 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_
OLDNEW
« 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