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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 base::FeatureList::IsEnabled(features::kAccessibilityObjectModel)); | 326 base::FeatureList::IsEnabled(features::kAccessibilityObjectModel)); |
327 | 327 |
328 #if defined(OS_ANDROID) | 328 #if defined(OS_ANDROID) |
329 if (command_line.HasSwitch(switches::kDisableMediaSessionAPI)) | 329 if (command_line.HasSwitch(switches::kDisableMediaSessionAPI)) |
330 WebRuntimeFeatures::EnableMediaSession(false); | 330 WebRuntimeFeatures::EnableMediaSession(false); |
331 | 331 |
332 WebRuntimeFeatures::EnablePaymentRequest( | 332 WebRuntimeFeatures::EnablePaymentRequest( |
333 base::FeatureList::IsEnabled(features::kWebPayments)); | 333 base::FeatureList::IsEnabled(features::kWebPayments)); |
334 #endif | 334 #endif |
335 | 335 |
336 // Sets the RuntimeEnabledFeatures for Navigation Preload feature only when | 336 WebRuntimeFeatures::EnableServiceWorkerNavigationPreload( |
337 // '--enable-features' command line flag is given. While experimenting this | 337 base::FeatureList::IsEnabled(features::kServiceWorkerNavigationPreload)); |
338 // feature using Origin-Trial, this base::Feature is enabled by default in | |
339 // content_features.cc. So FeatureList::IsEnabled() always returns true. But, | |
340 // unless the command line explicitly enabled the feature, this feature should | |
341 // be available only when a valid origin trial token is set. This check is | |
342 // done by the generated code of | |
343 // blink::OriginTrials::serviceWorkerNavigationPreloadEnabled(). See the | |
344 // comments in service_worker_version.h for the details. | |
345 if (base::FeatureList::GetInstance()->IsFeatureOverriddenFromCommandLine( | |
346 features::kServiceWorkerNavigationPreload.name, | |
347 base::FeatureList::OVERRIDE_ENABLE_FEATURE)) { | |
348 WebRuntimeFeatures::EnableServiceWorkerNavigationPreload(true); | |
349 } | |
350 | 338 |
351 if (base::FeatureList::IsEnabled(features::kGamepadExtensions)) | 339 if (base::FeatureList::IsEnabled(features::kGamepadExtensions)) |
352 WebRuntimeFeatures::EnableGamepadExtensions(true); | 340 WebRuntimeFeatures::EnableGamepadExtensions(true); |
353 | 341 |
354 if (base::FeatureList::IsEnabled(features::kCompositeOpaqueFixedPosition)) | 342 if (base::FeatureList::IsEnabled(features::kCompositeOpaqueFixedPosition)) |
355 WebRuntimeFeatures::EnableFeatureFromString("CompositeOpaqueFixedPosition", | 343 WebRuntimeFeatures::EnableFeatureFromString("CompositeOpaqueFixedPosition", |
356 true); | 344 true); |
357 | 345 |
358 if (!base::FeatureList::IsEnabled(features::kCompositeOpaqueScrollers)) | 346 if (!base::FeatureList::IsEnabled(features::kCompositeOpaqueScrollers)) |
359 WebRuntimeFeatures::EnableFeatureFromString("CompositeOpaqueScrollers", | 347 WebRuntimeFeatures::EnableFeatureFromString("CompositeOpaqueScrollers", |
(...skipping 28 matching lines...) Expand all Loading... |
388 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { | 376 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { |
389 std::vector<std::string> disabled_features = base::SplitString( | 377 std::vector<std::string> disabled_features = base::SplitString( |
390 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), | 378 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), |
391 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 379 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
392 for (const std::string& feature : disabled_features) | 380 for (const std::string& feature : disabled_features) |
393 WebRuntimeFeatures::EnableFeatureFromString(feature, false); | 381 WebRuntimeFeatures::EnableFeatureFromString(feature, false); |
394 } | 382 } |
395 } | 383 } |
396 | 384 |
397 } // namespace content | 385 } // namespace content |
OLD | NEW |