| Index: third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| diff --git a/third_party/WebKit/Source/platform/UserGestureIndicator.cpp b/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| index 62e614d4387c7b67d16545501bdde3f0f971925d..67604a97f75f8b62b40792494fbfe7ea2cc39ca1 100644
|
| --- a/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| +++ b/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| @@ -123,8 +123,9 @@ ProcessingUserGestureState UserGestureIndicator::s_state = DefinitelyNotProcessi
|
| UserGestureIndicator* UserGestureIndicator::s_topmostIndicator = 0;
|
| bool UserGestureIndicator::s_processedUserGestureSinceLoad = false;
|
|
|
| -UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
|
| +UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state, UserGestureUsedCallback* usageCallback)
|
| : m_previousState(DefinitelyNotProcessingUserGesture)
|
| + , m_usageCallback(usageCallback)
|
| {
|
| // Silently ignore UserGestureIndicators on non-main threads.
|
| if (!isMainThread())
|
| @@ -153,8 +154,9 @@ UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
|
| ASSERT(isDefinite(s_state));
|
| }
|
|
|
| -UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token)
|
| +UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token, UserGestureUsedCallback* usageCallback)
|
| : m_previousState(DefinitelyNotProcessingUserGesture)
|
| + , m_usageCallback(usageCallback)
|
| {
|
| // Silently ignore UserGestureIndicators on non-main threads.
|
| if (!isMainThread())
|
| @@ -192,6 +194,18 @@ UserGestureIndicator::~UserGestureIndicator()
|
|
|
| bool UserGestureIndicator::processingUserGesture()
|
| {
|
| + if (UserGestureIndicator::processingUserGestureUntracked()) {
|
| + if (s_topmostIndicator->m_usageCallback) {
|
| + s_topmostIndicator->m_usageCallback->userGestureUsed();
|
| + s_topmostIndicator->m_usageCallback = nullptr;
|
| + }
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +bool UserGestureIndicator::processingUserGestureUntracked()
|
| +{
|
| if (!isMainThread())
|
| return false;
|
| return s_topmostIndicator && static_cast<GestureToken*>(s_topmostIndicator->currentToken())->hasGestures() && (s_state == DefinitelyProcessingNewUserGesture || s_state == DefinitelyProcessingUserGesture);
|
| @@ -201,7 +215,14 @@ bool UserGestureIndicator::consumeUserGesture()
|
| {
|
| if (!isMainThread() || !s_topmostIndicator)
|
| return false;
|
| - return static_cast<GestureToken*>(s_topmostIndicator->currentToken())->consumeGesture();
|
| + if (static_cast<GestureToken*>(s_topmostIndicator->currentToken())->consumeGesture()) {
|
| + if (s_topmostIndicator->m_usageCallback) {
|
| + s_topmostIndicator->m_usageCallback->userGestureUsed();
|
| + s_topmostIndicator->m_usageCallback = nullptr;
|
| + }
|
| + return true;
|
| + }
|
| + return false;
|
| }
|
|
|
| UserGestureToken* UserGestureIndicator::currentToken()
|
|
|