OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "android_webview/browser/aw_metrics_service_client.h" | 11 #include "android_webview/browser/aw_metrics_service_client.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "components/metrics/metrics_service_client.h" | 14 #include "components/metrics/metrics_service_client.h" |
15 | 15 |
16 class PrefService; | 16 class PrefService; |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class FilePath; | 19 class FilePath; |
20 } | 20 } |
21 | 21 |
22 namespace metrics { | 22 namespace metrics { |
23 struct ClientInfo; | 23 struct ClientInfo; |
24 class EnabledStateProvider; | |
24 class MetricsStateManager; | 25 class MetricsStateManager; |
25 } | 26 } |
26 | 27 |
27 namespace net { | 28 namespace net { |
28 class URLRequestContextGetter; | 29 class URLRequestContextGetter; |
29 } | 30 } |
30 | 31 |
31 namespace android_webview { | 32 namespace android_webview { |
32 | 33 |
33 // This singleton manages metrics for an app using any number of WebViews. The | 34 // This singleton manages metrics for an app using any number of WebViews. The |
(...skipping 27 matching lines...) Expand all Loading... | |
61 std::string GetVersionString() override; | 62 std::string GetVersionString() override; |
62 void OnLogUploadComplete() override; | 63 void OnLogUploadComplete() override; |
63 void InitializeSystemProfileMetrics( | 64 void InitializeSystemProfileMetrics( |
64 const base::Closure& done_callback) override; | 65 const base::Closure& done_callback) override; |
65 void CollectFinalMetricsForLog(const base::Closure& done_callback) override; | 66 void CollectFinalMetricsForLog(const base::Closure& done_callback) override; |
66 std::unique_ptr<metrics::MetricsLogUploader> CreateUploader( | 67 std::unique_ptr<metrics::MetricsLogUploader> CreateUploader( |
67 const base::Callback<void(int)>& on_upload_complete) override; | 68 const base::Callback<void(int)>& on_upload_complete) override; |
68 base::TimeDelta GetStandardUploadInterval() override; | 69 base::TimeDelta GetStandardUploadInterval() override; |
69 | 70 |
70 private: | 71 private: |
72 class AwEnabledStateProvider; | |
73 | |
71 AwMetricsServiceClient(); | 74 AwMetricsServiceClient(); |
72 ~AwMetricsServiceClient() override; | 75 ~AwMetricsServiceClient() override; |
73 | 76 |
74 void InitializeWithGUID(std::string* guid); | 77 void InitializeWithGUID(std::string* guid); |
75 | 78 |
76 // Callback for metrics::MetricsStateManager::Create | 79 // Callback for metrics::MetricsStateManager::Create |
77 bool is_reporting_enabled(); | 80 bool is_reporting_enabled(); |
78 | 81 |
79 bool is_initialized_; | 82 bool is_initialized_; |
80 bool is_enabled_; | 83 bool is_enabled_; |
81 PrefService* pref_service_; | 84 PrefService* pref_service_; |
82 net::URLRequestContextGetter* request_context_; | 85 net::URLRequestContextGetter* request_context_; |
83 std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager_; | 86 std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager_; |
84 std::unique_ptr<metrics::MetricsService> metrics_service_; | 87 std::unique_ptr<metrics::MetricsService> metrics_service_; |
88 std::unique_ptr<AwEnabledStateProvider> enabled_state_provider_; | |
Alexei Svitkine (slow)
2016/05/11 17:16:28
Nit: How about just making AwMetricsServiceClient
jwd
2016/05/11 18:31:38
Done.
| |
85 | 89 |
86 DISALLOW_COPY_AND_ASSIGN(AwMetricsServiceClient); | 90 DISALLOW_COPY_AND_ASSIGN(AwMetricsServiceClient); |
87 }; | 91 }; |
88 | 92 |
89 } // namespace android_webview | 93 } // namespace android_webview |
90 | 94 |
91 #endif // ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_ | 95 #endif // ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_ |
OLD | NEW |