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

Unified Diff: Source/platform/UserGestureIndicator.cpp

Issue 235983016: Add support for setting password value gated on user's gesture in a page (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/UserGestureIndicator.cpp
diff --git a/Source/platform/UserGestureIndicator.cpp b/Source/platform/UserGestureIndicator.cpp
index 03d219537a755790da17f7bf8602c9a560633c6b..dbebd06a9ddc724f81f454e1af6366d3c0ae55fb 100644
--- a/Source/platform/UserGestureIndicator.cpp
+++ b/Source/platform/UserGestureIndicator.cpp
@@ -112,6 +112,7 @@ static bool isDefinite(ProcessingUserGestureState state)
ProcessingUserGestureState UserGestureIndicator::s_state = DefinitelyNotProcessingUserGesture;
UserGestureIndicator* UserGestureIndicator::s_topmostIndicator = 0;
+bool UserGestureIndicator::s_processedUserGestureInPast = false;
UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
: m_previousState(s_state)
@@ -129,6 +130,8 @@ UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
m_token = s_topmostIndicator->currentToken();
}
s_state = state;
+ if (state == DefinitelyProcessingNewUserGesture || state == DefinitelyProcessingUserGesture)
+ s_processedUserGestureInPast = true;
}
if (state == DefinitelyProcessingNewUserGesture)
@@ -158,6 +161,7 @@ UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token)
}
}
s_state = DefinitelyProcessingUserGesture;
+ s_processedUserGestureInPast = true;
}
ASSERT(isDefinite(s_state));
@@ -194,6 +198,19 @@ UserGestureToken* UserGestureIndicator::currentToken()
return s_topmostIndicator->m_token.get();
}
+void UserGestureIndicator::clearProcessedUserGestureInPast()
+{
+ if (isMainThread())
+ s_processedUserGestureInPast = true;
+}
+
+bool UserGestureIndicator::processedUserGestureInPast()
+{
+ if (!isMainThread())
+ return false;
+ return s_processedUserGestureInPast;
+}
+
UserGestureIndicatorDisabler::UserGestureIndicatorDisabler()
: m_savedState(UserGestureIndicator::s_state)
, m_savedIndicator(UserGestureIndicator::s_topmostIndicator)

Powered by Google App Engine
This is Rietveld 408576698