Chromium Code Reviews| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/perftimer.h" | 15 #include "base/perftimer.h" |
| 16 #include "base/profiler/alternate_timer.h" | 16 #include "base/profiler/alternate_timer.h" |
| 17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
| 20 #include "base/third_party/nspr/prtime.h" | 20 #include "base/third_party/nspr/prtime.h" |
| 21 #include "base/time.h" | 21 #include "base/time.h" |
| 22 #include "base/tracked_objects.h" | 22 #include "base/tracked_objects.h" |
| 23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
| 24 #include "chrome/browser/autocomplete/autocomplete_input.h" | 24 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 25 #include "chrome/browser/autocomplete/autocomplete_log.h" | 25 #include "chrome/browser/autocomplete/autocomplete_log.h" |
| 26 #include "chrome/browser/autocomplete/autocomplete_match.h" | 26 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 27 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 27 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 28 #include "chrome/browser/autocomplete/autocomplete_result.h" | 28 #include "chrome/browser/autocomplete/autocomplete_result.h" |
| 29 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/google/google_util.h" | |
| 30 #include "chrome/browser/plugins/plugin_prefs.h" | 31 #include "chrome/browser/plugins/plugin_prefs.h" |
| 31 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
| 32 #include "chrome/browser/profiles/profile_manager.h" | 33 #include "chrome/browser/profiles/profile_manager.h" |
| 33 #include "chrome/common/chrome_version_info.h" | 34 #include "chrome/common/chrome_version_info.h" |
| 34 #include "chrome/common/logging_chrome.h" | 35 #include "chrome/common/logging_chrome.h" |
| 35 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | 36 #include "chrome/common/metrics/proto/omnibox_event.pb.h" |
| 36 #include "chrome/common/metrics/proto/profiler_event.pb.h" | 37 #include "chrome/common/metrics/proto/profiler_event.pb.h" |
| 37 #include "chrome/common/metrics/proto/system_profile.pb.h" | 38 #include "chrome/common/metrics/proto/system_profile.pb.h" |
| 38 #include "chrome/common/metrics/variations/variations_util.h" | 39 #include "chrome/common/metrics/variations/variations_util.h" |
| 39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 793 if (profile_metrics) | 794 if (profile_metrics) |
| 794 WriteAllProfilesMetrics(*profile_metrics); | 795 WriteAllProfilesMetrics(*profile_metrics); |
| 795 | 796 |
| 796 RecordEnvironmentProto(plugin_list, google_update_metrics); | 797 RecordEnvironmentProto(plugin_list, google_update_metrics); |
| 797 } | 798 } |
| 798 | 799 |
| 799 void MetricsLog::RecordEnvironmentProto( | 800 void MetricsLog::RecordEnvironmentProto( |
| 800 const std::vector<webkit::WebPluginInfo>& plugin_list, | 801 const std::vector<webkit::WebPluginInfo>& plugin_list, |
| 801 const GoogleUpdateMetrics& google_update_metrics) { | 802 const GoogleUpdateMetrics& google_update_metrics) { |
| 802 SystemProfileProto* system_profile = uma_proto()->mutable_system_profile(); | 803 SystemProfileProto* system_profile = uma_proto()->mutable_system_profile(); |
| 804 std::string brand_code; | |
| 805 if (google_util::GetBrand(&brand_code)) | |
| 806 system_profile->set_brand_code(brand_code); | |
|
Ilya Sherman
2013/01/23 05:58:21
nit: Please leave blank lines around this block.
Mark P
2013/01/23 17:00:48
Done.
| |
| 803 int enabled_date; | 807 int enabled_date; |
| 804 bool success = base::StringToInt(GetMetricsEnabledDate(GetPrefService()), | 808 bool success = base::StringToInt(GetMetricsEnabledDate(GetPrefService()), |
| 805 &enabled_date); | 809 &enabled_date); |
| 806 DCHECK(success); | 810 DCHECK(success); |
| 807 system_profile->set_uma_enabled_date(enabled_date); | 811 system_profile->set_uma_enabled_date(enabled_date); |
| 808 | 812 |
| 809 system_profile->set_application_locale( | 813 system_profile->set_application_locale( |
| 810 content::GetContentClient()->browser()->GetApplicationLocale()); | 814 content::GetContentClient()->browser()->GetApplicationLocale()); |
| 811 | 815 |
| 812 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); | 816 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1074 ProductDataToProto(google_update_metrics.google_update_data, | 1078 ProductDataToProto(google_update_metrics.google_update_data, |
| 1075 google_update->mutable_google_update_status()); | 1079 google_update->mutable_google_update_status()); |
| 1076 } | 1080 } |
| 1077 | 1081 |
| 1078 if (!google_update_metrics.product_data.version.empty()) { | 1082 if (!google_update_metrics.product_data.version.empty()) { |
| 1079 ProductDataToProto(google_update_metrics.product_data, | 1083 ProductDataToProto(google_update_metrics.product_data, |
| 1080 google_update->mutable_client_status()); | 1084 google_update->mutable_client_status()); |
| 1081 } | 1085 } |
| 1082 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 1086 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
| 1083 } | 1087 } |
| OLD | NEW |