| 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/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "content/common/content_switches_internal.h" | 12 #include "content/common/content_switches_internal.h" |
| 13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 14 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 15 #include "ui/gl/gl_switches.h" | 15 #include "ui/gl/gl_switches.h" |
| 16 #include "ui/native_theme/native_theme_switches.h" | 16 #include "ui/native_theme/native_theme_switches.h" |
| 17 | 17 |
| 18 #if defined(OS_ANDROID) | 18 #if defined(OS_ANDROID) |
| 19 #include <cpu-features.h> | 19 #include <cpu-features.h> |
| 20 #include "base/android/build_info.h" | 20 #include "base/android/build_info.h" |
| 21 #include "base/metrics/field_trial.h" | 21 #include "base/metrics/field_trial.h" |
| 22 #include "media/base/android/media_codec_bridge.h" | 22 #include "media/base/android/media_codec_util.h" |
| 23 #elif defined(OS_WIN) | 23 #elif defined(OS_WIN) |
| 24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 using blink::WebRuntimeFeatures; | 27 using blink::WebRuntimeFeatures; |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 static void SetRuntimeFeatureDefaultsForPlatform() { | 31 static void SetRuntimeFeatureDefaultsForPlatform() { |
| 32 // Enable non-standard "apple-touch-icon" and "apple-touch-icon-precomposed". | 32 // Enable non-standard "apple-touch-icon" and "apple-touch-icon-precomposed". |
| 33 WebRuntimeFeatures::enableTouchIconLoading(true); | 33 WebRuntimeFeatures::enableTouchIconLoading(true); |
| 34 | 34 |
| 35 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
| 36 // MSE/EME implementation needs Android MediaCodec API. | 36 // MSE/EME implementation needs Android MediaCodec API. |
| 37 if (!media::MediaCodecBridge::IsAvailable()) { | 37 if (!media::MediaCodecUtil::IsMediaCodecAvailable()) { |
| 38 WebRuntimeFeatures::enableMediaSource(false); | 38 WebRuntimeFeatures::enableMediaSource(false); |
| 39 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false); | 39 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false); |
| 40 WebRuntimeFeatures::enableEncryptedMedia(false); | 40 WebRuntimeFeatures::enableEncryptedMedia(false); |
| 41 } | 41 } |
| 42 // WebAudio is enabled by default but only when the MediaCodec API | 42 // WebAudio is enabled by default but only when the MediaCodec API |
| 43 // is available. | 43 // is available. |
| 44 AndroidCpuFamily cpu_family = android_getCpuFamily(); | 44 AndroidCpuFamily cpu_family = android_getCpuFamily(); |
| 45 WebRuntimeFeatures::enableWebAudio( | 45 WebRuntimeFeatures::enableWebAudio( |
| 46 media::MediaCodecBridge::IsAvailable() && | 46 media::MediaCodecUtil::IsMediaCodecAvailable() && |
| 47 ((cpu_family == ANDROID_CPU_FAMILY_ARM) || | 47 ((cpu_family == ANDROID_CPU_FAMILY_ARM) || |
| 48 (cpu_family == ANDROID_CPU_FAMILY_ARM64) || | 48 (cpu_family == ANDROID_CPU_FAMILY_ARM64) || |
| 49 (cpu_family == ANDROID_CPU_FAMILY_X86) || | 49 (cpu_family == ANDROID_CPU_FAMILY_X86) || |
| 50 (cpu_family == ANDROID_CPU_FAMILY_MIPS))); | 50 (cpu_family == ANDROID_CPU_FAMILY_MIPS))); |
| 51 | 51 |
| 52 // Android does not have support for PagePopup | 52 // Android does not have support for PagePopup |
| 53 WebRuntimeFeatures::enablePagePopup(false); | 53 WebRuntimeFeatures::enablePagePopup(false); |
| 54 // Android does not yet support SharedWorker. crbug.com/154571 | 54 // Android does not yet support SharedWorker. crbug.com/154571 |
| 55 WebRuntimeFeatures::enableSharedWorker(false); | 55 WebRuntimeFeatures::enableSharedWorker(false); |
| 56 // Android does not yet support NavigatorContentUtils. | 56 // Android does not yet support NavigatorContentUtils. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 if (command_line.HasSwitch(switches::kDisableSharedWorkers)) | 116 if (command_line.HasSwitch(switches::kDisableSharedWorkers)) |
| 117 WebRuntimeFeatures::enableSharedWorker(false); | 117 WebRuntimeFeatures::enableSharedWorker(false); |
| 118 | 118 |
| 119 #if defined(OS_ANDROID) | 119 #if defined(OS_ANDROID) |
| 120 // WebAudio is enabled by default on ARM and X86, if the MediaCodec | 120 // WebAudio is enabled by default on ARM and X86, if the MediaCodec |
| 121 // API is available. | 121 // API is available. |
| 122 WebRuntimeFeatures::enableWebAudio( | 122 WebRuntimeFeatures::enableWebAudio( |
| 123 !command_line.HasSwitch(switches::kDisableWebAudio) && | 123 !command_line.HasSwitch(switches::kDisableWebAudio) && |
| 124 media::MediaCodecBridge::IsAvailable()); | 124 media::MediaCodecUtil::IsMediaCodecAvailable()); |
| 125 #else | 125 #else |
| 126 if (command_line.HasSwitch(switches::kDisableWebAudio)) | 126 if (command_line.HasSwitch(switches::kDisableWebAudio)) |
| 127 WebRuntimeFeatures::enableWebAudio(false); | 127 WebRuntimeFeatures::enableWebAudio(false); |
| 128 #endif | 128 #endif |
| 129 | 129 |
| 130 if (command_line.HasSwitch(switches::kDisableSpeechAPI)) | 130 if (command_line.HasSwitch(switches::kDisableSpeechAPI)) |
| 131 WebRuntimeFeatures::enableScriptedSpeech(false); | 131 WebRuntimeFeatures::enableScriptedSpeech(false); |
| 132 | 132 |
| 133 if (command_line.HasSwitch(switches::kDisableEncryptedMedia)) | 133 if (command_line.HasSwitch(switches::kDisableEncryptedMedia)) |
| 134 WebRuntimeFeatures::enableEncryptedMedia(false); | 134 WebRuntimeFeatures::enableEncryptedMedia(false); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { | 213 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { |
| 214 std::vector<std::string> disabled_features = base::SplitString( | 214 std::vector<std::string> disabled_features = base::SplitString( |
| 215 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), | 215 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), |
| 216 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 216 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 217 for (const std::string& feature : disabled_features) | 217 for (const std::string& feature : disabled_features) |
| 218 WebRuntimeFeatures::enableFeatureFromString(feature, false); | 218 WebRuntimeFeatures::enableFeatureFromString(feature, false); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace content | 222 } // namespace content |
| OLD | NEW |