Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: content/child/runtime_features.cc

Issue 2846623003: Make autoplay policies no longer platform dependant. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "media/base/media_switches.h"
19 #include "media/base/media_util.h"
19 #include "services/device/public/cpp/device_features.h" 20 #include "services/device/public/cpp/device_features.h"
20 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 21 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
21 #include "ui/gl/gl_switches.h" 22 #include "ui/gl/gl_switches.h"
22 #include "ui/native_theme/native_theme_features.h" 23 #include "ui/native_theme/native_theme_features.h"
23 24
24 using blink::WebRuntimeFeatures; 25 using blink::WebRuntimeFeatures;
25 26
26 namespace content { 27 namespace content {
27 28
28 static void SetRuntimeFeatureDefaultsForPlatform() { 29 static void SetRuntimeFeatureDefaultsForPlatform() {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 features::kAllowContentInitiatedDataUrlNavigations)); 377 features::kAllowContentInitiatedDataUrlNavigations));
377 378
378 #if defined(OS_ANDROID) 379 #if defined(OS_ANDROID)
379 if (base::FeatureList::IsEnabled(features::kWebNfc)) 380 if (base::FeatureList::IsEnabled(features::kWebNfc))
380 WebRuntimeFeatures::EnableWebNfc(true); 381 WebRuntimeFeatures::EnableWebNfc(true);
381 #endif 382 #endif
382 383
383 if (base::FeatureList::IsEnabled(features::kIdleTimeSpellChecking)) 384 if (base::FeatureList::IsEnabled(features::kIdleTimeSpellChecking))
384 WebRuntimeFeatures::EnableFeatureFromString("IdleTimeSpellChecking", true); 385 WebRuntimeFeatures::EnableFeatureFromString("IdleTimeSpellChecking", true);
385 386
386 #if !defined(OS_ANDROID) 387 if (media::GetEffectiveAutoplayPolicy(command_line) !=
387 if (command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) == 388 switches::autoplay::kNoUserGestureRequiredPolicy) {
388 switches::autoplay::kCrossOriginUserGestureRequiredPolicy) {
389 WebRuntimeFeatures::EnableAutoplayMutedVideos(true); 389 WebRuntimeFeatures::EnableAutoplayMutedVideos(true);
390 } 390 }
391 #endif
392 391
393 // Enable explicitly enabled features, and then disable explicitly disabled 392 // Enable explicitly enabled features, and then disable explicitly disabled
394 // ones. 393 // ones.
395 if (command_line.HasSwitch(switches::kEnableBlinkFeatures)) { 394 if (command_line.HasSwitch(switches::kEnableBlinkFeatures)) {
396 std::vector<std::string> enabled_features = base::SplitString( 395 std::vector<std::string> enabled_features = base::SplitString(
397 command_line.GetSwitchValueASCII(switches::kEnableBlinkFeatures), 396 command_line.GetSwitchValueASCII(switches::kEnableBlinkFeatures),
398 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 397 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
399 for (const std::string& feature : enabled_features) 398 for (const std::string& feature : enabled_features)
400 WebRuntimeFeatures::EnableFeatureFromString(feature, true); 399 WebRuntimeFeatures::EnableFeatureFromString(feature, true);
401 } 400 }
402 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { 401 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) {
403 std::vector<std::string> disabled_features = base::SplitString( 402 std::vector<std::string> disabled_features = base::SplitString(
404 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), 403 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures),
405 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 404 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
406 for (const std::string& feature : disabled_features) 405 for (const std::string& feature : disabled_features)
407 WebRuntimeFeatures::EnableFeatureFromString(feature, false); 406 WebRuntimeFeatures::EnableFeatureFromString(feature, false);
408 } 407 }
409 } 408 }
410 409
411 } // namespace content 410 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698