| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 PossiblyProcessingUserGesture, | 41 PossiblyProcessingUserGesture, |
| 42 DefinitelyNotProcessingUserGesture | 42 DefinitelyNotProcessingUserGesture |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class PLATFORM_EXPORT UserGestureToken : public RefCounted<UserGestureToken> { | 45 class PLATFORM_EXPORT UserGestureToken : public RefCounted<UserGestureToken> { |
| 46 public: | 46 public: |
| 47 virtual ~UserGestureToken() { } | 47 virtual ~UserGestureToken() { } |
| 48 virtual bool hasGestures() const = 0; | 48 virtual bool hasGestures() const = 0; |
| 49 virtual void setOutOfProcess() = 0; | 49 virtual void setOutOfProcess() = 0; |
| 50 virtual void setJavascriptPrompt() = 0; | 50 virtual void setJavascriptPrompt() = 0; |
| 51 virtual double timestamp() const = 0; |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 class PLATFORM_EXPORT UserGestureIndicatorDisabler { | 54 class PLATFORM_EXPORT UserGestureIndicatorDisabler { |
| 54 WTF_MAKE_NONCOPYABLE(UserGestureIndicatorDisabler); | 55 WTF_MAKE_NONCOPYABLE(UserGestureIndicatorDisabler); |
| 55 public: | 56 public: |
| 56 UserGestureIndicatorDisabler(); | 57 UserGestureIndicatorDisabler(); |
| 57 ~UserGestureIndicatorDisabler(); | 58 ~UserGestureIndicatorDisabler(); |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 ProcessingUserGestureState m_savedState; | 61 ProcessingUserGestureState m_savedState; |
| 61 UserGestureIndicator* m_savedIndicator; | 62 UserGestureIndicator* m_savedIndicator; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 class PLATFORM_EXPORT UserGestureIndicator { | 65 class PLATFORM_EXPORT UserGestureIndicator { |
| 65 WTF_MAKE_NONCOPYABLE(UserGestureIndicator); | 66 WTF_MAKE_NONCOPYABLE(UserGestureIndicator); |
| 66 friend class UserGestureIndicatorDisabler; | 67 friend class UserGestureIndicatorDisabler; |
| 67 public: | 68 public: |
| 68 static bool processingUserGesture(); | 69 static bool processingUserGesture(); |
| 69 static bool consumeUserGesture(); | 70 static bool consumeUserGesture(); |
| 70 static UserGestureToken* currentToken(); | 71 static UserGestureToken* currentToken(); |
| 71 static void clearProcessedUserGestureInPast(); | 72 static void clearProcessedUserGestureInPast(); |
| 72 static bool processedUserGestureInPast(); | 73 static bool processedUserGestureInPast(); |
| 73 | 74 |
| 74 explicit UserGestureIndicator(ProcessingUserGestureState); | 75 explicit UserGestureIndicator(ProcessingUserGestureState); |
| 75 explicit UserGestureIndicator(PassRefPtr<UserGestureToken>); | 76 explicit UserGestureIndicator(PassRefPtr<UserGestureToken>); |
| 77 explicit UserGestureIndicator(double timestamp); |
| 76 ~UserGestureIndicator(); | 78 ~UserGestureIndicator(); |
| 77 | 79 |
| 78 | 80 |
| 79 private: | 81 private: |
| 80 static ProcessingUserGestureState s_state; | 82 static ProcessingUserGestureState s_state; |
| 81 static UserGestureIndicator* s_topmostIndicator; | 83 static UserGestureIndicator* s_topmostIndicator; |
| 82 static bool s_processedUserGestureInPast; | 84 static bool s_processedUserGestureInPast; |
| 83 ProcessingUserGestureState m_previousState; | 85 ProcessingUserGestureState m_previousState; |
| 84 RefPtr<UserGestureToken> m_token; | 86 RefPtr<UserGestureToken> m_token; |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 } | 89 } |
| 88 | 90 |
| 89 #endif | 91 #endif |
| OLD | NEW |