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

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 2496593002: Adding an experimental flag to block autoplay with sound in cross-origin iframes (Closed)
Patch Set: Created 4 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 #if defined(OS_ANDROID) 488 #if defined(OS_ANDROID)
489 // On Android, user gestures are normally required, unless that requirement 489 // On Android, user gestures are normally required, unless that requirement
490 // is disabled with a command-line switch or the equivalent field trial is 490 // is disabled with a command-line switch or the equivalent field trial is
491 // is set to "Enabled". 491 // is set to "Enabled".
492 const std::string autoplay_group_name = base::FieldTrialList::FindFullName( 492 const std::string autoplay_group_name = base::FieldTrialList::FindFullName(
493 "MediaElementAutoplay"); 493 "MediaElementAutoplay");
494 prefs.user_gesture_required_for_media_playback = !command_line.HasSwitch( 494 prefs.user_gesture_required_for_media_playback = !command_line.HasSwitch(
495 switches::kDisableGestureRequirementForMediaPlayback) && 495 switches::kDisableGestureRequirementForMediaPlayback) &&
496 (autoplay_group_name.empty() || autoplay_group_name != "Enabled"); 496 (autoplay_group_name.empty() || autoplay_group_name != "Enabled");
497 prefs.autoplay_muted_videos_enabled =
498 base::FeatureList::IsEnabled(features::kAutoplayMutedVideos);
499
500 prefs.progress_bar_completion = GetProgressBarCompletionPolicy(); 497 prefs.progress_bar_completion = GetProgressBarCompletionPolicy();
501 498
502 prefs.use_solid_color_scrollbars = true; 499 prefs.use_solid_color_scrollbars = true;
503 #endif 500 #endif
504 501
502 prefs.autoplay_muted_videos_enabled =
503 base::FeatureList::IsEnabled(features::kAutoplayMutedVideos);
504 #if !defined(OS_ANDROID)
505 prefs.user_gesture_required_for_media_playback_in_cross_origin_iframes =
506 base::FeatureList::IsEnabled(
507 features::kUserGestureRequiredForMediaPlaybackInCrossOriginIframes);
508 #endif
509
505 // Handle autoplay gesture override experiment. 510 // Handle autoplay gesture override experiment.
506 // Note that anything but a well-formed string turns the experiment off. 511 // Note that anything but a well-formed string turns the experiment off.
507 prefs.autoplay_experiment_mode = base::FieldTrialList::FindFullName( 512 prefs.autoplay_experiment_mode = base::FieldTrialList::FindFullName(
508 "MediaElementGestureOverrideExperiment"); 513 "MediaElementGestureOverrideExperiment");
509 514
510 prefs.touch_enabled = ui::AreTouchEventsEnabled(); 515 prefs.touch_enabled = ui::AreTouchEventsEnabled();
511 prefs.device_supports_touch = prefs.touch_enabled && 516 prefs.device_supports_touch = prefs.touch_enabled &&
512 ui::GetTouchScreensAvailability() == 517 ui::GetTouchScreensAvailability() ==
513 ui::TouchScreensAvailability::ENABLED; 518 ui::TouchScreensAvailability::ENABLED;
514 std::tie(prefs.available_pointer_types, prefs.available_hover_types) = 519 std::tie(prefs.available_pointer_types, prefs.available_hover_types) =
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 // Note: We are using the origin URL provided by the sender here. It may be 1295 // Note: We are using the origin URL provided by the sender here. It may be
1291 // different from the receiver's. 1296 // different from the receiver's.
1292 file_system_file.url = 1297 file_system_file.url =
1293 GURL(storage::GetIsolatedFileSystemRootURIString( 1298 GURL(storage::GetIsolatedFileSystemRootURIString(
1294 file_system_url.origin(), filesystem_id, std::string()) 1299 file_system_url.origin(), filesystem_id, std::string())
1295 .append(register_name)); 1300 .append(register_name));
1296 } 1301 }
1297 } 1302 }
1298 1303
1299 } // namespace content 1304 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698