| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 WriteProfilerData(process_data, process_type, profile); | 812 WriteProfilerData(process_data, process_type, profile); |
| 813 } | 813 } |
| 814 | 814 |
| 815 void MetricsLog::WriteAllProfilesMetrics( | 815 void MetricsLog::WriteAllProfilesMetrics( |
| 816 const DictionaryValue& all_profiles_metrics) { | 816 const DictionaryValue& all_profiles_metrics) { |
| 817 const std::string profile_prefix(prefs::kProfilePrefix); | 817 const std::string profile_prefix(prefs::kProfilePrefix); |
| 818 for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys(); | 818 for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys(); |
| 819 i != all_profiles_metrics.end_keys(); ++i) { | 819 i != all_profiles_metrics.end_keys(); ++i) { |
| 820 const std::string& key_name = *i; | 820 const std::string& key_name = *i; |
| 821 if (key_name.compare(0, profile_prefix.size(), profile_prefix) == 0) { | 821 if (key_name.compare(0, profile_prefix.size(), profile_prefix) == 0) { |
| 822 DictionaryValue* profile; | 822 const DictionaryValue* profile; |
| 823 if (all_profiles_metrics.GetDictionaryWithoutPathExpansion(key_name, | 823 if (all_profiles_metrics.GetDictionaryWithoutPathExpansion(key_name, |
| 824 &profile)) | 824 &profile)) |
| 825 WriteProfileMetrics(key_name.substr(profile_prefix.size()), *profile); | 825 WriteProfileMetrics(key_name.substr(profile_prefix.size()), *profile); |
| 826 } | 826 } |
| 827 } | 827 } |
| 828 } | 828 } |
| 829 | 829 |
| 830 void MetricsLog::WriteProfileMetrics(const std::string& profileidhash, | 830 void MetricsLog::WriteProfileMetrics(const std::string& profileidhash, |
| 831 const DictionaryValue& profile_metrics) { | 831 const DictionaryValue& profile_metrics) { |
| 832 OPEN_ELEMENT_FOR_SCOPE("userprofile"); | 832 OPEN_ELEMENT_FOR_SCOPE("userprofile"); |
| 833 WriteAttribute("profileidhash", profileidhash); | 833 WriteAttribute("profileidhash", profileidhash); |
| 834 for (DictionaryValue::key_iterator i = profile_metrics.begin_keys(); | 834 for (DictionaryValue::key_iterator i = profile_metrics.begin_keys(); |
| 835 i != profile_metrics.end_keys(); ++i) { | 835 i != profile_metrics.end_keys(); ++i) { |
| 836 Value* value; | 836 const Value* value; |
| 837 if (profile_metrics.GetWithoutPathExpansion(*i, &value)) { | 837 if (profile_metrics.GetWithoutPathExpansion(*i, &value)) { |
| 838 DCHECK(*i != "id"); | 838 DCHECK(*i != "id"); |
| 839 switch (value->GetType()) { | 839 switch (value->GetType()) { |
| 840 case Value::TYPE_STRING: { | 840 case Value::TYPE_STRING: { |
| 841 std::string string_value; | 841 std::string string_value; |
| 842 if (value->GetAsString(&string_value)) { | 842 if (value->GetAsString(&string_value)) { |
| 843 OPEN_ELEMENT_FOR_SCOPE("profileparam"); | 843 OPEN_ELEMENT_FOR_SCOPE("profileparam"); |
| 844 WriteAttribute("name", *i); | 844 WriteAttribute("name", *i); |
| 845 WriteAttribute("value", string_value); | 845 WriteAttribute("value", string_value); |
| 846 } | 846 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 ProductDataToProto(google_update_metrics.google_update_data, | 988 ProductDataToProto(google_update_metrics.google_update_data, |
| 989 google_update->mutable_google_update_status()); | 989 google_update->mutable_google_update_status()); |
| 990 } | 990 } |
| 991 | 991 |
| 992 if (!google_update_metrics.product_data.version.empty()) { | 992 if (!google_update_metrics.product_data.version.empty()) { |
| 993 ProductDataToProto(google_update_metrics.product_data, | 993 ProductDataToProto(google_update_metrics.product_data, |
| 994 google_update->mutable_client_status()); | 994 google_update->mutable_client_status()); |
| 995 } | 995 } |
| 996 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 996 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
| 997 } | 997 } |
| OLD | NEW |