OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/child/runtime_features.h" | 5 #include "content/child/runtime_features.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #endif | 51 #endif |
52 | 52 |
53 #if !(defined OS_ANDROID || defined OS_CHROMEOS) | 53 #if !(defined OS_ANDROID || defined OS_CHROMEOS) |
54 // Only Android, ChromeOS support NetInfo right now. | 54 // Only Android, ChromeOS support NetInfo right now. |
55 WebRuntimeFeatures::enableNetworkInformation(false); | 55 WebRuntimeFeatures::enableNetworkInformation(false); |
56 #endif | 56 #endif |
57 } | 57 } |
58 | 58 |
59 void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( | 59 void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( |
60 const base::CommandLine& command_line) { | 60 const base::CommandLine& command_line) { |
61 if (command_line.HasSwitch(switches::kEnableExperimentalWebPlatformFeatures)) | 61 bool enableExperimentalWebPlatformFeatures = command_line.HasSwitch( |
| 62 switches::kEnableExperimentalWebPlatformFeatures); |
| 63 if (enableExperimentalWebPlatformFeatures) |
62 WebRuntimeFeatures::enableExperimentalFeatures(true); | 64 WebRuntimeFeatures::enableExperimentalFeatures(true); |
63 | 65 |
64 WebRuntimeFeatures::enableOriginTrials( | 66 WebRuntimeFeatures::enableOriginTrials( |
65 base::FeatureList::IsEnabled(features::kOriginTrials)); | 67 base::FeatureList::IsEnabled(features::kOriginTrials)); |
66 | 68 |
67 WebRuntimeFeatures::enableFeaturePolicy( | 69 WebRuntimeFeatures::enableFeaturePolicy( |
68 base::FeatureList::IsEnabled(features::kFeaturePolicy)); | 70 base::FeatureList::IsEnabled(features::kFeaturePolicy)); |
69 | 71 |
70 if (command_line.HasSwitch(switches::kEnableWebBluetooth)) | 72 if (command_line.HasSwitch(switches::kEnableWebBluetooth)) |
71 WebRuntimeFeatures::enableWebBluetooth(true); | 73 WebRuntimeFeatures::enableWebBluetooth(true); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if (command_line.HasSwitch(switches::kForceOverlayFullscreenVideo)) | 159 if (command_line.HasSwitch(switches::kForceOverlayFullscreenVideo)) |
158 WebRuntimeFeatures::forceOverlayFullscreenVideo(true); | 160 WebRuntimeFeatures::forceOverlayFullscreenVideo(true); |
159 | 161 |
160 if (ui::IsOverlayScrollbarEnabled()) | 162 if (ui::IsOverlayScrollbarEnabled()) |
161 WebRuntimeFeatures::enableOverlayScrollbars(true); | 163 WebRuntimeFeatures::enableOverlayScrollbars(true); |
162 | 164 |
163 if (command_line.HasSwitch(switches::kEnablePreciseMemoryInfo)) | 165 if (command_line.HasSwitch(switches::kEnablePreciseMemoryInfo)) |
164 WebRuntimeFeatures::enablePreciseMemoryInfo(true); | 166 WebRuntimeFeatures::enablePreciseMemoryInfo(true); |
165 | 167 |
166 if (command_line.HasSwitch(switches::kEnableNetworkInformation) || | 168 if (command_line.HasSwitch(switches::kEnableNetworkInformation) || |
167 command_line.HasSwitch( | 169 enableExperimentalWebPlatformFeatures) { |
168 switches::kEnableExperimentalWebPlatformFeatures)) { | |
169 WebRuntimeFeatures::enableNetworkInformation(true); | 170 WebRuntimeFeatures::enableNetworkInformation(true); |
170 } | 171 } |
171 | 172 |
172 if (!base::FeatureList::IsEnabled(features::kCredentialManagementAPI)) | 173 if (!base::FeatureList::IsEnabled(features::kCredentialManagementAPI)) |
173 WebRuntimeFeatures::enableCredentialManagerAPI(false); | 174 WebRuntimeFeatures::enableCredentialManagerAPI(false); |
174 | 175 |
175 if (command_line.HasSwitch(switches::kReducedReferrerGranularity)) | 176 if (command_line.HasSwitch(switches::kReducedReferrerGranularity)) |
176 WebRuntimeFeatures::enableReducedReferrerGranularity(true); | 177 WebRuntimeFeatures::enableReducedReferrerGranularity(true); |
177 | 178 |
178 if (command_line.HasSwitch(switches::kRootLayerScrolls)) | 179 if (command_line.HasSwitch(switches::kRootLayerScrolls)) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 switches::kEnableWebFontsInterventionV2SwitchValueEnabledWith3G, | 224 switches::kEnableWebFontsInterventionV2SwitchValueEnabledWith3G, |
224 base::CompareCase::INSENSITIVE_ASCII)); | 225 base::CompareCase::INSENSITIVE_ASCII)); |
225 WebRuntimeFeatures::enableWebFontsInterventionV2WithSlow2G(base::StartsWith( | 226 WebRuntimeFeatures::enableWebFontsInterventionV2WithSlow2G(base::StartsWith( |
226 webfonts_intervention_v2_group_name, | 227 webfonts_intervention_v2_group_name, |
227 switches::kEnableWebFontsInterventionV2SwitchValueEnabledWithSlow2G, | 228 switches::kEnableWebFontsInterventionV2SwitchValueEnabledWithSlow2G, |
228 base::CompareCase::INSENSITIVE_ASCII)); | 229 base::CompareCase::INSENSITIVE_ASCII)); |
229 } | 230 } |
230 if (command_line.HasSwitch(switches::kEnableWebFontsInterventionTrigger)) | 231 if (command_line.HasSwitch(switches::kEnableWebFontsInterventionTrigger)) |
231 WebRuntimeFeatures::enableWebFontsInterventionTrigger(true); | 232 WebRuntimeFeatures::enableWebFontsInterventionTrigger(true); |
232 | 233 |
233 if (base::FeatureList::IsEnabled(features::kScrollAnchoring)) | 234 WebRuntimeFeatures::enableScrollAnchoring( |
234 WebRuntimeFeatures::enableScrollAnchoring(true); | 235 base::FeatureList::IsEnabled(features::kScrollAnchoring) || |
| 236 enableExperimentalWebPlatformFeatures); |
235 | 237 |
236 if (command_line.HasSwitch(switches::kEnableSlimmingPaintV2)) | 238 if (command_line.HasSwitch(switches::kEnableSlimmingPaintV2)) |
237 WebRuntimeFeatures::enableSlimmingPaintV2(true); | 239 WebRuntimeFeatures::enableSlimmingPaintV2(true); |
238 | 240 |
239 // Note that it might already by true for OS_ANDROID, above. This is for | 241 // Note that it might already by true for OS_ANDROID, above. This is for |
240 // non-android versions. | 242 // non-android versions. |
241 if (base::FeatureList::IsEnabled(features::kNewMediaPlaybackUi)) | 243 if (base::FeatureList::IsEnabled(features::kNewMediaPlaybackUi)) |
242 WebRuntimeFeatures::enableNewMediaPlaybackUi(true); | 244 WebRuntimeFeatures::enableNewMediaPlaybackUi(true); |
243 | 245 |
244 if (base::FeatureList::IsEnabled( | 246 if (base::FeatureList::IsEnabled( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { | 318 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { |
317 std::vector<std::string> disabled_features = base::SplitString( | 319 std::vector<std::string> disabled_features = base::SplitString( |
318 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), | 320 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), |
319 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 321 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
320 for (const std::string& feature : disabled_features) | 322 for (const std::string& feature : disabled_features) |
321 WebRuntimeFeatures::enableFeatureFromString(feature, false); | 323 WebRuntimeFeatures::enableFeatureFromString(feature, false); |
322 } | 324 } |
323 } | 325 } |
324 | 326 |
325 } // namespace content | 327 } // namespace content |
OLD | NEW |