OLD | NEW |
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 Loading... |
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 |
OLD | NEW |