Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
|
Kevin M
2016/05/11 17:08:42
Can you add a comment explaining why we need this?
Jess
2016/05/11 20:17:30
Added explanation of why. Please take a look and
| |
| 32 // tailored for the Blimp engine. | |
| 33 // Metrics are always turned on. | |
| 34 class BlimpMetricsServiceClient : public metrics::MetricsServiceClient { | |
| 35 public: | |
| 36 // PrefService ownership is retained by the caller. | |
| 37 // The request_context_getter is a system request context. | |
| 38 // Both must remain valid for client lifetime. | |
| 39 BlimpMetricsServiceClient( | |
| 40 PrefService* pref_service, | |
| 41 scoped_refptr<net::URLRequestContextGetter> request_context_getter); | |
| 42 ~BlimpMetricsServiceClient() override; | |
| 43 | |
| 44 // metrics::MetricsServiceClient implementation. | |
| 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 metrics::MetricsServiceClient::EnableMetricsDefault GetDefaultOptIn() | |
| 62 override; | |
| 63 | |
| 64 private: | |
| 65 // Used by NetMetricsLogUploader to create log-upload requests. | |
| 66 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | |
| 67 | |
| 68 std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager_; | |
| 69 std::unique_ptr<metrics::MetricsService> metrics_service_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(BlimpMetricsServiceClient); | |
| 72 }; | |
| 73 | |
| 74 } // namespace engine | |
| 75 } // namespace blimp | |
| 76 | |
| 77 #endif // BLIMP_ENGINE_APP_BLIMP_METRICS_SERVICE_CLIENT_H_ | |
| OLD | NEW |