Chromium Code Reviews| Index: Source/platform/UserGestureIndicator.cpp |
| diff --git a/Source/platform/UserGestureIndicator.cpp b/Source/platform/UserGestureIndicator.cpp |
| index 03d219537a755790da17f7bf8602c9a560633c6b..eed12c688dc584544ac5533a9ab61ea712ab81fb 100644 |
| --- a/Source/platform/UserGestureIndicator.cpp |
| +++ b/Source/platform/UserGestureIndicator.cpp |
| @@ -29,6 +29,7 @@ |
| #include "wtf/Assertions.h" |
| #include "wtf/CurrentTime.h" |
| #include "wtf/MainThread.h" |
| +#include "wtf/Vector.h" |
| namespace WebCore { |
| @@ -112,6 +113,7 @@ static bool isDefinite(ProcessingUserGestureState state) |
| ProcessingUserGestureState UserGestureIndicator::s_state = DefinitelyNotProcessingUserGesture; |
| UserGestureIndicator* UserGestureIndicator::s_topmostIndicator = 0; |
| +UserGestureHandler* UserGestureIndicator::s_handler = 0; |
| UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state) |
| : m_previousState(s_state) |
| @@ -131,10 +133,17 @@ UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state) |
| s_state = state; |
| } |
| - if (state == DefinitelyProcessingNewUserGesture) |
| + bool onGesture = false; |
|
abarth-chromium
2013/11/26 19:36:37
Can we name this something that sounds like a bool
jww
2013/11/26 20:11:55
Done.
|
| + if (state == DefinitelyProcessingNewUserGesture) { |
| static_cast<GestureToken*>(m_token.get())->addGesture(); |
| - else if (state == DefinitelyProcessingUserGesture && s_topmostIndicator == this) |
| + onGesture = true; |
| + } else if (state == DefinitelyProcessingUserGesture && s_topmostIndicator == this) { |
| static_cast<GestureToken*>(m_token.get())->addGesture(); |
| + onGesture = true; |
| + } |
| + |
| + if (onGesture && s_handler) |
| + s_handler->onGesture(); |
| ASSERT(isDefinite(s_state)); |
| } |
| @@ -158,6 +167,9 @@ UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token) |
| } |
| } |
| s_state = DefinitelyProcessingUserGesture; |
| + |
| + if (s_handler) |
| + s_handler->onGesture(); |
| } |
| ASSERT(isDefinite(s_state)); |
| @@ -194,6 +206,11 @@ UserGestureToken* UserGestureIndicator::currentToken() |
| return s_topmostIndicator->m_token.get(); |
| } |
| +void UserGestureIndicator::setHandler(UserGestureHandler* handler) |
| +{ |
| + s_handler = handler; |
| +} |
| + |
| UserGestureIndicatorDisabler::UserGestureIndicatorDisabler() |
| : m_savedState(UserGestureIndicator::s_state) |
| , m_savedIndicator(UserGestureIndicator::s_topmostIndicator) |