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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 #endif | 58 #endif |
59 | 59 |
60 #if defined(ENABLE_APP_LIST) | 60 #if defined(ENABLE_APP_LIST) |
61 #include "ui/app_list/app_list_switches.h" | 61 #include "ui/app_list/app_list_switches.h" |
62 #endif | 62 #endif |
63 | 63 |
64 using base::UserMetricsAction; | 64 using base::UserMetricsAction; |
65 | 65 |
66 namespace about_flags { | 66 namespace about_flags { |
67 | 67 |
68 const uint32_t kBadSwitchFormatHistogramId = 0; | 68 const int32_t kBadSwitchFormatHistogramId = 0; |
69 | 69 |
70 // Macros to simplify specifying the type. | 70 // Macros to simplify specifying the type. |
71 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ | 71 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ |
72 Experiment::SINGLE_VALUE, \ | 72 Experiment::SINGLE_VALUE, \ |
73 command_line_switch, switch_value, NULL, NULL, NULL, 0 | 73 command_line_switch, switch_value, NULL, NULL, NULL, 0 |
74 #define SINGLE_VALUE_TYPE(command_line_switch) \ | 74 #define SINGLE_VALUE_TYPE(command_line_switch) \ |
75 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") | 75 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") |
76 #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \ | 76 #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \ |
77 disable_switch, disable_value) \ | 77 disable_switch, disable_value) \ |
78 Experiment::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \ | 78 Experiment::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \ |
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2231 action += *it; | 2231 action += *it; |
2232 content::RecordComputedAction(action); | 2232 content::RecordComputedAction(action); |
2233 } | 2233 } |
2234 // Since flag metrics are recorded every startup, add a tick so that the | 2234 // Since flag metrics are recorded every startup, add a tick so that the |
2235 // stats can be made meaningful. | 2235 // stats can be made meaningful. |
2236 if (flags.size()) | 2236 if (flags.size()) |
2237 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick")); | 2237 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick")); |
2238 content::RecordAction(UserMetricsAction("StartupTick")); | 2238 content::RecordAction(UserMetricsAction("StartupTick")); |
2239 } | 2239 } |
2240 | 2240 |
2241 uint32_t GetSwitchUMAId(const std::string& switch_name) { | 2241 int32_t GetSwitchUMAId(const std::string& switch_name) { |
sky
2014/08/28 23:27:29
Shouldn't you use the same types as used by histog
Alexander Alekseev
2014/08/30 04:41:14
Done.
| |
2242 return static_cast<uint32_t>(metrics::HashMetricName(switch_name)); | 2242 return static_cast<int32_t>(metrics::HashMetricName(switch_name)); |
2243 } | 2243 } |
2244 | 2244 |
2245 void ReportCustomFlags(const std::string& uma_histogram_hame, | 2245 void ReportCustomFlags(const std::string& uma_histogram_hame, |
2246 const std::set<std::string>& command_line_difference) { | 2246 const std::set<std::string>& command_line_difference) { |
2247 for (std::set<std::string>::const_iterator it = | 2247 for (std::set<std::string>::const_iterator it = |
2248 command_line_difference.begin(); | 2248 command_line_difference.begin(); |
2249 it != command_line_difference.end(); | 2249 it != command_line_difference.end(); |
2250 ++it) { | 2250 ++it) { |
2251 int uma_id = about_flags::kBadSwitchFormatHistogramId; | 2251 int uma_id = about_flags::kBadSwitchFormatHistogramId; |
2252 if (StartsWithASCII(*it, "--", true /* case_sensitive */)) { | 2252 if (StartsWithASCII(*it, "--", true /* case_sensitive */)) { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2464 } | 2464 } |
2465 | 2465 |
2466 const Experiment* GetExperiments(size_t* count) { | 2466 const Experiment* GetExperiments(size_t* count) { |
2467 *count = num_experiments; | 2467 *count = num_experiments; |
2468 return experiments; | 2468 return experiments; |
2469 } | 2469 } |
2470 | 2470 |
2471 } // namespace testing | 2471 } // namespace testing |
2472 | 2472 |
2473 } // namespace about_flags | 2473 } // namespace about_flags |
OLD | NEW |