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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 if (profile_metrics) | 855 if (profile_metrics) |
855 WriteAllProfilesMetrics(*profile_metrics); | 856 WriteAllProfilesMetrics(*profile_metrics); |
856 | 857 |
857 RecordEnvironmentProto(plugin_list, google_update_metrics); | 858 RecordEnvironmentProto(plugin_list, google_update_metrics); |
858 } | 859 } |
859 | 860 |
860 void MetricsLog::RecordEnvironmentProto( | 861 void MetricsLog::RecordEnvironmentProto( |
861 const std::vector<webkit::WebPluginInfo>& plugin_list, | 862 const std::vector<webkit::WebPluginInfo>& plugin_list, |
862 const GoogleUpdateMetrics& google_update_metrics) { | 863 const GoogleUpdateMetrics& google_update_metrics) { |
863 SystemProfileProto* system_profile = uma_proto()->mutable_system_profile(); | 864 SystemProfileProto* system_profile = uma_proto()->mutable_system_profile(); |
| 865 |
| 866 std::string brand_code; |
| 867 if (google_util::GetBrand(&brand_code)) |
| 868 system_profile->set_brand_code(brand_code); |
| 869 |
864 int enabled_date; | 870 int enabled_date; |
865 bool success = base::StringToInt(GetMetricsEnabledDate(GetPrefService()), | 871 bool success = base::StringToInt(GetMetricsEnabledDate(GetPrefService()), |
866 &enabled_date); | 872 &enabled_date); |
867 DCHECK(success); | 873 DCHECK(success); |
868 system_profile->set_uma_enabled_date(enabled_date); | 874 system_profile->set_uma_enabled_date(enabled_date); |
869 | 875 |
870 system_profile->set_application_locale( | 876 system_profile->set_application_locale( |
871 content::GetContentClient()->browser()->GetApplicationLocale()); | 877 content::GetContentClient()->browser()->GetApplicationLocale()); |
872 | 878 |
873 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); | 879 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 ProductDataToProto(google_update_metrics.google_update_data, | 1147 ProductDataToProto(google_update_metrics.google_update_data, |
1142 google_update->mutable_google_update_status()); | 1148 google_update->mutable_google_update_status()); |
1143 } | 1149 } |
1144 | 1150 |
1145 if (!google_update_metrics.product_data.version.empty()) { | 1151 if (!google_update_metrics.product_data.version.empty()) { |
1146 ProductDataToProto(google_update_metrics.product_data, | 1152 ProductDataToProto(google_update_metrics.product_data, |
1147 google_update->mutable_client_status()); | 1153 google_update->mutable_client_status()); |
1148 } | 1154 } |
1149 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 1155 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
1150 } | 1156 } |
OLD | NEW |