Title: [108665] trunk/Source/WebKit/chromium
Revision
108665
Author
[email protected]
Date
2012-02-23 13:06:18 -0800 (Thu, 23 Feb 2012)

Log Message

Add UserGestureIndicator capability to Chromium API.
https://bugs.webkit.org/show_bug.cgi?id=77690

Patch by Greg Billock <[email protected]> on 2012-02-23
Reviewed by Darin Fisher.

* WebKit.gyp:
* public/WebScopedUserGesture.h: Added.
* src/WebScopedUserGesture.cpp: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (108664 => 108665)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-02-23 20:54:16 UTC (rev 108664)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-02-23 21:06:18 UTC (rev 108665)
@@ -1,3 +1,14 @@
+2012-02-23  Greg Billock  <[email protected]>
+
+        Add UserGestureIndicator capability to Chromium API.
+        https://bugs.webkit.org/show_bug.cgi?id=77690
+
+        Reviewed by Darin Fisher.
+
+        * WebKit.gyp:
+        * public/WebScopedUserGesture.h: Added.
+        * src/WebScopedUserGesture.cpp: Added.
+
 2012-02-23  Peter Beverloo  <[email protected]>
 
         Unreviewed, rolling out r108627 and r108630.

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (108664 => 108665)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2012-02-23 20:54:16 UTC (rev 108664)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2012-02-23 21:06:18 UTC (rev 108665)
@@ -232,6 +232,7 @@
                 'public/WebReferrerPolicy.h',
                 'public/WebRegularExpression.h',
                 'public/WebRuntimeFeatures.h',
+                'public/WebScopedUserGesture.h',
                 'public/WebScreenInfo.h',
                 'public/WebScriptController.h',
                 'public/WebScriptSource.h',
@@ -632,6 +633,7 @@
                 'src/WebRange.cpp',
                 'src/WebRegularExpression.cpp',
                 'src/WebRuntimeFeatures.cpp',
+                'src/WebScopedUserGesture.cpp',
                 'src/WebScriptController.cpp',
                 'src/WebScrollbarImpl.cpp',
                 'src/WebScrollbarImpl.h',
@@ -667,6 +669,7 @@
                 'src/WebURLResponse.cpp',
                 'src/WebURLResponsePrivate.h',
                 'src/WebURLError.cpp',
+                'src/WebScopedUserGesture.cpp',
                 'src/WebUserMediaRequest.cpp',
                 'src/WebViewImpl.cpp',
                 'src/WebViewImpl.h',

Added: trunk/Source/WebKit/chromium/public/WebScopedUserGesture.h (0 => 108665)


--- trunk/Source/WebKit/chromium/public/WebScopedUserGesture.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebScopedUserGesture.h	2012-02-23 21:06:18 UTC (rev 108665)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebScopedUserGesture_h
+#define WebScopedUserGesture_h
+
+#include "platform/WebPrivateOwnPtr.h"
+
+namespace WebCore {
+class UserGestureIndicator;
+}
+
+namespace WebKit {
+
+// An instance of this class, while kept alive, will indicate that we are in
+// the context of a known user gesture. To use, create one, perform whatever
+// actions were done under color of a known user gesture, and then delete it.
+// Usually this will be done on the stack.
+class WebScopedUserGesture {
+public:
+    WebScopedUserGesture() { initialize(); }
+    ~WebScopedUserGesture() { reset(); }
+
+private:
+    WEBKIT_EXPORT void initialize();
+    WEBKIT_EXPORT void reset();
+
+    WebPrivateOwnPtr<WebCore::UserGestureIndicator> m_indicator;
+};
+
+} // namespace WebKit
+
+#endif // WebScopedUserGesture_h

Added: trunk/Source/WebKit/chromium/src/WebScopedUserGesture.cpp (0 => 108665)


--- trunk/Source/WebKit/chromium/src/WebScopedUserGesture.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebScopedUserGesture.cpp	2012-02-23 21:06:18 UTC (rev 108665)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebScopedUserGesture.h"
+
+#include "UserGestureIndicator.h"
+
+namespace WebKit {
+
+void WebScopedUserGesture::initialize()
+{
+    m_indicator.reset(new WebCore::UserGestureIndicator(WebCore::DefinitelyProcessingUserGesture));
+}
+
+void WebScopedUserGesture::reset()
+{
+    m_indicator.reset(0);
+}
+
+} // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to