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

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

Issue 1885673003: Create and integrate a metrics service client into Blimp engine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean ups from initial reviews. 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
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/lazy_instance.h"
13 #include "base/macros.h"
14 #include "components/metrics/metrics_service_client.h"
15
16 class PrefService;
17
18 namespace metrics {
19 struct ClientInfo;
20 class MetricsStateManager;
21 } // namespace metrics
22
23 namespace net {
24 class URLRequestContextGetter;
25 }
26
27 namespace blimp {
28 namespace engine {
29
30 // BlimpMetricsServiceClient provides an implementation of MetricsServiceClient
31 // that depends on blimp. This singleton manages metrics for an app.
32 // Metrics are always turned on. This class should always be used on the main
33 // thread because MetricsService is single-threaded.
34 // Based on AwMetricsServiceClient.
Wez 2016/04/26 01:38:19 This comment is somewhat cryptic, IMO! - It's not
Jess 2016/04/26 21:24:11 Inlining since various sub points require own resp
35 class BlimpMetricsServiceClient : public metrics::MetricsServiceClient {
36 friend struct base::DefaultLazyInstanceTraits<BlimpMetricsServiceClient>;
37 public:
38 static BlimpMetricsServiceClient* GetInstance();
Wez 2016/04/26 01:38:18 Document this API - e.g. does it return a process-
Jess 2016/04/26 21:24:10 I see what you mean about moving the class definit
39
40 void Initialize(PrefService* pref_service,
41 net::URLRequestContextGetter* request_context);
42 void Finalize();
43
44 // metrics::MetricsServiceClient implementation:
Wez 2016/04/26 01:38:18 nit: End comment with . not :
Jess 2016/04/26 21:24:11 Done.
45 metrics::MetricsService* GetMetricsService() override;
46 void SetMetricsClientId(const std::string& client_id) override;
47 void OnRecordingDisabled() override;
48 bool IsOffTheRecordSessionActive() override;
49 int32_t GetProduct() override;
50 std::string GetApplicationLocale() override;
51 bool GetBrand(std::string* brand_code) override;
52 metrics::SystemProfileProto::Channel GetChannel() override;
53 std::string GetVersionString() override;
54 void OnLogUploadComplete() override;
55 void InitializeSystemProfileMetrics(
56 const base::Closure& done_callback) override;
57 void CollectFinalMetricsForLog(const base::Closure& done_callback) override;
58 std::unique_ptr<metrics::MetricsLogUploader> CreateUploader(
59 const base::Callback<void(int)>& on_upload_complete) override;
60 base::TimeDelta GetStandardUploadInterval() override;
61
62 private:
63 BlimpMetricsServiceClient();
64 ~BlimpMetricsServiceClient() override;
65
66 bool is_initialized_;
Wez 2016/04/26 01:38:19 Suggest initializing this and other POD members in
Jess 2016/04/26 21:24:11 Done.
67 PrefService* pref_service_;
68 // URLRequestContextGetter* that remains valid for class lifetime for use by
69 // NetMetricsLogUploader in place of
70 // g_browser_process->system_request_context()
Wez 2016/04/26 01:38:18 I'd suggest replacing this entire comment with jus
Jess 2016/04/26 21:24:11 Done.
71 // In engine use subclass BlimpURLRequestContextGetter.
Wez 2016/04/26 01:38:18 If this detail is important for the caller to know
Jess 2016/04/26 21:24:11 Done.
72 // Member of g/e/common/blimp_browser_context.
Wez 2016/04/26 01:38:18 nit:What is g/e/?
Jess 2016/04/26 21:24:10 Comment cleaned up.
73 net::URLRequestContextGetter* request_context_;
Wez 2016/04/26 01:38:18 This class is ref-counted - take a lovely safe ref
Jess 2016/04/26 21:24:11 Done.
74 std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager_;
75 std::unique_ptr<metrics::MetricsService> metrics_service_;
76
77 DISALLOW_COPY_AND_ASSIGN(BlimpMetricsServiceClient);
78 };
79
80 } // namespace engine
81 } // namespace blimp
82
83 #endif // BLIMP_ENGINE_APP_BLIMP_METRICS_SERVICE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698