| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/autocomplete/autocomplete_match.h" | 29 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 30 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 30 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 31 #include "chrome/browser/autocomplete/autocomplete_result.h" | 31 #include "chrome/browser/autocomplete/autocomplete_result.h" |
| 32 #include "chrome/browser/browser_process.h" | 32 #include "chrome/browser/browser_process.h" |
| 33 #include "chrome/browser/google/google_util.h" | 33 #include "chrome/browser/google/google_util.h" |
| 34 #include "chrome/browser/metrics/extension_metrics.h" | 34 #include "chrome/browser/metrics/extension_metrics.h" |
| 35 #include "chrome/browser/omnibox/omnibox_log.h" | 35 #include "chrome/browser/omnibox/omnibox_log.h" |
| 36 #include "chrome/browser/plugins/plugin_prefs.h" | 36 #include "chrome/browser/plugins/plugin_prefs.h" |
| 37 #include "chrome/browser/profiles/profile_manager.h" | 37 #include "chrome/browser/profiles/profile_manager.h" |
| 38 #include "chrome/common/chrome_version_info.h" | 38 #include "chrome/common/chrome_version_info.h" |
| 39 #include "chrome/common/metrics/variations/variations_util.h" | |
| 40 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| 41 #include "chrome/installer/util/google_update_settings.h" | 40 #include "chrome/installer/util/google_update_settings.h" |
| 42 #include "components/metrics/proto/omnibox_event.pb.h" | 41 #include "components/metrics/proto/omnibox_event.pb.h" |
| 43 #include "components/metrics/proto/profiler_event.pb.h" | 42 #include "components/metrics/proto/profiler_event.pb.h" |
| 44 #include "components/metrics/proto/system_profile.pb.h" | 43 #include "components/metrics/proto/system_profile.pb.h" |
| 45 #include "components/nacl/common/nacl_process_type.h" | 44 #include "components/nacl/common/nacl_process_type.h" |
| 45 #include "components/variations/active_field_trials.h" |
| 46 #include "content/public/browser/gpu_data_manager.h" | 46 #include "content/public/browser/gpu_data_manager.h" |
| 47 #include "content/public/common/content_client.h" | 47 #include "content/public/common/content_client.h" |
| 48 #include "content/public/common/webplugininfo.h" | 48 #include "content/public/common/webplugininfo.h" |
| 49 #include "gpu/config/gpu_info.h" | 49 #include "gpu/config/gpu_info.h" |
| 50 #include "ui/gfx/screen.h" | 50 #include "ui/gfx/screen.h" |
| 51 #include "url/gurl.h" | 51 #include "url/gurl.h" |
| 52 | 52 |
| 53 #if defined(OS_ANDROID) | 53 #if defined(OS_ANDROID) |
| 54 #include "base/android/build_info.h" | 54 #include "base/android/build_info.h" |
| 55 #endif | 55 #endif |
| 56 | 56 |
| 57 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
| 58 #include "base/win/metro.h" | 58 #include "base/win/metro.h" |
| 59 | 59 |
| 60 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | 60 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
| 61 extern "C" IMAGE_DOS_HEADER __ImageBase; | 61 extern "C" IMAGE_DOS_HEADER __ImageBase; |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 #if defined(OS_CHROMEOS) | 64 #if defined(OS_CHROMEOS) |
| 65 #include "chrome/browser/metrics/metrics_log_chromeos.h" | 65 #include "chrome/browser/metrics/metrics_log_chromeos.h" |
| 66 #endif // OS_CHROMEOS | 66 #endif // OS_CHROMEOS |
| 67 | 67 |
| 68 using content::GpuDataManager; | 68 using content::GpuDataManager; |
| 69 using metrics::MetricsLogBase; | 69 using metrics::MetricsLogBase; |
| 70 using metrics::OmniboxEventProto; | 70 using metrics::OmniboxEventProto; |
| 71 using metrics::ProfilerEventProto; | 71 using metrics::ProfilerEventProto; |
| 72 using metrics::SystemProfileProto; | 72 using metrics::SystemProfileProto; |
| 73 using tracked_objects::ProcessDataSnapshot; | 73 using tracked_objects::ProcessDataSnapshot; |
| 74 typedef chrome_variations::ActiveGroupId ActiveGroupId; | 74 typedef variations::ActiveGroupId ActiveGroupId; |
| 75 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; | 75 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; |
| 76 | 76 |
| 77 namespace { | 77 namespace { |
| 78 | 78 |
| 79 // Returns the date at which the current metrics client ID was created as | 79 // Returns the date at which the current metrics client ID was created as |
| 80 // a string containing seconds since the epoch, or "0" if none was found. | 80 // a string containing seconds since the epoch, or "0" if none was found. |
| 81 std::string GetMetricsEnabledDate(PrefService* pref) { | 81 std::string GetMetricsEnabledDate(PrefService* pref) { |
| 82 if (!pref) { | 82 if (!pref) { |
| 83 NOTREACHED(); | 83 NOTREACHED(); |
| 84 return "0"; | 84 return "0"; |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 GetPrimaryDisplay().device_scale_factor(); | 516 GetPrimaryDisplay().device_scale_factor(); |
| 517 } | 517 } |
| 518 | 518 |
| 519 int MetricsLog::GetScreenCount() const { | 519 int MetricsLog::GetScreenCount() const { |
| 520 // TODO(scottmg): NativeScreen maybe wrong. http://crbug.com/133312 | 520 // TODO(scottmg): NativeScreen maybe wrong. http://crbug.com/133312 |
| 521 return gfx::Screen::GetNativeScreen()->GetNumDisplays(); | 521 return gfx::Screen::GetNativeScreen()->GetNumDisplays(); |
| 522 } | 522 } |
| 523 | 523 |
| 524 void MetricsLog::GetFieldTrialIds( | 524 void MetricsLog::GetFieldTrialIds( |
| 525 std::vector<ActiveGroupId>* field_trial_ids) const { | 525 std::vector<ActiveGroupId>* field_trial_ids) const { |
| 526 chrome_variations::GetFieldTrialActiveGroupIds(field_trial_ids); | 526 variations::GetFieldTrialActiveGroupIds(field_trial_ids); |
| 527 } | 527 } |
| 528 | 528 |
| 529 bool MetricsLog::HasEnvironment() const { | 529 bool MetricsLog::HasEnvironment() const { |
| 530 return uma_proto()->system_profile().has_uma_enabled_date(); | 530 return uma_proto()->system_profile().has_uma_enabled_date(); |
| 531 } | 531 } |
| 532 | 532 |
| 533 bool MetricsLog::HasStabilityMetrics() const { | 533 bool MetricsLog::HasStabilityMetrics() const { |
| 534 return uma_proto()->system_profile().stability().has_launch_count(); | 534 return uma_proto()->system_profile().stability().has_launch_count(); |
| 535 } | 535 } |
| 536 | 536 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 iter != plugin_list.end(); ++iter) { | 684 iter != plugin_list.end(); ++iter) { |
| 685 SystemProfileProto::Plugin* plugin = system_profile->add_plugin(); | 685 SystemProfileProto::Plugin* plugin = system_profile->add_plugin(); |
| 686 SetPluginInfo(*iter, plugin_prefs, plugin); | 686 SetPluginInfo(*iter, plugin_prefs, plugin); |
| 687 } | 687 } |
| 688 #endif // defined(ENABLE_PLUGINS) | 688 #endif // defined(ENABLE_PLUGINS) |
| 689 } | 689 } |
| 690 | 690 |
| 691 void MetricsLog::RecordEnvironment( | 691 void MetricsLog::RecordEnvironment( |
| 692 const std::vector<content::WebPluginInfo>& plugin_list, | 692 const std::vector<content::WebPluginInfo>& plugin_list, |
| 693 const GoogleUpdateMetrics& google_update_metrics, | 693 const GoogleUpdateMetrics& google_update_metrics, |
| 694 const std::vector<chrome_variations::ActiveGroupId>& synthetic_trials) { | 694 const std::vector<variations::ActiveGroupId>& synthetic_trials) { |
| 695 DCHECK(!HasEnvironment()); | 695 DCHECK(!HasEnvironment()); |
| 696 | 696 |
| 697 SystemProfileProto* system_profile = uma_proto()->mutable_system_profile(); | 697 SystemProfileProto* system_profile = uma_proto()->mutable_system_profile(); |
| 698 | 698 |
| 699 std::string brand_code; | 699 std::string brand_code; |
| 700 if (google_util::GetBrand(&brand_code)) | 700 if (google_util::GetBrand(&brand_code)) |
| 701 system_profile->set_brand_code(brand_code); | 701 system_profile->set_brand_code(brand_code); |
| 702 | 702 |
| 703 int enabled_date; | 703 int enabled_date; |
| 704 bool success = base::StringToInt(GetMetricsEnabledDate(GetPrefService()), | 704 bool success = base::StringToInt(GetMetricsEnabledDate(GetPrefService()), |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 ProductDataToProto(google_update_metrics.google_update_data, | 940 ProductDataToProto(google_update_metrics.google_update_data, |
| 941 google_update->mutable_google_update_status()); | 941 google_update->mutable_google_update_status()); |
| 942 } | 942 } |
| 943 | 943 |
| 944 if (!google_update_metrics.product_data.version.empty()) { | 944 if (!google_update_metrics.product_data.version.empty()) { |
| 945 ProductDataToProto(google_update_metrics.product_data, | 945 ProductDataToProto(google_update_metrics.product_data, |
| 946 google_update->mutable_client_status()); | 946 google_update->mutable_client_status()); |
| 947 } | 947 } |
| 948 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 948 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
| 949 } | 949 } |
| OLD | NEW |