Title: [121483] trunk/Source/WebKit/chromium
Revision
121483
Author
[email protected]
Date
2012-06-28 16:20:52 -0700 (Thu, 28 Jun 2012)

Log Message

[Chromium] On Android, we should be able to ask the embedder what intents exist in a region of the page
https://bugs.webkit.org/show_bug.cgi?id=90210

Reviewed by Dimitri Glazkov.

This patch introduces a function that asks the embedder to analyze the
region around a hit test result for interesting content, like phone
numbers, email addresses, or physical addresses. The embedder then
responds with the "most interesting" content, together with an intent
URL for enacting the intent embodied by that content.

This function will be used in a subsequent patch to detect content
after touch events.

* WebKit.gyp:
* public/WebContentDetectionResult.h: Added.
(WebKit):
(WebContentDetectionResult):
(WebKit::WebContentDetectionResult::WebContentDetectionResult):
(WebKit::WebContentDetectionResult::isValid):
(WebKit::WebContentDetectionResult::range):
(WebKit::WebContentDetectionResult::string):
(WebKit::WebContentDetectionResult::intent):
* public/WebViewClient.h:
(WebViewClient):
(WebKit::WebViewClient::detechContentAround):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (121482 => 121483)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-28 23:12:48 UTC (rev 121482)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-28 23:20:52 UTC (rev 121483)
@@ -1,3 +1,32 @@
+2012-06-28  Adam Barth  <[email protected]>
+
+        [Chromium] On Android, we should be able to ask the embedder what intents exist in a region of the page
+        https://bugs.webkit.org/show_bug.cgi?id=90210
+
+        Reviewed by Dimitri Glazkov.
+
+        This patch introduces a function that asks the embedder to analyze the
+        region around a hit test result for interesting content, like phone
+        numbers, email addresses, or physical addresses. The embedder then
+        responds with the "most interesting" content, together with an intent
+        URL for enacting the intent embodied by that content.
+
+        This function will be used in a subsequent patch to detect content
+        after touch events.
+
+        * WebKit.gyp:
+        * public/WebContentDetectionResult.h: Added.
+        (WebKit):
+        (WebContentDetectionResult):
+        (WebKit::WebContentDetectionResult::WebContentDetectionResult):
+        (WebKit::WebContentDetectionResult::isValid):
+        (WebKit::WebContentDetectionResult::range):
+        (WebKit::WebContentDetectionResult::string):
+        (WebKit::WebContentDetectionResult::intent):
+        * public/WebViewClient.h:
+        (WebViewClient):
+        (WebKit::WebViewClient::detechContentAround):
+
 2012-06-28  Alec Flett  <[email protected]>
 
         IndexedDB: Hook up render-side key ASSERTing for get()

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (121482 => 121483)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2012-06-28 23:12:48 UTC (rev 121482)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2012-06-28 23:20:52 UTC (rev 121483)
@@ -116,6 +116,7 @@
                 'public/WebCompositorInputHandler.h',
                 'public/WebCompositorInputHandlerClient.h',
                 'public/WebConsoleMessage.h',
+                'public/WebContentDetectionResult.h',
                 'public/WebContextMenuData.h',
                 'public/WebCrossOriginPreflightResultCache.h',
                 'public/WebCursorInfo.h',

Added: trunk/Source/WebKit/chromium/public/WebContentDetectionResult.h (0 => 121483)


--- trunk/Source/WebKit/chromium/public/WebContentDetectionResult.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebContentDetectionResult.h	2012-06-28 23:20:52 UTC (rev 121483)
@@ -0,0 +1,64 @@
+/*
+* Copyright (C) 2012 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:
+*
+* 1.  Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+ * 2.  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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 WebContentDetectionResult_h
+#define WebContentDetectionResult_h
+
+#include "WebRange.h"
+#include "platform/WebString.h"
+#include "platform/WebURL.h"
+
+namespace WebKit {
+
+class WebContentDetectionResult {
+public:
+    WebContentDetectionResult()
+        : m_isValid(false)
+    {
+    }
+
+    WebContentDetectionResult(const WebRange& range, const WebString& string, const WebURL& intent)
+        : m_isValid(true)
+        , m_range(range)
+        , m_string(string)
+        , m_intent(intent)
+    {
+    }
+
+    bool isValid() const { return m_isValid; }
+    const WebRange& range() const { return m_range; }
+    const WebString& string() const { return m_string; }
+    const WebURL& intent() const { return m_intent; }
+
+private:
+    bool m_isValid;
+    WebRange m_range;
+    WebString m_string;
+    WebURL m_intent;
+};
+
+} // namespace WebKit
+
+#endif

Modified: trunk/Source/WebKit/chromium/public/WebViewClient.h (121482 => 121483)


--- trunk/Source/WebKit/chromium/public/WebViewClient.h	2012-06-28 23:12:48 UTC (rev 121482)
+++ trunk/Source/WebKit/chromium/public/WebViewClient.h	2012-06-28 23:20:52 UTC (rev 121483)
@@ -32,10 +32,12 @@
 #define WebViewClient_h
 
 #include "WebAccessibilityNotification.h"
+#include "WebContentDetectionResult.h"
 #include "WebDragOperation.h"
 #include "WebEditingAction.h"
 #include "WebFileChooserCompletion.h"
 #include "WebFileChooserParams.h"
+#include "WebHitTestResult.h"
 #include "WebPageVisibilityState.h"
 #include "WebPopupType.h"
 #include "WebTextAffinity.h"
@@ -363,6 +365,15 @@
 
     virtual WebUserMediaClient* userMediaClient() { return 0; }
 
+
+    // Content detection ----------------------------------------------------
+
+    // Retrieves detectable content (e.g., email addresses, phone numbers)
+    // around a hit test result. The embedder should use platform-specific
+    // content detectors (e.g., from the Android intent system) to analyze the
+    // region around the hit test result.
+    virtual WebContentDetectionResult detectContentAround(const WebHitTestResult&) { return WebContentDetectionResult(); }
+
 protected:
     ~WebViewClient() { }
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to