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" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "content/common/content_switches_internal.h" | 15 #include "content/common/content_switches_internal.h" |
16 #include "content/public/common/content_features.h" | 16 #include "content/public/common/content_features.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 18 #include "media/base/media_switches.h" |
18 #include "services/device/public/cpp/device_features.h" | 19 #include "services/device/public/cpp/device_features.h" |
19 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 20 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
20 #include "ui/gl/gl_switches.h" | 21 #include "ui/gl/gl_switches.h" |
21 #include "ui/native_theme/native_theme_features.h" | 22 #include "ui/native_theme/native_theme_features.h" |
22 | 23 |
23 using blink::WebRuntimeFeatures; | 24 using blink::WebRuntimeFeatures; |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 | 27 |
27 static void SetRuntimeFeatureDefaultsForPlatform() { | 28 static void SetRuntimeFeatureDefaultsForPlatform() { |
(...skipping 14 matching lines...) Expand all Loading... |
42 WebRuntimeFeatures::EnableNotificationConstructor(false); | 43 WebRuntimeFeatures::EnableNotificationConstructor(false); |
43 // Android does not yet support switching of audio output devices | 44 // Android does not yet support switching of audio output devices |
44 WebRuntimeFeatures::EnableAudioOutputDevices(false); | 45 WebRuntimeFeatures::EnableAudioOutputDevices(false); |
45 WebRuntimeFeatures::EnableAutoplayMutedVideos(true); | 46 WebRuntimeFeatures::EnableAutoplayMutedVideos(true); |
46 // Android does not yet support SystemMonitor. | 47 // Android does not yet support SystemMonitor. |
47 WebRuntimeFeatures::EnableOnDeviceChange(false); | 48 WebRuntimeFeatures::EnableOnDeviceChange(false); |
48 WebRuntimeFeatures::EnableMediaSession(true); | 49 WebRuntimeFeatures::EnableMediaSession(true); |
49 WebRuntimeFeatures::EnableMediaControlsOverlayPlayButton(true); | 50 WebRuntimeFeatures::EnableMediaControlsOverlayPlayButton(true); |
50 #else // defined(OS_ANDROID) | 51 #else // defined(OS_ANDROID) |
51 WebRuntimeFeatures::EnableNavigatorContentUtils(true); | 52 WebRuntimeFeatures::EnableNavigatorContentUtils(true); |
52 if (base::FeatureList::IsEnabled( | |
53 features::kCrossOriginMediaPlaybackRequiresUserGesture)) { | |
54 WebRuntimeFeatures::EnableAutoplayMutedVideos(true); | |
55 } | |
56 #endif // defined(OS_ANDROID) | 53 #endif // defined(OS_ANDROID) |
57 | 54 |
58 #if defined(OS_ANDROID) || defined(USE_AURA) | 55 #if defined(OS_ANDROID) || defined(USE_AURA) |
59 WebRuntimeFeatures::EnableCompositedSelectionUpdate(true); | 56 WebRuntimeFeatures::EnableCompositedSelectionUpdate(true); |
60 #endif | 57 #endif |
61 | 58 |
62 #if !(defined OS_ANDROID || defined OS_CHROMEOS) | 59 #if !(defined OS_ANDROID || defined OS_CHROMEOS) |
63 // Only Android, ChromeOS support NetInfo right now. | 60 // Only Android, ChromeOS support NetInfo right now. |
64 WebRuntimeFeatures::EnableNetworkInformation(false); | 61 WebRuntimeFeatures::EnableNetworkInformation(false); |
65 #endif | 62 #endif |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 features::kAllowContentInitiatedDataUrlNavigations)); | 373 features::kAllowContentInitiatedDataUrlNavigations)); |
377 | 374 |
378 #if defined(OS_ANDROID) | 375 #if defined(OS_ANDROID) |
379 if (base::FeatureList::IsEnabled(features::kWebNfc)) | 376 if (base::FeatureList::IsEnabled(features::kWebNfc)) |
380 WebRuntimeFeatures::EnableWebNfc(true); | 377 WebRuntimeFeatures::EnableWebNfc(true); |
381 #endif | 378 #endif |
382 | 379 |
383 if (base::FeatureList::IsEnabled(features::kIdleTimeSpellChecking)) | 380 if (base::FeatureList::IsEnabled(features::kIdleTimeSpellChecking)) |
384 WebRuntimeFeatures::EnableFeatureFromString("IdleTimeSpellChecking", true); | 381 WebRuntimeFeatures::EnableFeatureFromString("IdleTimeSpellChecking", true); |
385 | 382 |
| 383 #if !defined(OS_ANDROID) |
| 384 if (command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) == |
| 385 switches::autoplay::kCrossOriginUserGestureRequiredPolicy) { |
| 386 WebRuntimeFeatures::EnableAutoplayMutedVideos(true); |
| 387 } |
| 388 #endif |
| 389 |
386 // Enable explicitly enabled features, and then disable explicitly disabled | 390 // Enable explicitly enabled features, and then disable explicitly disabled |
387 // ones. | 391 // ones. |
388 if (command_line.HasSwitch(switches::kEnableBlinkFeatures)) { | 392 if (command_line.HasSwitch(switches::kEnableBlinkFeatures)) { |
389 std::vector<std::string> enabled_features = base::SplitString( | 393 std::vector<std::string> enabled_features = base::SplitString( |
390 command_line.GetSwitchValueASCII(switches::kEnableBlinkFeatures), | 394 command_line.GetSwitchValueASCII(switches::kEnableBlinkFeatures), |
391 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 395 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
392 for (const std::string& feature : enabled_features) | 396 for (const std::string& feature : enabled_features) |
393 WebRuntimeFeatures::EnableFeatureFromString(feature, true); | 397 WebRuntimeFeatures::EnableFeatureFromString(feature, true); |
394 } | 398 } |
395 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { | 399 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { |
396 std::vector<std::string> disabled_features = base::SplitString( | 400 std::vector<std::string> disabled_features = base::SplitString( |
397 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), | 401 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), |
398 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 402 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
399 for (const std::string& feature : disabled_features) | 403 for (const std::string& feature : disabled_features) |
400 WebRuntimeFeatures::EnableFeatureFromString(feature, false); | 404 WebRuntimeFeatures::EnableFeatureFromString(feature, false); |
401 } | 405 } |
402 } | 406 } |
403 | 407 |
404 } // namespace content | 408 } // namespace content |
OLD | NEW |