Refactor UserGestureIndicator::Token to be a top-level class
authorjochen@chromium.org <jochen@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2013 09:30:47 +0000 (09:30 +0000)
committerjochen@chromium.org <jochen@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2013 09:30:47 +0000 (09:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=111412

Reviewed by Nico Weber.

This will allow for forward declaring the class in a public WebKit
API header. The goal is to enable the embedder to hold on to a
UserGestureToken.

* dom/UserGestureIndicator.cpp:
(WebCore::UserGestureIndicator::UserGestureIndicator):
(WebCore::UserGestureIndicator::currentToken):
* dom/UserGestureIndicator.h:
(UserGestureToken):
(WebCore::UserGestureToken::~UserGestureToken):
(WebCore):
(UserGestureIndicator):
* page/DOMTimer.h:
(DOMTimer):
* page/EventHandler.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144742 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/UserGestureIndicator.cpp
Source/WebCore/dom/UserGestureIndicator.h
Source/WebCore/page/DOMTimer.h
Source/WebCore/page/EventHandler.h

index 13f23df..f32538a 100644 (file)
@@ -1,3 +1,26 @@
+2013-03-05  Jochen Eisinger  <jochen@chromium.org>
+
+        Refactor UserGestureIndicator::Token to be a top-level class
+        https://bugs.webkit.org/show_bug.cgi?id=111412
+
+        Reviewed by Nico Weber.
+
+        This will allow for forward declaring the class in a public WebKit
+        API header. The goal is to enable the embedder to hold on to a
+        UserGestureToken.
+
+        * dom/UserGestureIndicator.cpp:
+        (WebCore::UserGestureIndicator::UserGestureIndicator):
+        (WebCore::UserGestureIndicator::currentToken):
+        * dom/UserGestureIndicator.h:
+        (UserGestureToken):
+        (WebCore::UserGestureToken::~UserGestureToken):
+        (WebCore):
+        (UserGestureIndicator):
+        * page/DOMTimer.h:
+        (DOMTimer):
+        * page/EventHandler.h:
+
 2013-03-05  Mike West  <mkwst@chromium.org>
 
         Remove redundant code in Document::updateHoverActiveState.
index c03c31f..caf6ee6 100644 (file)
@@ -30,9 +30,9 @@ namespace WebCore {
 
 namespace {
 
-class GestureToken : public UserGestureIndicator::Token {
+class GestureToken : public UserGestureToken {
 public:
-    static PassRefPtr<UserGestureIndicator::Token> create() { return adoptRef(new GestureToken); }
+    static PassRefPtr<UserGestureToken> create() { return adoptRef(new GestureToken); }
 
     virtual ~GestureToken() { }
 
@@ -83,7 +83,7 @@ UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
     ASSERT(isDefinite(s_state));
 }
 
-UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureIndicator::Token> token)
+UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token)
     : m_previousState(s_state)
 {
     if (token && static_cast<GestureToken*>(token.get())->hasGestures()) {
@@ -121,7 +121,7 @@ bool UserGestureIndicator::consumeUserGesture()
     return static_cast<GestureToken*>(s_topmostIndicator->currentToken())->consumeGesture();
 }
 
-UserGestureIndicator::Token* UserGestureIndicator::currentToken()
+UserGestureToken* UserGestureIndicator::currentToken()
 {
     if (!s_topmostIndicator)
         return 0;
index b980bfa..4b3149b 100644 (file)
@@ -38,20 +38,21 @@ enum ProcessingUserGestureState {
     DefinitelyNotProcessingUserGesture
 };
 
+class UserGestureToken : public RefCounted<UserGestureToken> {
+public:
+    virtual ~UserGestureToken() { }
+};
+
+
 class UserGestureIndicator {
     WTF_MAKE_NONCOPYABLE(UserGestureIndicator);
 public:
-    class Token : public RefCounted<Token> {
-    public:
-        virtual ~Token() { }
-    };
-
     static bool processingUserGesture();
     static bool consumeUserGesture();
-    static Token* currentToken();
+    static UserGestureToken* currentToken();
 
     explicit UserGestureIndicator(ProcessingUserGestureState);
-    explicit UserGestureIndicator(PassRefPtr<Token>);
+    explicit UserGestureIndicator(PassRefPtr<UserGestureToken>);
     ~UserGestureIndicator();
 
 
@@ -59,7 +60,7 @@ private:
     static ProcessingUserGestureState s_state;
     static UserGestureIndicator* s_topmostIndicator;
     ProcessingUserGestureState m_previousState;
-    RefPtr<Token> m_token;
+    RefPtr<UserGestureToken> m_token;
 };
 
 }
index dddf2a6..f13ecf8 100644 (file)
@@ -68,7 +68,7 @@ namespace WebCore {
         int m_nestingLevel;
         OwnPtr<ScheduledAction> m_action;
         int m_originalInterval;
-        RefPtr<UserGestureIndicator::Token> m_userGestureToken;
+        RefPtr<UserGestureToken> m_userGestureToken;
     };
 
 } // namespace WebCore
index a1e022e..380af0c 100644 (file)
@@ -452,7 +452,7 @@ private:
     IntPoint m_mouseDownPos; // In our view's coords.
     double m_mouseDownTimestamp;
     PlatformMouseEvent m_mouseDown;
-    RefPtr<UserGestureIndicator::Token> m_lastMouseDownUserGestureToken;
+    RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken;
 
     RefPtr<Node> m_latchedWheelEventNode;
     bool m_widgetIsLatched;