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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/common/content_switches_internal.h" | 8 #include "content/common/content_switches_internal.h" |
9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
10 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 10 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
11 #include "ui/native_theme/native_theme_switches.h" | 11 #include "ui/native_theme/native_theme_switches.h" |
12 | 12 |
13 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
14 #include <cpu-features.h> | 14 #include <cpu-features.h> |
| 15 #include "base/android/build_info.h" |
15 #include "media/base/android/media_codec_bridge.h" | 16 #include "media/base/android/media_codec_bridge.h" |
16 #endif | 17 #endif |
17 | 18 |
18 using blink::WebRuntimeFeatures; | 19 using blink::WebRuntimeFeatures; |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 static void SetRuntimeFeatureDefaultsForPlatform() { | 23 static void SetRuntimeFeatureDefaultsForPlatform() { |
23 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
24 // MSE/EME implementation needs Android MediaCodec API. | 25 // MSE/EME implementation needs Android MediaCodec API. |
25 if (!media::MediaCodecBridge::IsAvailable()) { | 26 if (!media::MediaCodecBridge::IsAvailable()) { |
26 WebRuntimeFeatures::enableMediaSource(false); | 27 WebRuntimeFeatures::enableMediaSource(false); |
27 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false); | 28 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false); |
28 WebRuntimeFeatures::enableEncryptedMedia(false); | 29 WebRuntimeFeatures::enableEncryptedMedia(false); |
29 } | 30 } |
30 // WebAudio is enabled by default on ARM and X86 and only when the | 31 // WebAudio is enabled by default on ARM and X86 and only when the |
31 // MediaCodec API is available. | 32 // MediaCodec API is available. |
32 WebRuntimeFeatures::enableWebAudio( | 33 WebRuntimeFeatures::enableWebAudio( |
33 media::MediaCodecBridge::IsAvailable() && | 34 media::MediaCodecBridge::IsAvailable() && |
34 ((android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) || | 35 ((android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) || |
35 (android_getCpuFamily() == ANDROID_CPU_FAMILY_X86))); | 36 (android_getCpuFamily() == ANDROID_CPU_FAMILY_X86))); |
36 // Android does not support the Gamepad API. | 37 |
37 WebRuntimeFeatures::enableGamepad(false); | 38 // Android supports gamepad API for JellyBean and beyond |
| 39 WebRuntimeFeatures::enableGamepad( |
| 40 base::android::BuildInfo::GetInstance()->sdk_int() >= 16); |
38 // Android does not have support for PagePopup | 41 // Android does not have support for PagePopup |
39 WebRuntimeFeatures::enablePagePopup(false); | 42 WebRuntimeFeatures::enablePagePopup(false); |
40 // Android does not yet support the Web Notification API. crbug.com/115320 | 43 // Android does not yet support the Web Notification API. crbug.com/115320 |
41 WebRuntimeFeatures::enableNotifications(false); | 44 WebRuntimeFeatures::enableNotifications(false); |
42 // Android does not yet support SharedWorker. crbug.com/154571 | 45 // Android does not yet support SharedWorker. crbug.com/154571 |
43 WebRuntimeFeatures::enableSharedWorker(false); | 46 WebRuntimeFeatures::enableSharedWorker(false); |
44 // Android does not yet support NavigatorContentUtils. | 47 // Android does not yet support NavigatorContentUtils. |
45 WebRuntimeFeatures::enableNavigatorContentUtils(false); | 48 WebRuntimeFeatures::enableNavigatorContentUtils(false); |
46 WebRuntimeFeatures::enableTouchIconLoading(true); | 49 WebRuntimeFeatures::enableTouchIconLoading(true); |
47 WebRuntimeFeatures::enableOrientationEvent(true); | 50 WebRuntimeFeatures::enableOrientationEvent(true); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 WebRuntimeFeatures::enableBleedingEdgeFastPaths(true); | 160 WebRuntimeFeatures::enableBleedingEdgeFastPaths(true); |
158 | 161 |
159 if (command_line.HasSwitch(switches::kEnablePreciseMemoryInfo)) | 162 if (command_line.HasSwitch(switches::kEnablePreciseMemoryInfo)) |
160 WebRuntimeFeatures::enablePreciseMemoryInfo(true); | 163 WebRuntimeFeatures::enablePreciseMemoryInfo(true); |
161 | 164 |
162 if (command_line.HasSwitch(switches::kEnableLayerSquashing)) | 165 if (command_line.HasSwitch(switches::kEnableLayerSquashing)) |
163 WebRuntimeFeatures::enableLayerSquashing(true); | 166 WebRuntimeFeatures::enableLayerSquashing(true); |
164 } | 167 } |
165 | 168 |
166 } // namespace content | 169 } // namespace content |
OLD | NEW |