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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/feature_list.h" | 15 #include "base/feature_list.h" |
16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/metrics/metrics_hashes.h" |
17 #include "base/metrics/sparse_histogram.h" | 18 #include "base/metrics/sparse_histogram.h" |
18 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
19 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
22 #include "base/values.h" | 23 #include "base/values.h" |
23 #include "cc/base/switches.h" | 24 #include "cc/base/switches.h" |
24 #include "chrome/common/channel_info.h" | 25 #include "chrome/common/channel_info.h" |
25 #include "chrome/common/chrome_content_client.h" | 26 #include "chrome/common/chrome_content_client.h" |
26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/grit/chromium_strings.h" | 28 #include "chrome/grit/chromium_strings.h" |
28 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
29 #include "chrome/grit/google_chrome_strings.h" | 30 #include "chrome/grit/google_chrome_strings.h" |
30 #include "components/autofill/core/common/autofill_switches.h" | 31 #include "components/autofill/core/common/autofill_switches.h" |
31 #include "components/browser_sync/common/browser_sync_switches.h" | 32 #include "components/browser_sync/common/browser_sync_switches.h" |
32 #include "components/cloud_devices/common/cloud_devices_switches.h" | 33 #include "components/cloud_devices/common/cloud_devices_switches.h" |
33 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 34 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
34 #include "components/dom_distiller/core/dom_distiller_switches.h" | 35 #include "components/dom_distiller/core/dom_distiller_switches.h" |
35 #include "components/enhanced_bookmarks/enhanced_bookmark_switches.h" | 36 #include "components/enhanced_bookmarks/enhanced_bookmark_switches.h" |
36 #include "components/flags_ui/feature_entry_macros.h" | 37 #include "components/flags_ui/feature_entry_macros.h" |
37 #include "components/flags_ui/flags_storage.h" | 38 #include "components/flags_ui/flags_storage.h" |
38 #include "components/flags_ui/flags_ui_switches.h" | 39 #include "components/flags_ui/flags_ui_switches.h" |
39 #include "components/metrics/metrics_hashes.h" | |
40 #include "components/nacl/common/nacl_switches.h" | 40 #include "components/nacl/common/nacl_switches.h" |
41 #include "components/offline_pages/offline_page_switches.h" | 41 #include "components/offline_pages/offline_page_switches.h" |
42 #include "components/omnibox/browser/omnibox_switches.h" | 42 #include "components/omnibox/browser/omnibox_switches.h" |
43 #include "components/password_manager/core/common/password_manager_switches.h" | 43 #include "components/password_manager/core/common/password_manager_switches.h" |
44 #include "components/proximity_auth/switches.h" | 44 #include "components/proximity_auth/switches.h" |
45 #include "components/search/search_switches.h" | 45 #include "components/search/search_switches.h" |
46 #include "components/signin/core/common/signin_switches.h" | 46 #include "components/signin/core/common/signin_switches.h" |
47 #include "components/sync_driver/sync_driver_switches.h" | 47 #include "components/sync_driver/sync_driver_switches.h" |
48 #include "components/tracing/tracing_switches.h" | 48 #include "components/tracing/tracing_switches.h" |
49 #include "components/version_info/version_info.h" | 49 #include "components/version_info/version_info.h" |
(...skipping 2174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2224 } | 2224 } |
2225 // Since flag metrics are recorded every startup, add a tick so that the | 2225 // Since flag metrics are recorded every startup, add a tick so that the |
2226 // stats can be made meaningful. | 2226 // stats can be made meaningful. |
2227 if (flags.size()) | 2227 if (flags.size()) |
2228 content::RecordAction(base::UserMetricsAction("AboutFlags_StartupTick")); | 2228 content::RecordAction(base::UserMetricsAction("AboutFlags_StartupTick")); |
2229 content::RecordAction(base::UserMetricsAction("StartupTick")); | 2229 content::RecordAction(base::UserMetricsAction("StartupTick")); |
2230 } | 2230 } |
2231 | 2231 |
2232 base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) { | 2232 base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) { |
2233 return static_cast<base::HistogramBase::Sample>( | 2233 return static_cast<base::HistogramBase::Sample>( |
2234 metrics::HashMetricName(switch_name)); | 2234 base::HashMetricName(switch_name)); |
2235 } | 2235 } |
2236 | 2236 |
2237 void ReportCustomFlags(const std::string& uma_histogram_hame, | 2237 void ReportCustomFlags(const std::string& uma_histogram_hame, |
2238 const std::set<std::string>& command_line_difference) { | 2238 const std::set<std::string>& command_line_difference) { |
2239 for (const std::string& flag : command_line_difference) { | 2239 for (const std::string& flag : command_line_difference) { |
2240 int uma_id = about_flags::testing::kBadSwitchFormatHistogramId; | 2240 int uma_id = about_flags::testing::kBadSwitchFormatHistogramId; |
2241 if (base::StartsWith(flag, "--", base::CompareCase::SENSITIVE)) { | 2241 if (base::StartsWith(flag, "--", base::CompareCase::SENSITIVE)) { |
2242 // Skip '--' before switch name. | 2242 // Skip '--' before switch name. |
2243 std::string switch_name(flag.substr(2)); | 2243 std::string switch_name(flag.substr(2)); |
2244 | 2244 |
(...skipping 21 matching lines...) Expand all Loading... |
2266 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; | 2266 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; |
2267 | 2267 |
2268 const FeatureEntry* GetFeatureEntries(size_t* count) { | 2268 const FeatureEntry* GetFeatureEntries(size_t* count) { |
2269 *count = arraysize(kFeatureEntries); | 2269 *count = arraysize(kFeatureEntries); |
2270 return kFeatureEntries; | 2270 return kFeatureEntries; |
2271 } | 2271 } |
2272 | 2272 |
2273 } // namespace testing | 2273 } // namespace testing |
2274 | 2274 |
2275 } // namespace about_flags | 2275 } // namespace about_flags |
OLD | NEW |