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/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "base/metrics/sparse_histogram.h" | 14 #include "base/metrics/sparse_histogram.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
21 #include "chrome/browser/flags_storage.h" | 21 #include "chrome/browser/flags_storage.h" |
22 #include "chrome/common/chrome_content_client.h" | 22 #include "chrome/common/chrome_content_client.h" |
23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/chrome_version_info.h" |
24 #include "chrome/grit/chromium_strings.h" | 25 #include "chrome/grit/chromium_strings.h" |
25 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
26 #include "chrome/grit/google_chrome_strings.h" | 27 #include "chrome/grit/google_chrome_strings.h" |
27 #include "components/autofill/core/common/autofill_switches.h" | 28 #include "components/autofill/core/common/autofill_switches.h" |
28 #include "components/cloud_devices/common/cloud_devices_switches.h" | 29 #include "components/cloud_devices/common/cloud_devices_switches.h" |
29 #include "components/dom_distiller/core/dom_distiller_switches.h" | 30 #include "components/dom_distiller/core/dom_distiller_switches.h" |
30 #include "components/metrics/metrics_hashes.h" | 31 #include "components/metrics/metrics_hashes.h" |
31 #include "components/nacl/common/nacl_switches.h" | 32 #include "components/nacl/common/nacl_switches.h" |
32 #include "components/omnibox/omnibox_switches.h" | 33 #include "components/omnibox/omnibox_switches.h" |
33 #include "components/plugins/common/plugins_switches.h" | 34 #include "components/plugins/common/plugins_switches.h" |
34 #include "components/proximity_auth/switches.h" | 35 #include "components/proximity_auth/switches.h" |
35 #include "components/search/search_switches.h" | 36 #include "components/search/search_switches.h" |
36 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
37 #include "media/base/media_switches.h" | 38 #include "media/base/media_switches.h" |
38 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
39 #include "ui/base/ui_base_switches.h" | 40 #include "ui/base/ui_base_switches.h" |
40 #include "ui/display/display_switches.h" | 41 #include "ui/display/display_switches.h" |
41 #include "ui/events/event_switches.h" | 42 #include "ui/events/event_switches.h" |
42 #include "ui/gfx/switches.h" | 43 #include "ui/gfx/switches.h" |
43 #include "ui/gl/gl_switches.h" | 44 #include "ui/gl/gl_switches.h" |
44 #include "ui/keyboard/keyboard_switches.h" | 45 #include "ui/keyboard/keyboard_switches.h" |
45 #include "ui/native_theme/native_theme_switches.h" | 46 #include "ui/native_theme/native_theme_switches.h" |
46 #include "ui/views/views_switches.h" | 47 #include "ui/views/views_switches.h" |
47 | 48 |
48 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
49 #include "chrome/common/chrome_version_info.h" | |
50 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 50 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
51 #else | 51 #else |
52 #include "ui/message_center/message_center_switches.h" | 52 #include "ui/message_center/message_center_switches.h" |
53 #endif | 53 #endif |
54 | 54 |
55 #if defined(USE_ASH) | 55 #if defined(USE_ASH) |
56 #include "ash/ash_switches.h" | 56 #include "ash/ash_switches.h" |
57 #endif | 57 #endif |
58 | 58 |
59 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 } | 2092 } |
2093 | 2093 |
2094 void GetSanitizedEnabledFlags( | 2094 void GetSanitizedEnabledFlags( |
2095 FlagsStorage* flags_storage, std::set<std::string>* result) { | 2095 FlagsStorage* flags_storage, std::set<std::string>* result) { |
2096 SanitizeList(flags_storage); | 2096 SanitizeList(flags_storage); |
2097 *result = flags_storage->GetFlags(); | 2097 *result = flags_storage->GetFlags(); |
2098 } | 2098 } |
2099 | 2099 |
2100 bool SkipConditionalExperiment(const Experiment& experiment, | 2100 bool SkipConditionalExperiment(const Experiment& experiment, |
2101 FlagsStorage* flags_storage) { | 2101 FlagsStorage* flags_storage) { |
2102 #if defined(OS_ANDROID) || defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | |
2103 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 2102 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
2104 #endif | |
2105 | 2103 |
2106 #if defined(OS_ANDROID) | 2104 #if defined(OS_ANDROID) |
2107 // enable-data-reduction-proxy-dev is only available for the Dev/Beta channel. | 2105 // enable-data-reduction-proxy-dev is only available for the Dev/Beta channel. |
2108 if (!strcmp("enable-data-reduction-proxy-dev", experiment.internal_name) && | 2106 if (!strcmp("enable-data-reduction-proxy-dev", experiment.internal_name) && |
2109 channel != chrome::VersionInfo::CHANNEL_BETA && | 2107 channel != chrome::VersionInfo::CHANNEL_BETA && |
2110 channel != chrome::VersionInfo::CHANNEL_DEV) { | 2108 channel != chrome::VersionInfo::CHANNEL_DEV) { |
2111 return true; | 2109 return true; |
2112 } | 2110 } |
2113 // enable-data-reduction-proxy-alt is only available for the Dev channel. | 2111 // enable-data-reduction-proxy-alt is only available for the Dev channel. |
2114 if (!strcmp("enable-data-reduction-proxy-alt", experiment.internal_name) && | 2112 if (!strcmp("enable-data-reduction-proxy-alt", experiment.internal_name) && |
2115 channel != chrome::VersionInfo::CHANNEL_DEV) { | 2113 channel != chrome::VersionInfo::CHANNEL_DEV) { |
2116 return true; | 2114 return true; |
2117 } | 2115 } |
2118 // data-reduction-proxy-lo-fi is only available for Chromium builds and | |
2119 // the Canary/Dev channel. | |
2120 if (!strcmp("data-reduction-proxy-lo-fi", experiment.internal_name) && | |
2121 channel != chrome::VersionInfo::CHANNEL_DEV && | |
2122 channel != chrome::VersionInfo::CHANNEL_CANARY && | |
2123 channel != chrome::VersionInfo::CHANNEL_UNKNOWN) { | |
2124 return true; | |
2125 } | |
2126 // enable-data-reduction-proxy-carrier-test is only available for Chromium | 2116 // enable-data-reduction-proxy-carrier-test is only available for Chromium |
2127 // builds and the Canary/Dev channel. | 2117 // builds and the Canary/Dev channel. |
2128 if (!strcmp("enable-data-reduction-proxy-carrier-test", | 2118 if (!strcmp("enable-data-reduction-proxy-carrier-test", |
2129 experiment.internal_name) && | 2119 experiment.internal_name) && |
2130 channel != chrome::VersionInfo::CHANNEL_DEV && | 2120 channel != chrome::VersionInfo::CHANNEL_DEV && |
2131 channel != chrome::VersionInfo::CHANNEL_CANARY && | 2121 channel != chrome::VersionInfo::CHANNEL_CANARY && |
2132 channel != chrome::VersionInfo::CHANNEL_UNKNOWN) { | 2122 channel != chrome::VersionInfo::CHANNEL_UNKNOWN) { |
2133 return true; | 2123 return true; |
2134 } | 2124 } |
2135 #endif | 2125 #endif |
2136 | 2126 |
| 2127 // data-reduction-proxy-lo-fi is only available for Chromium builds and |
| 2128 // the Canary/Dev channel. |
| 2129 if (!strcmp("data-reduction-proxy-lo-fi", experiment.internal_name) && |
| 2130 channel != chrome::VersionInfo::CHANNEL_DEV && |
| 2131 channel != chrome::VersionInfo::CHANNEL_CANARY && |
| 2132 channel != chrome::VersionInfo::CHANNEL_UNKNOWN) { |
| 2133 return true; |
| 2134 } |
| 2135 |
2137 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | 2136 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
2138 // enable-data-reduction-proxy-bypass-warning is only available for Chromium | 2137 // enable-data-reduction-proxy-bypass-warning is only available for Chromium |
2139 // builds and Canary/Dev channel. | 2138 // builds and Canary/Dev channel. |
2140 if (!strcmp("enable-data-reduction-proxy-bypass-warnings", | 2139 if (!strcmp("enable-data-reduction-proxy-bypass-warnings", |
2141 experiment.internal_name) && | 2140 experiment.internal_name) && |
2142 channel != chrome::VersionInfo::CHANNEL_UNKNOWN && | 2141 channel != chrome::VersionInfo::CHANNEL_UNKNOWN && |
2143 channel != chrome::VersionInfo::CHANNEL_CANARY && | 2142 channel != chrome::VersionInfo::CHANNEL_CANARY && |
2144 channel != chrome::VersionInfo::CHANNEL_DEV) { | 2143 channel != chrome::VersionInfo::CHANNEL_DEV) { |
2145 return true; | 2144 return true; |
2146 } | 2145 } |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 } | 2598 } |
2600 | 2599 |
2601 const Experiment* GetExperiments(size_t* count) { | 2600 const Experiment* GetExperiments(size_t* count) { |
2602 *count = num_experiments; | 2601 *count = num_experiments; |
2603 return experiments; | 2602 return experiments; |
2604 } | 2603 } |
2605 | 2604 |
2606 } // namespace testing | 2605 } // namespace testing |
2607 | 2606 |
2608 } // namespace about_flags | 2607 } // namespace about_flags |
OLD | NEW |