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

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.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 (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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "content/public/common/content_constants.h" 72 #include "content/public/common/content_constants.h"
73 #include "content/public/common/content_features.h" 73 #include "content/public/common/content_features.h"
74 #include "content/public/common/content_switches.h" 74 #include "content/public/common/content_switches.h"
75 #include "content/public/common/context_menu_params.h" 75 #include "content/public/common/context_menu_params.h"
76 #include "content/public/common/file_chooser_file_info.h" 76 #include "content/public/common/file_chooser_file_info.h"
77 #include "content/public/common/file_chooser_params.h" 77 #include "content/public/common/file_chooser_params.h"
78 #include "content/public/common/result_codes.h" 78 #include "content/public/common/result_codes.h"
79 #include "content/public/common/url_constants.h" 79 #include "content/public/common/url_constants.h"
80 #include "content/public/common/url_utils.h" 80 #include "content/public/common/url_utils.h"
81 #include "media/base/media_switches.h" 81 #include "media/base/media_switches.h"
82 #include "media/base/media_util.h"
82 #include "net/base/url_util.h" 83 #include "net/base/url_util.h"
83 #include "net/url_request/url_request_context_getter.h" 84 #include "net/url_request/url_request_context_getter.h"
84 #include "third_party/skia/include/core/SkBitmap.h" 85 #include "third_party/skia/include/core/SkBitmap.h"
85 #include "ui/base/clipboard/clipboard.h" 86 #include "ui/base/clipboard/clipboard.h"
86 #include "ui/base/device_form_factor.h" 87 #include "ui/base/device_form_factor.h"
87 #include "ui/base/touch/touch_device.h" 88 #include "ui/base/touch/touch_device.h"
88 #include "ui/base/ui_base_switches.h" 89 #include "ui/base/ui_base_switches.h"
89 #include "ui/display/display_switches.h" 90 #include "ui/display/display_switches.h"
90 #include "ui/gfx/animation/animation.h" 91 #include "ui/gfx/animation/animation.h"
91 #include "ui/gfx/color_space.h" 92 #include "ui/gfx/color_space.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 430
430 prefs.inert_visual_viewport = 431 prefs.inert_visual_viewport =
431 command_line.HasSwitch(switches::kInertVisualViewport); 432 command_line.HasSwitch(switches::kInertVisualViewport);
432 433
433 prefs.use_solid_color_scrollbars = false; 434 prefs.use_solid_color_scrollbars = false;
434 435
435 prefs.history_entry_requires_user_gesture = 436 prefs.history_entry_requires_user_gesture =
436 command_line.HasSwitch(switches::kHistoryEntryRequiresUserGesture); 437 command_line.HasSwitch(switches::kHistoryEntryRequiresUserGesture);
437 438
438 #if defined(OS_ANDROID) 439 #if defined(OS_ANDROID)
439 // On Android, user gestures are normally required, unless that requirement
440 // is disabled with a command-line switch or the equivalent field trial is
441 // is set to "Enabled".
442 prefs.user_gesture_required_for_media_playback =
443 !command_line.HasSwitch(switches::kIgnoreAutoplayRestrictionsForTests) &&
444 command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) !=
445 switches::autoplay::kNoUserGestureRequiredPolicy;
446
447 prefs.progress_bar_completion = GetProgressBarCompletionPolicy(); 440 prefs.progress_bar_completion = GetProgressBarCompletionPolicy();
448 441
449 prefs.use_solid_color_scrollbars = true; 442 prefs.use_solid_color_scrollbars = true;
450 #else // defined(OS_ANDROID)
451 prefs.cross_origin_media_playback_requires_user_gesture =
452 command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) ==
453 switches::autoplay::kCrossOriginUserGestureRequiredPolicy;
454 #endif // defined(OS_ANDROID) 443 #endif // defined(OS_ANDROID)
455 444
445 std::string autoplay_policy = media::GetEffectiveAutoplayPolicy(command_line);
446 if (autoplay_policy == switches::autoplay::kNoUserGestureRequiredPolicy) {
447 prefs.autoplay_policy = AutoplayPolicy::kNoUserGestureRequired;
448 } else if (autoplay_policy ==
449 switches::autoplay::kCrossOriginUserGestureRequiredPolicy) {
450 prefs.autoplay_policy = AutoplayPolicy::kCrossOriginUserGestureRequired;
451 } else if (autoplay_policy ==
452 switches::autoplay::kUserGestureRequiredPolicy) {
453 prefs.autoplay_policy = AutoplayPolicy::kUserGestureRequired;
454 }
455
456 const std::string touch_enabled_switch = 456 const std::string touch_enabled_switch =
457 command_line.HasSwitch(switches::kTouchEventFeatureDetection) 457 command_line.HasSwitch(switches::kTouchEventFeatureDetection)
458 ? command_line.GetSwitchValueASCII( 458 ? command_line.GetSwitchValueASCII(
459 switches::kTouchEventFeatureDetection) 459 switches::kTouchEventFeatureDetection)
460 : switches::kTouchEventFeatureDetectionAuto; 460 : switches::kTouchEventFeatureDetectionAuto;
461 prefs.touch_event_feature_detection_enabled = 461 prefs.touch_event_feature_detection_enabled =
462 (touch_enabled_switch == switches::kTouchEventFeatureDetectionAuto) 462 (touch_enabled_switch == switches::kTouchEventFeatureDetectionAuto)
463 ? (ui::GetTouchScreensAvailability() == 463 ? (ui::GetTouchScreensAvailability() ==
464 ui::TouchScreensAvailability::ENABLED) 464 ui::TouchScreensAvailability::ENABLED)
465 : (touch_enabled_switch.empty() || 465 : (touch_enabled_switch.empty() ||
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 } 955 }
956 956
957 void RenderViewHostImpl::ClosePageTimeout() { 957 void RenderViewHostImpl::ClosePageTimeout() {
958 if (delegate_->ShouldIgnoreUnresponsiveRenderer()) 958 if (delegate_->ShouldIgnoreUnresponsiveRenderer())
959 return; 959 return;
960 960
961 ClosePageIgnoringUnloadEvents(); 961 ClosePageIgnoringUnloadEvents();
962 } 962 }
963 963
964 } // namespace content 964 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/runtime_features.cc » ('j') | content/public/common/common_param_traits_macros.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698