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

Side by Side Diff: chromecast/metrics/cast_metrics_service_client.h

Issue 482813004: Adds CastMetricsServiceClient to Chromecast shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: registers prefs Created 6 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROMECAST_METRICS_CAST_METRICS_SERVICE_CLIENT_H_
6 #define CHROMECAST_METRICS_CAST_METRICS_SERVICE_CLIENT_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "components/metrics/metrics_service_client.h"
14
15 class MetricsService;
16
17 namespace metrics {
18 class MetricsStateManager;
19 } // namespace metrics
20
21 namespace net {
22 class URLRequestContextGetter;
23 } // namespace net
24
25 namespace chromecast {
26 namespace metrics {
27
28 class CastMetricsServiceClient : public ::metrics::MetricsServiceClient {
29 public:
30 virtual ~CastMetricsServiceClient();
31
32 static CastMetricsServiceClient* Create(
33 net::URLRequestContextGetter* request_context);
34
35 // metrics::MetricsServiceClient implementation:
36 virtual void SetMetricsClientId(const std::string& client_id) OVERRIDE;
37 virtual bool IsOffTheRecordSessionActive() OVERRIDE;
38 virtual std::string GetApplicationLocale() OVERRIDE;
39 virtual bool GetBrand(std::string* brand_code) OVERRIDE;
40 virtual ::metrics::SystemProfileProto::Channel GetChannel() OVERRIDE;
41 virtual std::string GetVersionString() OVERRIDE;
42 virtual void OnLogUploadComplete() OVERRIDE;
43 virtual void StartGatheringMetrics(
44 const base::Closure& done_callback) OVERRIDE;
45 virtual void CollectFinalMetrics(const base::Closure& done_callback) OVERRIDE;
46 virtual scoped_ptr< ::metrics::MetricsLogUploader> CreateUploader(
47 const std::string& server_url,
48 const std::string& mime_type,
49 const base::Callback<void(int)>& on_upload_complete) OVERRIDE;
50
51 // Starts/stops the metrics service.
52 void EnableMetricsService(bool enabled);
53
54 private:
55 explicit CastMetricsServiceClient(
56 net::URLRequestContextGetter* request_context);
57
58 // Returns whether or not metrics reporting is enabled.
59 bool IsReportingEnabled();
60
61 scoped_ptr< ::metrics::MetricsStateManager> metrics_state_manager_;
62 scoped_ptr<MetricsService> metrics_service_;
63 net::URLRequestContextGetter* request_context_;
64
65 DISALLOW_COPY_AND_ASSIGN(CastMetricsServiceClient);
66 };
67
68 } // namespace metrics
69 } // namespace chromecast
70
71 #endif // CHROMECAST_METRICS_CAST_METRICS_SERVICE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698