| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 class UserGestureIndicator; | 36 class UserGestureIndicator; |
| 37 | 37 |
| 38 enum ProcessingUserGestureState { | 38 enum ProcessingUserGestureState { |
| 39 DefinitelyProcessingNewUserGesture, | 39 DefinitelyProcessingNewUserGesture, |
| 40 DefinitelyProcessingUserGesture, | 40 DefinitelyProcessingUserGesture, |
| 41 PossiblyProcessingUserGesture, | 41 PossiblyProcessingUserGesture, |
| 42 DefinitelyNotProcessingUserGesture | 42 DefinitelyNotProcessingUserGesture |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class UserGestureHandler { | |
| 46 public: | |
| 47 virtual ~UserGestureHandler() { } | |
| 48 virtual void onGesture() = 0; | |
| 49 }; | |
| 50 | |
| 51 class PLATFORM_EXPORT UserGestureToken : public RefCounted<UserGestureToken> { | 45 class PLATFORM_EXPORT UserGestureToken : public RefCounted<UserGestureToken> { |
| 52 public: | 46 public: |
| 53 virtual ~UserGestureToken() { } | 47 virtual ~UserGestureToken() { } |
| 54 virtual bool hasGestures() const = 0; | 48 virtual bool hasGestures() const = 0; |
| 55 virtual void setOutOfProcess() = 0; | 49 virtual void setOutOfProcess() = 0; |
| 56 virtual void setJavascriptPrompt() = 0; | 50 virtual void setJavascriptPrompt() = 0; |
| 57 }; | 51 }; |
| 58 | 52 |
| 59 class PLATFORM_EXPORT UserGestureIndicatorDisabler { | 53 class PLATFORM_EXPORT UserGestureIndicatorDisabler { |
| 60 WTF_MAKE_NONCOPYABLE(UserGestureIndicatorDisabler); | 54 WTF_MAKE_NONCOPYABLE(UserGestureIndicatorDisabler); |
| 61 public: | 55 public: |
| 62 UserGestureIndicatorDisabler(); | 56 UserGestureIndicatorDisabler(); |
| 63 ~UserGestureIndicatorDisabler(); | 57 ~UserGestureIndicatorDisabler(); |
| 64 | 58 |
| 65 private: | 59 private: |
| 66 ProcessingUserGestureState m_savedState; | 60 ProcessingUserGestureState m_savedState; |
| 67 UserGestureIndicator* m_savedIndicator; | 61 UserGestureIndicator* m_savedIndicator; |
| 68 }; | 62 }; |
| 69 | 63 |
| 70 class PLATFORM_EXPORT UserGestureIndicator { | 64 class PLATFORM_EXPORT UserGestureIndicator { |
| 71 WTF_MAKE_NONCOPYABLE(UserGestureIndicator); | 65 WTF_MAKE_NONCOPYABLE(UserGestureIndicator); |
| 72 friend class UserGestureIndicatorDisabler; | 66 friend class UserGestureIndicatorDisabler; |
| 73 public: | 67 public: |
| 74 static bool processingUserGesture(); | 68 static bool processingUserGesture(); |
| 75 static bool consumeUserGesture(); | 69 static bool consumeUserGesture(); |
| 76 static UserGestureToken* currentToken(); | 70 static UserGestureToken* currentToken(); |
| 77 static void setHandler(UserGestureHandler*); | |
| 78 | 71 |
| 79 explicit UserGestureIndicator(ProcessingUserGestureState); | 72 explicit UserGestureIndicator(ProcessingUserGestureState); |
| 80 explicit UserGestureIndicator(PassRefPtr<UserGestureToken>); | 73 explicit UserGestureIndicator(PassRefPtr<UserGestureToken>); |
| 81 ~UserGestureIndicator(); | 74 ~UserGestureIndicator(); |
| 82 | 75 |
| 83 | 76 |
| 84 private: | 77 private: |
| 85 static ProcessingUserGestureState s_state; | 78 static ProcessingUserGestureState s_state; |
| 86 static UserGestureIndicator* s_topmostIndicator; | 79 static UserGestureIndicator* s_topmostIndicator; |
| 87 static UserGestureHandler* s_handler; | |
| 88 ProcessingUserGestureState m_previousState; | 80 ProcessingUserGestureState m_previousState; |
| 89 RefPtr<UserGestureToken> m_token; | 81 RefPtr<UserGestureToken> m_token; |
| 90 }; | 82 }; |
| 91 | 83 |
| 92 } | 84 } |
| 93 | 85 |
| 94 #endif | 86 #endif |
| OLD | NEW |