Chromium Code Reviews| 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/android/build_info.h" | |
| 7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 8 #include "content/common/content_switches_internal.h" | 9 #include "content/common/content_switches_internal.h" |
| 9 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| 10 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 11 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 11 #include "ui/native_theme/native_theme_switches.h" | 12 #include "ui/native_theme/native_theme_switches.h" |
| 12 | 13 |
| 13 #if defined(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
| 14 #include <cpu-features.h> | 15 #include <cpu-features.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 WebRuntimeFeatures::enableSharedWorker(false); | 85 WebRuntimeFeatures::enableSharedWorker(false); |
| 83 | 86 |
| 84 #if defined(OS_ANDROID) | 87 #if defined(OS_ANDROID) |
| 85 if (command_line.HasSwitch(switches::kDisableWebRTC)) { | 88 if (command_line.HasSwitch(switches::kDisableWebRTC)) { |
| 86 WebRuntimeFeatures::enableMediaStream(false); | 89 WebRuntimeFeatures::enableMediaStream(false); |
| 87 WebRuntimeFeatures::enablePeerConnection(false); | 90 WebRuntimeFeatures::enablePeerConnection(false); |
| 88 } | 91 } |
| 89 | 92 |
| 90 if (!command_line.HasSwitch(switches::kEnableSpeechRecognition)) | 93 if (!command_line.HasSwitch(switches::kEnableSpeechRecognition)) |
| 91 WebRuntimeFeatures::enableScriptedSpeech(false); | 94 WebRuntimeFeatures::enableScriptedSpeech(false); |
| 95 | |
|
jdduke (slow)
2014/05/29 17:46:36
Nit: Remove this extra newline.
SaurabhK
2014/05/30 09:13:45
On 2014/05/29 17:46:36, jdduke wrote:
Done.
| |
| 92 #endif | 96 #endif |
| 93 | 97 |
| 94 if (command_line.HasSwitch(switches::kEnableServiceWorker)) | 98 if (command_line.HasSwitch(switches::kEnableServiceWorker)) |
| 95 WebRuntimeFeatures::enableServiceWorker(true); | 99 WebRuntimeFeatures::enableServiceWorker(true); |
| 96 | 100 |
| 97 #if defined(OS_ANDROID) | 101 #if defined(OS_ANDROID) |
| 98 // WebAudio is enabled by default on ARM and X86, if the MediaCodec | 102 // WebAudio is enabled by default on ARM and X86, if the MediaCodec |
| 99 // API is available. | 103 // API is available. |
| 100 WebRuntimeFeatures::enableWebAudio( | 104 WebRuntimeFeatures::enableWebAudio( |
| 101 !command_line.HasSwitch(switches::kDisableWebAudio) && | 105 !command_line.HasSwitch(switches::kDisableWebAudio) && |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 WebRuntimeFeatures::enableBleedingEdgeFastPaths(true); | 161 WebRuntimeFeatures::enableBleedingEdgeFastPaths(true); |
| 158 | 162 |
| 159 if (command_line.HasSwitch(switches::kEnablePreciseMemoryInfo)) | 163 if (command_line.HasSwitch(switches::kEnablePreciseMemoryInfo)) |
| 160 WebRuntimeFeatures::enablePreciseMemoryInfo(true); | 164 WebRuntimeFeatures::enablePreciseMemoryInfo(true); |
| 161 | 165 |
| 162 if (command_line.HasSwitch(switches::kEnableLayerSquashing)) | 166 if (command_line.HasSwitch(switches::kEnableLayerSquashing)) |
| 163 WebRuntimeFeatures::enableLayerSquashing(true); | 167 WebRuntimeFeatures::enableLayerSquashing(true); |
| 164 } | 168 } |
| 165 | 169 |
| 166 } // namespace content | 170 } // namespace content |
| OLD | NEW |