OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/md5.h" | 10 #include "base/md5.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 } | 564 } |
565 | 565 |
566 void MetricsLog::WriteAllProfilesMetrics( | 566 void MetricsLog::WriteAllProfilesMetrics( |
567 const DictionaryValue& all_profiles_metrics) { | 567 const DictionaryValue& all_profiles_metrics) { |
568 const std::wstring profile_prefix(prefs::kProfilePrefix); | 568 const std::wstring profile_prefix(prefs::kProfilePrefix); |
569 for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys(); | 569 for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys(); |
570 i != all_profiles_metrics.end_keys(); ++i) { | 570 i != all_profiles_metrics.end_keys(); ++i) { |
571 const std::wstring& key_name = *i; | 571 const std::wstring& key_name = *i; |
572 if (key_name.compare(0, profile_prefix.size(), profile_prefix) == 0) { | 572 if (key_name.compare(0, profile_prefix.size(), profile_prefix) == 0) { |
573 DictionaryValue* profile; | 573 DictionaryValue* profile; |
574 if (all_profiles_metrics.GetDictionary(key_name, &profile)) | 574 if (all_profiles_metrics.GetDictionaryWithoutPathExpansion(key_name, |
| 575 &profile)) |
575 WriteProfileMetrics(key_name.substr(profile_prefix.size()), *profile); | 576 WriteProfileMetrics(key_name.substr(profile_prefix.size()), *profile); |
576 } | 577 } |
577 } | 578 } |
578 } | 579 } |
579 | 580 |
580 void MetricsLog::WriteProfileMetrics(const std::wstring& profileidhash, | 581 void MetricsLog::WriteProfileMetrics(const std::wstring& profileidhash, |
581 const DictionaryValue& profile_metrics) { | 582 const DictionaryValue& profile_metrics) { |
582 OPEN_ELEMENT_FOR_SCOPE("userprofile"); | 583 OPEN_ELEMENT_FOR_SCOPE("userprofile"); |
583 WriteAttribute("profileidhash", WideToUTF8(profileidhash)); | 584 WriteAttribute("profileidhash", WideToUTF8(profileidhash)); |
584 for (DictionaryValue::key_iterator i = profile_metrics.begin_keys(); | 585 for (DictionaryValue::key_iterator i = profile_metrics.begin_keys(); |
585 i != profile_metrics.end_keys(); ++i) { | 586 i != profile_metrics.end_keys(); ++i) { |
586 Value* value; | 587 Value* value; |
587 if (profile_metrics.Get(*i, &value)) { | 588 if (profile_metrics.GetWithoutPathExpansion(*i, &value)) { |
588 DCHECK(*i != L"id"); | 589 DCHECK(*i != L"id"); |
589 switch (value->GetType()) { | 590 switch (value->GetType()) { |
590 case Value::TYPE_STRING: { | 591 case Value::TYPE_STRING: { |
591 std::string string_value; | 592 std::string string_value; |
592 if (value->GetAsString(&string_value)) { | 593 if (value->GetAsString(&string_value)) { |
593 OPEN_ELEMENT_FOR_SCOPE("profileparam"); | 594 OPEN_ELEMENT_FOR_SCOPE("profileparam"); |
594 WriteAttribute("name", WideToUTF8(*i)); | 595 WriteAttribute("name", WideToUTF8(*i)); |
595 WriteAttribute("value", string_value); | 596 WriteAttribute("value", string_value); |
596 } | 597 } |
597 break; | 598 break; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 685 |
685 for (size_t i = 0; i < histogram.bucket_count(); i++) { | 686 for (size_t i = 0; i < histogram.bucket_count(); i++) { |
686 if (snapshot.counts(i)) { | 687 if (snapshot.counts(i)) { |
687 OPEN_ELEMENT_FOR_SCOPE("histogrambucket"); | 688 OPEN_ELEMENT_FOR_SCOPE("histogrambucket"); |
688 WriteIntAttribute("min", histogram.ranges(i)); | 689 WriteIntAttribute("min", histogram.ranges(i)); |
689 WriteIntAttribute("max", histogram.ranges(i + 1)); | 690 WriteIntAttribute("max", histogram.ranges(i + 1)); |
690 WriteIntAttribute("count", snapshot.counts(i)); | 691 WriteIntAttribute("count", snapshot.counts(i)); |
691 } | 692 } |
692 } | 693 } |
693 } | 694 } |
OLD | NEW |