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 #include "chrome/browser/metrics/chrome_metrics_service_client.h" | 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
33 #include "components/metrics/call_stack_profile_metrics_provider.h" | 33 #include "components/metrics/call_stack_profile_metrics_provider.h" |
34 #include "components/metrics/gpu/gpu_metrics_provider.h" | 34 #include "components/metrics/gpu/gpu_metrics_provider.h" |
35 #include "components/metrics/metrics_service.h" | 35 #include "components/metrics/metrics_service.h" |
36 #include "components/metrics/net/net_metrics_log_uploader.h" | 36 #include "components/metrics/net/net_metrics_log_uploader.h" |
37 #include "components/metrics/net/network_metrics_provider.h" | 37 #include "components/metrics/net/network_metrics_provider.h" |
38 #include "components/metrics/profiler/profiler_metrics_provider.h" | 38 #include "components/metrics/profiler/profiler_metrics_provider.h" |
39 #include "components/metrics/profiler/tracking_synchronizer.h" | 39 #include "components/metrics/profiler/tracking_synchronizer.h" |
40 #include "components/metrics/url_constants.h" | 40 #include "components/metrics/url_constants.h" |
41 #include "components/variations/variations_associated_data.h" | 41 #include "components/variations/variations_associated_data.h" |
| 42 #include "components/version_info/version_info.h" |
42 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
43 #include "content/public/browser/histogram_fetcher.h" | 44 #include "content/public/browser/histogram_fetcher.h" |
44 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
45 #include "content/public/browser/render_process_host.h" | 46 #include "content/public/browser/render_process_host.h" |
46 #include "content/public/common/service_registry.h" | 47 #include "content/public/common/service_registry.h" |
47 | 48 |
48 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
49 #include "chrome/browser/metrics/android_metrics_provider.h" | 50 #include "chrome/browser/metrics/android_metrics_provider.h" |
50 #endif | 51 #endif |
51 | 52 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 197 |
197 std::string ChromeMetricsServiceClient::GetApplicationLocale() { | 198 std::string ChromeMetricsServiceClient::GetApplicationLocale() { |
198 return g_browser_process->GetApplicationLocale(); | 199 return g_browser_process->GetApplicationLocale(); |
199 } | 200 } |
200 | 201 |
201 bool ChromeMetricsServiceClient::GetBrand(std::string* brand_code) { | 202 bool ChromeMetricsServiceClient::GetBrand(std::string* brand_code) { |
202 return google_brand::GetBrand(brand_code); | 203 return google_brand::GetBrand(brand_code); |
203 } | 204 } |
204 | 205 |
205 metrics::SystemProfileProto::Channel ChromeMetricsServiceClient::GetChannel() { | 206 metrics::SystemProfileProto::Channel ChromeMetricsServiceClient::GetChannel() { |
206 return metrics::AsProtobufChannel(chrome::VersionInfo::GetChannel()); | 207 return metrics::AsProtobufChannel(chrome::GetChannel()); |
207 } | 208 } |
208 | 209 |
209 std::string ChromeMetricsServiceClient::GetVersionString() { | 210 std::string ChromeMetricsServiceClient::GetVersionString() { |
210 return metrics::GetVersionString(); | 211 return metrics::GetVersionString(); |
211 } | 212 } |
212 | 213 |
213 void ChromeMetricsServiceClient::OnLogUploadComplete() { | 214 void ChromeMetricsServiceClient::OnLogUploadComplete() { |
214 // Collect time ticks stats after each UMA upload. | 215 // Collect time ticks stats after each UMA upload. |
215 #if defined(OS_WIN) | 216 #if defined(OS_WIN) |
216 chrome::CollectTimeTicksStats(); | 217 chrome::CollectTimeTicksStats(); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 new AndroidMetricsProvider(g_browser_process->local_state()))); | 370 new AndroidMetricsProvider(g_browser_process->local_state()))); |
370 #endif // defined(OS_ANDROID) | 371 #endif // defined(OS_ANDROID) |
371 | 372 |
372 #if defined(OS_WIN) | 373 #if defined(OS_WIN) |
373 google_update_metrics_provider_ = new GoogleUpdateMetricsProviderWin; | 374 google_update_metrics_provider_ = new GoogleUpdateMetricsProviderWin; |
374 metrics_service_->RegisterMetricsProvider( | 375 metrics_service_->RegisterMetricsProvider( |
375 scoped_ptr<metrics::MetricsProvider>(google_update_metrics_provider_)); | 376 scoped_ptr<metrics::MetricsProvider>(google_update_metrics_provider_)); |
376 | 377 |
377 // Report exit funnels for canary and dev only. | 378 // Report exit funnels for canary and dev only. |
378 bool report_exit_funnels = false; | 379 bool report_exit_funnels = false; |
379 switch (chrome::VersionInfo::GetChannel()) { | 380 switch (chrome::GetChannel()) { |
380 case version_info::Channel::CANARY: | 381 case version_info::Channel::CANARY: |
381 case version_info::Channel::DEV: | 382 case version_info::Channel::DEV: |
382 report_exit_funnels = true; | 383 report_exit_funnels = true; |
383 break; | 384 break; |
384 } | 385 } |
385 | 386 |
386 metrics_service_->RegisterMetricsProvider( | 387 metrics_service_->RegisterMetricsProvider( |
387 scoped_ptr<metrics::MetricsProvider>( | 388 scoped_ptr<metrics::MetricsProvider>( |
388 new browser_watcher::WatcherMetricsProviderWin( | 389 new browser_watcher::WatcherMetricsProviderWin( |
389 chrome::kBrowserExitCodesRegistryPath, report_exit_funnels))); | 390 chrome::kBrowserExitCodesRegistryPath, report_exit_funnels))); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 case content::NOTIFICATION_LOAD_START: | 603 case content::NOTIFICATION_LOAD_START: |
603 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: | 604 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: |
604 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: | 605 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: |
605 metrics_service_->OnApplicationNotIdle(); | 606 metrics_service_->OnApplicationNotIdle(); |
606 break; | 607 break; |
607 | 608 |
608 default: | 609 default: |
609 NOTREACHED(); | 610 NOTREACHED(); |
610 } | 611 } |
611 } | 612 } |
OLD | NEW |