OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ |
6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ | 6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
15 #include "chrome/browser/memory_details.h" | 15 #include "chrome/browser/memory_details.h" |
16 #include "chrome/browser/metrics/network_stats_uploader.h" | 16 #include "chrome/browser/metrics/network_stats_uploader.h" |
17 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" | 17 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" |
18 #include "components/metrics/metrics_service_client.h" | 18 #include "components/metrics/metrics_service_client.h" |
19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
21 | 21 |
22 class ChromeOSMetricsProvider; | 22 class ChromeOSMetricsProvider; |
23 class GoogleUpdateMetricsProviderWin; | 23 class GoogleUpdateMetricsProviderWin; |
24 class MetricsService; | |
25 class PluginMetricsProvider; | 24 class PluginMetricsProvider; |
26 class PrefRegistrySimple; | 25 class PrefRegistrySimple; |
27 class ProfilerMetricsProvider; | 26 class ProfilerMetricsProvider; |
28 | 27 |
29 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) | 28 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) |
30 class SigninStatusMetricsProvider; | 29 class SigninStatusMetricsProvider; |
31 #endif | 30 #endif |
32 | 31 |
33 namespace base { | 32 namespace base { |
34 class FilePath; | 33 class FilePath; |
35 } | 34 } |
36 | 35 |
37 namespace metrics { | 36 namespace metrics { |
| 37 class MetricsService; |
38 class MetricsStateManager; | 38 class MetricsStateManager; |
39 } | 39 } |
40 | 40 |
41 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient | 41 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient |
42 // that depends on chrome/. | 42 // that depends on chrome/. |
43 class ChromeMetricsServiceClient | 43 class ChromeMetricsServiceClient |
44 : public metrics::MetricsServiceClient, | 44 : public metrics::MetricsServiceClient, |
45 public chrome_browser_metrics::TrackingSynchronizerObserver, | 45 public chrome_browser_metrics::TrackingSynchronizerObserver, |
46 public content::NotificationObserver { | 46 public content::NotificationObserver { |
47 public: | 47 public: |
(...skipping 17 matching lines...) Expand all Loading... |
65 virtual void OnLogUploadComplete() OVERRIDE; | 65 virtual void OnLogUploadComplete() OVERRIDE; |
66 virtual void StartGatheringMetrics( | 66 virtual void StartGatheringMetrics( |
67 const base::Closure& done_callback) OVERRIDE; | 67 const base::Closure& done_callback) OVERRIDE; |
68 virtual void CollectFinalMetrics(const base::Closure& done_callback) | 68 virtual void CollectFinalMetrics(const base::Closure& done_callback) |
69 OVERRIDE; | 69 OVERRIDE; |
70 virtual scoped_ptr<metrics::MetricsLogUploader> CreateUploader( | 70 virtual scoped_ptr<metrics::MetricsLogUploader> CreateUploader( |
71 const std::string& server_url, | 71 const std::string& server_url, |
72 const std::string& mime_type, | 72 const std::string& mime_type, |
73 const base::Callback<void(int)>& on_upload_complete) OVERRIDE; | 73 const base::Callback<void(int)>& on_upload_complete) OVERRIDE; |
74 | 74 |
75 MetricsService* metrics_service() { return metrics_service_.get(); } | 75 metrics::MetricsService* metrics_service() { return metrics_service_.get(); } |
76 | 76 |
77 void LogPluginLoadingError(const base::FilePath& plugin_path); | 77 void LogPluginLoadingError(const base::FilePath& plugin_path); |
78 | 78 |
79 private: | 79 private: |
80 explicit ChromeMetricsServiceClient( | 80 explicit ChromeMetricsServiceClient( |
81 metrics::MetricsStateManager* state_manager); | 81 metrics::MetricsStateManager* state_manager); |
82 | 82 |
83 // Completes the two-phase initialization of ChromeMetricsServiceClient. | 83 // Completes the two-phase initialization of ChromeMetricsServiceClient. |
84 void Initialize(); | 84 void Initialize(); |
85 | 85 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // any previous browser processes which generated a crash dump. | 124 // any previous browser processes which generated a crash dump. |
125 void CountBrowserCrashDumpAttempts(); | 125 void CountBrowserCrashDumpAttempts(); |
126 #endif // OS_WIN | 126 #endif // OS_WIN |
127 | 127 |
128 base::ThreadChecker thread_checker_; | 128 base::ThreadChecker thread_checker_; |
129 | 129 |
130 // Weak pointer to the MetricsStateManager. | 130 // Weak pointer to the MetricsStateManager. |
131 metrics::MetricsStateManager* metrics_state_manager_; | 131 metrics::MetricsStateManager* metrics_state_manager_; |
132 | 132 |
133 // The MetricsService that |this| is a client of. | 133 // The MetricsService that |this| is a client of. |
134 scoped_ptr<MetricsService> metrics_service_; | 134 scoped_ptr<metrics::MetricsService> metrics_service_; |
135 | 135 |
136 content::NotificationRegistrar registrar_; | 136 content::NotificationRegistrar registrar_; |
137 | 137 |
138 // On ChromeOS, holds a weak pointer to the ChromeOSMetricsProvider instance | 138 // On ChromeOS, holds a weak pointer to the ChromeOSMetricsProvider instance |
139 // that has been registered with MetricsService. On other platforms, is NULL. | 139 // that has been registered with MetricsService. On other platforms, is NULL. |
140 ChromeOSMetricsProvider* chromeos_metrics_provider_; | 140 ChromeOSMetricsProvider* chromeos_metrics_provider_; |
141 | 141 |
142 NetworkStatsUploader network_stats_uploader_; | 142 NetworkStatsUploader network_stats_uploader_; |
143 | 143 |
144 // Saved callback received from CollectFinalMetrics(). | 144 // Saved callback received from CollectFinalMetrics(). |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // The MemoryGrowthTracker instance that tracks memory usage growth in | 178 // The MemoryGrowthTracker instance that tracks memory usage growth in |
179 // MemoryDetails. | 179 // MemoryDetails. |
180 MemoryGrowthTracker memory_growth_tracker_; | 180 MemoryGrowthTracker memory_growth_tracker_; |
181 | 181 |
182 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_; | 182 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_; |
183 | 183 |
184 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient); | 184 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient); |
185 }; | 185 }; |
186 | 186 |
187 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ | 187 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ |
OLD | NEW |