Disable UserAddingScreenTest.AddingSeveralUsers, very flaky.
[chromium-blink-merge.git] / content / child / runtime_features.cc
blobfa6346c3d552827c026c03b8ccd1c576fae437dc
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
3 // found in the LICENSE file.
5 #include "content/child/runtime_features.h"
7 #include "base/command_line.h"
8 #include "content/common/content_switches_internal.h"
9 #include "content/public/common/content_switches.h"
10 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
11 #include "ui/native_theme/native_theme_switches.h"
13 #if defined(OS_ANDROID)
14 #include <cpu-features.h>
15 #include "media/base/android/media_codec_bridge.h"
16 #endif
18 using blink::WebRuntimeFeatures;
20 namespace content {
22 static void SetRuntimeFeatureDefaultsForPlatform() {
23 #if defined(OS_ANDROID)
24 // MSE/EME implementation needs Android MediaCodec API.
25 if (!media::MediaCodecBridge::IsAvailable()) {
26 WebRuntimeFeatures::enableMediaSource(false);
27 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false);
28 WebRuntimeFeatures::enableEncryptedMedia(false);
30 // WebAudio is enabled by default on ARM and X86 and only when the
31 // MediaCodec API is available.
32 WebRuntimeFeatures::enableWebAudio(
33 media::MediaCodecBridge::IsAvailable() &&
34 ((android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) ||
35 (android_getCpuFamily() == ANDROID_CPU_FAMILY_X86)));
36 // Android does not support the Gamepad API.
37 WebRuntimeFeatures::enableGamepad(false);
38 // Android does not have support for PagePopup
39 WebRuntimeFeatures::enablePagePopup(false);
40 // Android does not yet support the Web Notification API. crbug.com/115320
41 WebRuntimeFeatures::enableNotifications(false);
42 // Android does not yet support SharedWorker. crbug.com/154571
43 WebRuntimeFeatures::enableSharedWorker(false);
44 // Android does not yet support NavigatorContentUtils.
45 WebRuntimeFeatures::enableNavigatorContentUtils(false);
46 WebRuntimeFeatures::enableTouchIconLoading(true);
47 WebRuntimeFeatures::enableOrientationEvent(true);
48 #else
49 WebRuntimeFeatures::enableNavigatorContentUtils(true);
50 #endif // defined(OS_ANDROID)
53 void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
54 const CommandLine& command_line) {
55 if (command_line.HasSwitch(switches::kEnableExperimentalWebPlatformFeatures))
56 WebRuntimeFeatures::enableExperimentalFeatures(true);
58 SetRuntimeFeatureDefaultsForPlatform();
60 if (command_line.HasSwitch(switches::kDisableDatabases))
61 WebRuntimeFeatures::enableDatabase(false);
63 if (command_line.HasSwitch(switches::kDisableApplicationCache))
64 WebRuntimeFeatures::enableApplicationCache(false);
66 if (command_line.HasSwitch(switches::kDisableDesktopNotifications))
67 WebRuntimeFeatures::enableNotifications(false);
69 if (command_line.HasSwitch(switches::kDisableNavigatorContentUtils))
70 WebRuntimeFeatures::enableNavigatorContentUtils(false);
72 if (command_line.HasSwitch(switches::kDisableLocalStorage))
73 WebRuntimeFeatures::enableLocalStorage(false);
75 if (command_line.HasSwitch(switches::kDisableSessionStorage))
76 WebRuntimeFeatures::enableSessionStorage(false);
78 if (command_line.HasSwitch(switches::kDisableMediaSource))
79 WebRuntimeFeatures::enableMediaSource(false);
81 if (command_line.HasSwitch(switches::kDisableSharedWorkers))
82 WebRuntimeFeatures::enableSharedWorker(false);
84 #if defined(OS_ANDROID)
85 if (command_line.HasSwitch(switches::kDisableWebRTC)) {
86 WebRuntimeFeatures::enableMediaStream(false);
87 WebRuntimeFeatures::enablePeerConnection(false);
90 if (!command_line.HasSwitch(switches::kEnableSpeechRecognition))
91 WebRuntimeFeatures::enableScriptedSpeech(false);
92 #endif
94 if (command_line.HasSwitch(switches::kEnableServiceWorker))
95 WebRuntimeFeatures::enableServiceWorker(true);
97 #if defined(OS_ANDROID)
98 // WebAudio is enabled by default on ARM and X86, if the MediaCodec
99 // API is available.
100 WebRuntimeFeatures::enableWebAudio(
101 !command_line.HasSwitch(switches::kDisableWebAudio) &&
102 media::MediaCodecBridge::IsAvailable());
103 #else
104 if (command_line.HasSwitch(switches::kDisableWebAudio))
105 WebRuntimeFeatures::enableWebAudio(false);
106 #endif
108 if (command_line.HasSwitch(switches::kEnableEncryptedMedia))
109 WebRuntimeFeatures::enableEncryptedMedia(true);
111 if (command_line.HasSwitch(switches::kDisablePrefixedEncryptedMedia))
112 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false);
114 if (command_line.HasSwitch(switches::kEnableWebAnimationsSVG))
115 WebRuntimeFeatures::enableWebAnimationsSVG(true);
117 if (command_line.HasSwitch(switches::kEnableWebMIDI))
118 WebRuntimeFeatures::enableWebMIDI(true);
120 if (command_line.HasSwitch(switches::kDisableSpeechInput))
121 WebRuntimeFeatures::enableSpeechInput(false);
123 if (command_line.HasSwitch(switches::kDisableFileSystem))
124 WebRuntimeFeatures::enableFileSystem(false);
126 if (command_line.HasSwitch(switches::kEnableExperimentalCanvasFeatures))
127 WebRuntimeFeatures::enableExperimentalCanvasFeatures(true);
129 if (command_line.HasSwitch(switches::kEnableSpeechSynthesis))
130 WebRuntimeFeatures::enableSpeechSynthesis(true);
132 if (command_line.HasSwitch(switches::kEnableWebGLDraftExtensions))
133 WebRuntimeFeatures::enableWebGLDraftExtensions(true);
135 if (command_line.HasSwitch(switches::kEnableOverlayFullscreenVideo))
136 WebRuntimeFeatures::enableOverlayFullscreenVideo(true);
138 if (ui::IsOverlayScrollbarEnabled())
139 WebRuntimeFeatures::enableOverlayScrollbars(true);
141 if (command_line.HasSwitch(switches::kEnableFastTextAutosizing)
142 && !command_line.HasSwitch(switches::kDisableFastTextAutosizing))
143 WebRuntimeFeatures::enableFastTextAutosizing(true);
145 if (command_line.HasSwitch(switches::kDisableRepaintAfterLayout))
146 WebRuntimeFeatures::enableRepaintAfterLayout(false);
148 if (command_line.HasSwitch(switches::kEnableRepaintAfterLayout))
149 WebRuntimeFeatures::enableRepaintAfterLayout(true);
151 if (command_line.HasSwitch(switches::kEnableTargetedStyleRecalc))
152 WebRuntimeFeatures::enableTargetedStyleRecalc(true);
154 if (command_line.HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths))
155 WebRuntimeFeatures::enableBleedingEdgeFastPaths(true);
158 } // namespace content