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 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2442 | 2442 |
2443 base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) { | 2443 base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) { |
2444 return static_cast<base::HistogramBase::Sample>( | 2444 return static_cast<base::HistogramBase::Sample>( |
2445 metrics::HashMetricName(switch_name)); | 2445 metrics::HashMetricName(switch_name)); |
2446 } | 2446 } |
2447 | 2447 |
2448 void ReportCustomFlags(const std::string& uma_histogram_hame, | 2448 void ReportCustomFlags(const std::string& uma_histogram_hame, |
2449 const std::set<std::string>& command_line_difference) { | 2449 const std::set<std::string>& command_line_difference) { |
2450 for (const std::string& flag : command_line_difference) { | 2450 for (const std::string& flag : command_line_difference) { |
2451 int uma_id = about_flags::testing::kBadSwitchFormatHistogramId; | 2451 int uma_id = about_flags::testing::kBadSwitchFormatHistogramId; |
2452 if (base::StartsWithASCII(flag, "--", true /* case_sensitive */)) { | 2452 if (base::StartsWith(flag, "--", base::CompareCase::SENSITIVE)) { |
2453 // Skip '--' before switch name. | 2453 // Skip '--' before switch name. |
2454 std::string switch_name(flag.substr(2)); | 2454 std::string switch_name(flag.substr(2)); |
2455 | 2455 |
2456 // Kill value, if any. | 2456 // Kill value, if any. |
2457 const size_t value_pos = switch_name.find('='); | 2457 const size_t value_pos = switch_name.find('='); |
2458 if (value_pos != std::string::npos) | 2458 if (value_pos != std::string::npos) |
2459 switch_name.resize(value_pos); | 2459 switch_name.resize(value_pos); |
2460 | 2460 |
2461 uma_id = GetSwitchUMAId(switch_name); | 2461 uma_id = GetSwitchUMAId(switch_name); |
2462 } else { | 2462 } else { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2667 } | 2667 } |
2668 | 2668 |
2669 const Experiment* GetExperiments(size_t* count) { | 2669 const Experiment* GetExperiments(size_t* count) { |
2670 *count = num_experiments; | 2670 *count = num_experiments; |
2671 return experiments; | 2671 return experiments; |
2672 } | 2672 } |
2673 | 2673 |
2674 } // namespace testing | 2674 } // namespace testing |
2675 | 2675 |
2676 } // namespace about_flags | 2676 } // namespace about_flags |
OLD | NEW |