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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1799253002: Stricter user gestures for touch - measure and warn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaks Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 m_autoplayHelper->playMethodCalled(); 2041 m_autoplayHelper->playMethodCalled();
2042 2042
2043 if (!UserGestureIndicator::processingUserGesture()) { 2043 if (!UserGestureIndicator::processingUserGesture()) {
2044 if (m_userGestureRequiredForPlay) { 2044 if (m_userGestureRequiredForPlay) {
2045 recordAutoplayMetric(PlayMethodFailed); 2045 recordAutoplayMetric(PlayMethodFailed);
2046 String message = ExceptionMessages::failedToExecute("play", "HTMLMed iaElement", "API can only be initiated by a user gesture."); 2046 String message = ExceptionMessages::failedToExecute("play", "HTMLMed iaElement", "API can only be initiated by a user gesture.");
2047 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message)); 2047 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
2048 return NotAllowedError; 2048 return NotAllowedError;
2049 } 2049 }
2050 } else { 2050 } else {
2051 UserGestureIndicator::utilizeUserGesture();
2051 // We ask the helper to remove the gesture requirement for us, so that 2052 // We ask the helper to remove the gesture requirement for us, so that
2052 // it can record the reason. 2053 // it can record the reason.
2053 Platform::current()->recordAction(UserMetricsAction("Media_Play_WithGest ure")); 2054 Platform::current()->recordAction(UserMetricsAction("Media_Play_WithGest ure"));
2054 m_autoplayHelper->removeUserGestureRequirement(GesturelessPlaybackEnable dByPlayMethod); 2055 m_autoplayHelper->removeUserGestureRequirement(GesturelessPlaybackEnable dByPlayMethod);
2055 } 2056 }
2056 2057
2057 if (m_error && m_error->code() == MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED) 2058 if (m_error && m_error->code() == MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED)
2058 return NotSupportedError; 2059 return NotSupportedError;
2059 2060
2060 playInternal(); 2061 playInternal();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 setIgnorePreloadNone(); 2101 setIgnorePreloadNone();
2101 updatePlayState(); 2102 updatePlayState();
2102 } 2103 }
2103 2104
2104 void HTMLMediaElement::pause() 2105 void HTMLMediaElement::pause()
2105 { 2106 {
2106 WTF_LOG(Media, "HTMLMediaElement::pause(%p)", this); 2107 WTF_LOG(Media, "HTMLMediaElement::pause(%p)", this);
2107 2108
2108 // Only buffer aggressively on a user-initiated pause. Other types of pauses 2109 // Only buffer aggressively on a user-initiated pause. Other types of pauses
2109 // (which go directly to pauseInternal()) should not cause this behavior. 2110 // (which go directly to pauseInternal()) should not cause this behavior.
2110 if (webMediaPlayer() && UserGestureIndicator::processingUserGesture()) 2111 if (webMediaPlayer() && UserGestureIndicator::utilizeUserGesture())
2111 webMediaPlayer()->setBufferingStrategy(WebMediaPlayer::BufferingStrategy ::Aggressive); 2112 webMediaPlayer()->setBufferingStrategy(WebMediaPlayer::BufferingStrategy ::Aggressive);
2112 2113
2113 pauseInternal(); 2114 pauseInternal();
2114 } 2115 }
2115 2116
2116 void HTMLMediaElement::pauseInternal() 2117 void HTMLMediaElement::pauseInternal()
2117 { 2118 {
2118 WTF_LOG(Media, "HTMLMediaElement::pauseInternal(%p)", this); 2119 WTF_LOG(Media, "HTMLMediaElement::pauseInternal(%p)", this);
2119 2120
2120 if (m_networkState == NETWORK_EMPTY) 2121 if (m_networkState == NETWORK_EMPTY)
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
3882 } 3883 }
3883 3884
3884 #if !ENABLE(OILPAN) 3885 #if !ENABLE(OILPAN)
3885 WeakPtr<HTMLMediaElement> HTMLMediaElement::createWeakPtr() 3886 WeakPtr<HTMLMediaElement> HTMLMediaElement::createWeakPtr()
3886 { 3887 {
3887 return m_weakPtrFactory.createWeakPtr(); 3888 return m_weakPtrFactory.createWeakPtr();
3888 } 3889 }
3889 #endif 3890 #endif
3890 3891
3891 } // namespace blink 3892 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFormElement.cpp ('k') | third_party/WebKit/Source/core/html/forms/ColorInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698