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/about_flags.h" | 5 #include "chrome/browser/about_flags.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 | 2815 |
2816 base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) { | 2816 base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) { |
2817 return static_cast<base::HistogramBase::Sample>( | 2817 return static_cast<base::HistogramBase::Sample>( |
2818 metrics::HashMetricName(switch_name)); | 2818 metrics::HashMetricName(switch_name)); |
2819 } | 2819 } |
2820 | 2820 |
2821 void ReportCustomFlags(const std::string& uma_histogram_hame, | 2821 void ReportCustomFlags(const std::string& uma_histogram_hame, |
2822 const std::set<std::string>& command_line_difference) { | 2822 const std::set<std::string>& command_line_difference) { |
2823 for (const std::string& flag : command_line_difference) { | 2823 for (const std::string& flag : command_line_difference) { |
2824 int uma_id = about_flags::testing::kBadSwitchFormatHistogramId; | 2824 int uma_id = about_flags::testing::kBadSwitchFormatHistogramId; |
2825 if (StartsWithASCII(flag, "--", true /* case_sensitive */)) { | 2825 if (base::StartsWithASCII(flag, "--", true /* case_sensitive */)) { |
2826 // Skip '--' before switch name. | 2826 // Skip '--' before switch name. |
2827 std::string switch_name(flag.substr(2)); | 2827 std::string switch_name(flag.substr(2)); |
2828 | 2828 |
2829 // Kill value, if any. | 2829 // Kill value, if any. |
2830 const size_t value_pos = switch_name.find('='); | 2830 const size_t value_pos = switch_name.find('='); |
2831 if (value_pos != std::string::npos) | 2831 if (value_pos != std::string::npos) |
2832 switch_name.resize(value_pos); | 2832 switch_name.resize(value_pos); |
2833 | 2833 |
2834 uma_id = GetSwitchUMAId(switch_name); | 2834 uma_id = GetSwitchUMAId(switch_name); |
2835 } else { | 2835 } else { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 } | 3034 } |
3035 | 3035 |
3036 const Experiment* GetExperiments(size_t* count) { | 3036 const Experiment* GetExperiments(size_t* count) { |
3037 *count = num_experiments; | 3037 *count = num_experiments; |
3038 return experiments; | 3038 return experiments; |
3039 } | 3039 } |
3040 | 3040 |
3041 } // namespace testing | 3041 } // namespace testing |
3042 | 3042 |
3043 } // namespace about_flags | 3043 } // namespace about_flags |
OLD | NEW |