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

Side by Side Diff: blimp/engine/app/blimp_metrics_service_client.h

Issue 1945393002: Create and integrate a metrics service client into Blimp engine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Follow up on comments. Created 4 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
« no previous file with comments | « blimp/engine/DEPS ('k') | blimp/engine/app/blimp_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
(Empty)
1 // Copyright 2016 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 BLIMP_ENGINE_APP_BLIMP_METRICS_SERVICE_CLIENT_H_
6 #define BLIMP_ENGINE_APP_BLIMP_METRICS_SERVICE_CLIENT_H_
7
8 #include <stdint.h>
9
10 #include <string>
11
12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h"
14 #include "components/metrics/metrics_service_client.h"
15
16 class PrefService;
17
18 namespace metrics {
19 class MetricsService;
20 class MetricsStateManager;
21 class SystemProfileProto;
22 }
23
24 namespace net {
25 class URLRequestContextGetter;
26 } // namespace net
27
28 namespace blimp {
29 namespace engine {
30
31 // BlimpMetricsServiceClient provides an implementation of MetricsServiceClient
32 // tailored for the Blimp engine to support the upload of metrics information
33 // from the engine.
34 // Metrics are always turned on.
35 class BlimpMetricsServiceClient : public metrics::MetricsServiceClient {
36 public:
37 // PrefService ownership is retained by the caller.
38 // The request_context_getter is a system request context.
39 // Both must remain valid for client lifetime.
40 BlimpMetricsServiceClient(
41 PrefService* pref_service,
42 scoped_refptr<net::URLRequestContextGetter> request_context_getter);
43 ~BlimpMetricsServiceClient() override;
44
45 // metrics::MetricsServiceClient implementation.
46 metrics::MetricsService* GetMetricsService() override;
47 void SetMetricsClientId(const std::string& client_id) override;
48 void OnRecordingDisabled() override;
49 bool IsOffTheRecordSessionActive() override;
50 int32_t GetProduct() override;
51 std::string GetApplicationLocale() override;
52 bool GetBrand(std::string* brand_code) override;
53 metrics::SystemProfileProto::Channel GetChannel() override;
54 std::string GetVersionString() override;
55 void OnLogUploadComplete() override;
56 void InitializeSystemProfileMetrics(
57 const base::Closure& done_callback) override;
58 void CollectFinalMetricsForLog(const base::Closure& done_callback) override;
59 std::unique_ptr<metrics::MetricsLogUploader> CreateUploader(
60 const base::Callback<void(int)>& on_upload_complete) override;
61 base::TimeDelta GetStandardUploadInterval() override;
62 metrics::MetricsServiceClient::EnableMetricsDefault GetDefaultOptIn()
63 override;
64
65 private:
66 // Used by NetMetricsLogUploader to create log-upload requests.
67 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
68
69 std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager_;
70 std::unique_ptr<metrics::MetricsService> metrics_service_;
71
72 DISALLOW_COPY_AND_ASSIGN(BlimpMetricsServiceClient);
73 };
74
75 } // namespace engine
76 } // namespace blimp
77
78 #endif // BLIMP_ENGINE_APP_BLIMP_METRICS_SERVICE_CLIENT_H_
OLDNEW
« no previous file with comments | « blimp/engine/DEPS ('k') | blimp/engine/app/blimp_metrics_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698