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

Side by Side Diff: public/web/WebScopedUserGesture.h

Issue 239503008: Expose the timestamp associated with a user gesture, and make it possible to recreate a new user ge… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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 unified diff | Download patch
« no previous file with comments | « Source/web/WebUserGestureToken.cpp ('k') | public/web/WebUserGestureToken.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // user gesture. Doing so might enable malicious code to work around certain 50 // user gesture. Doing so might enable malicious code to work around certain
51 // restrictions such as opening multiple windows. 51 // restrictions such as opening multiple windows.
52 // Instead, obtain the current WebUserGestureToken from the 52 // Instead, obtain the current WebUserGestureToken from the
53 // WebUserGestureIndicator, and use this token to create a 53 // WebUserGestureIndicator, and use this token to create a
54 // WebScopedUserGesture. If the token was alrady consumed, the new 54 // WebScopedUserGesture. If the token was alrady consumed, the new
55 // WebScopedUserGesture will not indicate that we are in the context of a user 55 // WebScopedUserGesture will not indicate that we are in the context of a user
56 // gesture. 56 // gesture.
57 class WebScopedUserGesture { 57 class WebScopedUserGesture {
58 public: 58 public:
59 explicit WebScopedUserGesture(const WebUserGestureToken& token) { initialize WithToken(token); } 59 explicit WebScopedUserGesture(const WebUserGestureToken& token) { initialize WithToken(token); }
60 explicit WebScopedUserGesture(double timestamp) { initializeWithTimestamp(ti mestamp); }
60 WebScopedUserGesture() { initialize(); } 61 WebScopedUserGesture() { initialize(); }
61 ~WebScopedUserGesture() { reset(); } 62 ~WebScopedUserGesture() { reset(); }
62 63
63 private: 64 private:
64 BLINK_EXPORT void initialize(); 65 BLINK_EXPORT void initialize();
65 BLINK_EXPORT void initializeWithToken(const WebUserGestureToken&); 66 BLINK_EXPORT void initializeWithToken(const WebUserGestureToken&);
67 BLINK_EXPORT void initializeWithTimestamp(double timestamp);
66 BLINK_EXPORT void reset(); 68 BLINK_EXPORT void reset();
67 69
68 WebPrivateOwnPtr<WebCore::UserGestureIndicator> m_indicator; 70 WebPrivateOwnPtr<WebCore::UserGestureIndicator> m_indicator;
69 }; 71 };
70 72
71 } // namespace blink 73 } // namespace blink
72 74
73 #endif // WebScopedUserGesture_h 75 #endif // WebScopedUserGesture_h
OLDNEW
« no previous file with comments | « Source/web/WebUserGestureToken.cpp ('k') | public/web/WebUserGestureToken.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698