[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:27:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7115964afb90432be176fbbe54431e4aabf3b751
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jul 26 11:52:50 2010 +0000

    2010-07-26  Satish Sampath  <satish at chromium.org>
    
            Reviewed by Steve Block.
    
            Add WebKit plumbing to connect speech requests and callbacks between WebCore and the embedder.
            https://bugs.webkit.org/show_bug.cgi?id=42367
    
            No new tests, the relevant LayoutTestController bindings will be added in the next patch.
    
            * page/SpeechInput.cpp: renamed a method.
            * page/SpeechInput.h: renamed a method.
            * page/SpeechInputClient.h: added an extra method to optionally let users stop recording once they have spoken.
            * page/SpeechInputClientListener.h: renamed a method.
            * page/SpeechInputListener.h: renamed a method.
    2010-07-26  Satish Sampath  <satish at chromium.org>
    
            Reviewed by Steve Block.
    
            Add WebKit plumbing to connect speech requests and callbacks between WebCore and the embedder.
            https://bugs.webkit.org/show_bug.cgi?id=42367
    
            No new tests, the relevant LayoutTestController bindings and tests will be added in the next patch.
    
            * public/WebSpeechInputController.h: Added new interface, implemented by embedder and called by WebKit
            (WebKit::WebSpeechInputController::~WebSpeechInputController):
            * public/WebSpeechInputListener.h: Added new interface, implemented by WebKit and called by embedder.
            (WebKit::WebSpeechInputListener::~WebSpeechInputListener):
            * public/WebViewClient.h:
            (WebKit::WebViewClient::createSpeechInputClient): New method to get the embedder's speech input client interface.
            * src/SpeechInputClientImpl.cpp: Added new class, implementation of a two way connector between WebCore
            and the embedder for requests and responses.
            (WebKit::SpeechInputClientImpl::SpeechInputClientImpl):
            (WebKit::SpeechInputClientImpl::~SpeechInputClientImpl):
            (WebKit::SpeechInputClientImpl::startRecognition):
            (WebKit::SpeechInputClientImpl::stopRecording):
            (WebKit::SpeechInputClientImpl::didCompleteRecording):
            (WebKit::SpeechInputClientImpl::setRecognitionResult):
            (WebKit::SpeechInputClientImpl::didCompleteRecognition):
            * src/SpeechInputClientImpl.h: Added.
            * src/WebViewImpl.cpp:
            (WebKit::WebViewImpl::WebViewImpl): Pass on the above mentioned speech input connector to WebCore.
            * src/WebViewImpl.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64042 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7331ee0..e26d185 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-26  Satish Sampath  <satish at chromium.org>
+
+        Reviewed by Steve Block.
+
+        Add WebKit plumbing to connect speech requests and callbacks between WebCore and the embedder.
+        https://bugs.webkit.org/show_bug.cgi?id=42367
+
+        No new tests, the relevant LayoutTestController bindings will be added in the next patch.
+
+        * page/SpeechInput.cpp: renamed a method.
+        * page/SpeechInput.h: renamed a method.
+        * page/SpeechInputClient.h: added an extra method to optionally let users stop recording once they have spoken.
+        * page/SpeechInputClientListener.h: renamed a method.
+        * page/SpeechInputListener.h: renamed a method.
+
 2010-07-26  Andreas Kling  <andreas.kling at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/page/SpeechInput.cpp b/WebCore/page/SpeechInput.cpp
index 92df70e..ec338c9 100644
--- a/WebCore/page/SpeechInput.cpp
+++ b/WebCore/page/SpeechInput.cpp
@@ -45,9 +45,9 @@ SpeechInput::SpeechInput(SpeechInputClient* client, SpeechInputListener* listene
 {
 }
 
-void SpeechInput::recordingComplete()
+void SpeechInput::didCompleteRecording()
 {
-    m_listener->recordingComplete();
+    m_listener->didCompleteRecording();
 }
 
 void SpeechInput::setRecognitionResult(const String& result)
diff --git a/WebCore/page/SpeechInput.h b/WebCore/page/SpeechInput.h
index 201be99..8098f67 100644
--- a/WebCore/page/SpeechInput.h
+++ b/WebCore/page/SpeechInput.h
@@ -54,7 +54,7 @@ public:
     virtual bool startRecognition();
 
     // SpeechInputClient::Listener methods.
-    virtual void recordingComplete();
+    virtual void didCompleteRecording();
     virtual void setRecognitionResult(const String&);
 
 protected:
diff --git a/WebCore/page/SpeechInputClient.h b/WebCore/page/SpeechInputClient.h
index be68f46..5d1ed8b 100644
--- a/WebCore/page/SpeechInputClient.h
+++ b/WebCore/page/SpeechInputClient.h
@@ -42,6 +42,10 @@ class SpeechInputClient {
 public:
     virtual bool startRecognition(SpeechInputClientListener* listener) = 0;
 
+    // Stops audio recording and performs recognition with the audio recorded until now
+    // (does not discard audio).
+    virtual void stopRecording() = 0;
+
 protected:
     virtual ~SpeechInputClient() { }
 };
diff --git a/WebCore/page/SpeechInputClientListener.h b/WebCore/page/SpeechInputClientListener.h
index a9a897e..483f261 100644
--- a/WebCore/page/SpeechInputClientListener.h
+++ b/WebCore/page/SpeechInputClientListener.h
@@ -40,7 +40,13 @@ class String;
 // Provides an interface for the embedder to call into WebCore.
 class SpeechInputClientListener {
 public:
-    virtual void recordingComplete() = 0;
+    // Informs that audio recording has completed and recognition is underway.
+    virtual void didCompleteRecording() = 0;
+
+    // Gives results from speech recognition, either partial or the final results.
+    // This method can potentially get called multiple times if there are partial results
+    // available as the user keeps speaking. If the speech could not be recognized properly
+    // or if there was any other errors in the process, this method may never be called.
     virtual void setRecognitionResult(const String& result) = 0;
 
 protected:
diff --git a/WebCore/page/SpeechInputListener.h b/WebCore/page/SpeechInputListener.h
index d087d36..6b4fd9f 100644
--- a/WebCore/page/SpeechInputListener.h
+++ b/WebCore/page/SpeechInputListener.h
@@ -40,7 +40,13 @@ class String;
 // Interface to be implemented by the element which invokes SpeechInput.
 class SpeechInputListener {
 public:
-    virtual void recordingComplete() = 0;
+    // Informs that audio recording has completed and recognition is underway.
+    virtual void didCompleteRecording() = 0;
+
+    // Gives results from speech recognition, either partial or the final results.
+    // This method can potentially get called multiple times if there are partial results
+    // available as the user keeps speaking. If the speech could not be recognized properly
+    // or if there was any other errors in the process, this method may never be called.
     virtual void setRecognitionResult(const String& result) = 0;
 
 protected:
diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp
index c0effc8..7cd08ae 100644
--- a/WebCore/rendering/TextControlInnerElements.cpp
+++ b/WebCore/rendering/TextControlInnerElements.cpp
@@ -397,7 +397,7 @@ SpeechInput* InputFieldSpeechButtonElement::speechInput()
     return m_speechInput.get();
 }
 
-void InputFieldSpeechButtonElement::recordingComplete()
+void InputFieldSpeechButtonElement::didCompleteRecording()
 {
     // FIXME: Add UI feedback here to indicate that audio recording stopped and recognition is
     // in progress.
diff --git a/WebCore/rendering/TextControlInnerElements.h b/WebCore/rendering/TextControlInnerElements.h
index 68d6ff4..d5dfd63 100644
--- a/WebCore/rendering/TextControlInnerElements.h
+++ b/WebCore/rendering/TextControlInnerElements.h
@@ -124,7 +124,7 @@ public:
     virtual void defaultEventHandler(Event*);
 
     // SpeechInputListener methods.
-    void recordingComplete();
+    void didCompleteRecording();
     void setRecognitionResult(const String& result);
 
 private:
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index e5dcc15..0309952 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,32 @@
+2010-07-26  Satish Sampath  <satish at chromium.org>
+
+        Reviewed by Steve Block.
+
+        Add WebKit plumbing to connect speech requests and callbacks between WebCore and the embedder.
+        https://bugs.webkit.org/show_bug.cgi?id=42367
+
+        No new tests, the relevant LayoutTestController bindings and tests will be added in the next patch.
+
+        * public/WebSpeechInputController.h: Added new interface, implemented by embedder and called by WebKit
+        (WebKit::WebSpeechInputController::~WebSpeechInputController):
+        * public/WebSpeechInputListener.h: Added new interface, implemented by WebKit and called by embedder.
+        (WebKit::WebSpeechInputListener::~WebSpeechInputListener):
+        * public/WebViewClient.h:
+        (WebKit::WebViewClient::createSpeechInputClient): New method to get the embedder's speech input client interface.
+        * src/SpeechInputClientImpl.cpp: Added new class, implementation of a two way connector between WebCore
+        and the embedder for requests and responses.
+        (WebKit::SpeechInputClientImpl::SpeechInputClientImpl):
+        (WebKit::SpeechInputClientImpl::~SpeechInputClientImpl):
+        (WebKit::SpeechInputClientImpl::startRecognition):
+        (WebKit::SpeechInputClientImpl::stopRecording):
+        (WebKit::SpeechInputClientImpl::didCompleteRecording):
+        (WebKit::SpeechInputClientImpl::setRecognitionResult):
+        (WebKit::SpeechInputClientImpl::didCompleteRecognition):
+        * src/SpeechInputClientImpl.h: Added.
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl): Pass on the above mentioned speech input connector to WebCore.
+        * src/WebViewImpl.h:
+
 2010-07-26  Ilya Tikhonovsky  <loislo at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 66ef57e..8b1879f 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -234,6 +234,8 @@
                 'public/WebSocketStreamError.h',
                 'public/WebSocketStreamHandle.h',
                 'public/WebSocketStreamHandleClient.h',
+                'public/WebSpeechInputController.h',
+                'public/WebSpeechInputListener.h',
                 'public/WebStorageArea.h',
                 'public/WebStorageEventDispatcher.h',
                 'public/WebStorageNamespace.h',
@@ -339,6 +341,8 @@
                 'src/ResourceHandle.cpp',
                 'src/SharedWorkerRepository.cpp',
                 'src/SocketStreamHandle.cpp',
+                'src/SpeechInputClientImpl.cpp',
+                'src/SpeechInputClientImpl.h',
                 'src/StorageAreaProxy.cpp',
                 'src/StorageAreaProxy.h',
                 'src/StorageEventDispatcherChromium.cpp',
diff --git a/WebKit/chromium/public/WebSpeechInputController.h b/WebKit/chromium/public/WebSpeechInputController.h
new file mode 100644
index 0000000..3dba5fb
--- /dev/null
+++ b/WebKit/chromium/public/WebSpeechInputController.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2010 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 WebSpeechInputController_h
+#define WebSpeechInputController_h
+
+#include "WebCommon.h"
+
+namespace WebKit {
+
+// Provides an embedder API called by WebKit.
+class WebSpeechInputController {
+public:
+    // Starts speech recognition. Speech will get recorded until the endpointer detects silence,
+    // runs to the limit or stopRecording is called. Progress indications and the recognized
+    // text are returned via the listener interface.
+    virtual bool startRecognition()
+    {
+         WEBKIT_ASSERT_NOT_REACHED();
+         return false;
+    }
+
+    // Cancels an ongoing recognition and discards any audio recorded so far. No partial
+    // recognition results are returned to the listener.
+    virtual void cancelRecognition() { WEBKIT_ASSERT_NOT_REACHED(); }
+
+    // Stops audio recording and performs recognition with the audio recorded until now
+    // (does not discard audio). This is an optional call and is typically invoked if the user
+    // wants to stop recording audio as soon as they finished speaking. Otherwise, the speech
+    // recording 'endpointer' should detect silence in the input and stop recording automatically.
+    // Call startRecognition() to record audio and recognize speech again.
+    virtual void stopRecording() { WEBKIT_ASSERT_NOT_REACHED(); }
+
+protected:
+    virtual ~WebSpeechInputController() { }
+};
+
+} // namespace WebKit
+
+#endif // WebSpeechInputController_h
diff --git a/WebKit/chromium/public/WebSpeechInputListener.h b/WebKit/chromium/public/WebSpeechInputListener.h
new file mode 100644
index 0000000..f1756af
--- /dev/null
+++ b/WebKit/chromium/public/WebSpeechInputListener.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 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 WebSpeechInputListener_h
+#define WebSpeechInputListener_h
+
+namespace WebKit {
+
+class WebString;
+
+// Provides a WebKit API called by the embedder.
+// A typical sequence of calls to the listener would be
+//   1 call to didCompleteRecording
+//   0 or more calls to setRecognitionResult
+//   1 call to didCompleteRecognition
+class WebSpeechInputListener {
+public:
+    // Informs that audio recording has completed and recognition is underway. This gets invoked
+    // irrespective of whether recording was stopped automatically by the 'endpointer' or if
+    // WebSpeechInputController::stopRecording() was called.
+    // Typically after this call the listener would update the UI to reflect that recognition is
+    // in progress.
+    virtual void didCompleteRecording() = 0;
+
+    // Gives results from speech recognition, either partial or the final results.
+    // This method can potentially get called multiple times if there are partial results
+    // available as the user keeps speaking. If the speech could not be recognized properly
+    // or if there was any other errors in the process, this method may never be called.
+    virtual void setRecognitionResult(const WebString&) = 0;
+
+    // Informs that speech recognition has completed. This gets invoked irrespective of whether
+    // recognition was succesful or not, whether setRecognitionResult() was invoked or not. The
+    // handler typically frees up any temporary resources allocated and waits for the next speech
+    // recognition request.
+    virtual void didCompleteRecognition() = 0;
+
+protected:
+    ~WebSpeechInputListener() { }
+};
+
+} // namespace WebKit
+
+#endif // WebSpeechInputListener_h
diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h
index 11fb233..4628c2f 100644
--- a/WebKit/chromium/public/WebViewClient.h
+++ b/WebKit/chromium/public/WebViewClient.h
@@ -55,6 +55,8 @@ class WebKeyboardEvent;
 class WebNode;
 class WebNotificationPresenter;
 class WebRange;
+class WebSpeechInputController;
+class WebSpeechInputListener;
 class WebStorageNamespace;
 class WebURL;
 class WebView;
@@ -331,7 +333,13 @@ public:
     // Geolocation ---------------------------------------------------------
 
     // Access the embedder API for geolocation services.
-    virtual WebKit::WebGeolocationService* geolocationService() { return 0; }
+    virtual WebGeolocationService* geolocationService() { return 0; }
+
+    // Speech --------------------------------------------------------------
+
+    // Access the embedder API for speech input services.
+    virtual WebSpeechInputController* speechInputController(
+        WebSpeechInputListener*) { return 0; }
 
 protected:
     ~WebViewClient() { }
diff --git a/WebKit/chromium/src/SpeechInputClientImpl.cpp b/WebKit/chromium/src/SpeechInputClientImpl.cpp
new file mode 100644
index 0000000..07be588
--- /dev/null
+++ b/WebKit/chromium/src/SpeechInputClientImpl.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2010 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 "SpeechInputClientImpl.h"
+
+#include "PlatformString.h"
+#include "WebSpeechInputController.h"
+#include "WebString.h"
+#include "WebViewClient.h"
+#include "page/SpeechInputClientListener.h"
+
+#if ENABLE(INPUT_SPEECH)
+
+namespace WebKit {
+
+SpeechInputClientImpl::SpeechInputClientImpl(WebViewClient* web_view_client)
+    : m_controller(web_view_client->speechInputController(this))
+    , m_listener(0)
+{
+    ASSERT(m_controller);
+}
+
+SpeechInputClientImpl::~SpeechInputClientImpl()
+{
+}
+
+bool SpeechInputClientImpl::startRecognition(WebCore::SpeechInputClientListener* listener)
+{
+    // Cancel any ongoing recognition first. No callbacks will be issued to that listener.
+    if (m_listener)
+        m_controller->cancelRecognition();
+
+    m_listener = listener;
+    return m_controller->startRecognition();
+}
+
+void SpeechInputClientImpl::stopRecording()
+{
+    ASSERT(m_listener);
+    m_controller->stopRecording();
+}
+
+void SpeechInputClientImpl::didCompleteRecording()
+{
+    ASSERT(m_listener);
+    if (m_listener)
+        m_listener->didCompleteRecording();
+}
+
+void SpeechInputClientImpl::didCompleteRecognition()
+{
+    ASSERT(m_listener);
+    m_listener = 0;
+}
+
+void SpeechInputClientImpl::setRecognitionResult(const WebString& result)
+{
+    ASSERT(m_listener);
+    if (m_listener)
+        m_listener->setRecognitionResult(result);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(INPUT_SPEECH)
diff --git a/WebKit/chromium/src/SpeechInputClientImpl.h b/WebKit/chromium/src/SpeechInputClientImpl.h
new file mode 100644
index 0000000..ffa28c7
--- /dev/null
+++ b/WebKit/chromium/src/SpeechInputClientImpl.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010 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 SpeechInputClientImpl_h
+#define SpeechInputClientImpl_h
+
+#if ENABLE(INPUT_SPEECH)
+
+#include "WebSpeechInputListener.h"
+#include "page/SpeechInputClient.h"
+
+namespace WebCore {
+class SpeechInputClientListener;
+}
+
+namespace WebKit {
+
+class WebSpeechInputController;
+class WebViewClient;
+
+class SpeechInputClientImpl
+    : public WebCore::SpeechInputClient,
+      public WebSpeechInputListener {
+public:
+    SpeechInputClientImpl(WebViewClient*);
+    virtual ~SpeechInputClientImpl();
+
+    // SpeechInputClient methods.
+    bool startRecognition(WebCore::SpeechInputClientListener*);
+    void stopRecording();
+
+    // WebSpeechInputListener methods.
+    void didCompleteRecording();
+    void setRecognitionResult(const WebString&);
+    void didCompleteRecognition();
+
+private:
+    WebSpeechInputController* m_controller; // To call into the embedder.
+    WebCore::SpeechInputClientListener* m_listener; // Valid when recognition is in progress.
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(INPUT_SPEECH)
+
+#endif // SpeechInputClientImpl_h
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index b8b8599..d8e69d4 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -258,6 +258,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools
     , m_layerRenderer(0)
     , m_isAcceleratedCompositingActive(false)
 #endif
+#if ENABLE(INPUT_SPEECH)
+    , m_speechInputClient(client)
+#endif
     , m_gles2Context(0)
 {
     // WebKit/win/WebView.cpp does the same thing, except they call the
@@ -278,6 +281,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools
 
     m_page->backForwardList()->setClient(&m_backForwardListClientImpl);
     m_page->setGroupName(pageGroupName);
+#if ENABLE(INPUT_SPEECH)
+    m_page->setSpeechInputClient(&m_speechInputClient);
+#endif
 
     m_inspectorSettingsMap.set(new SettingsMap);
 }
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index d4e1113..d0fda92 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -47,6 +47,7 @@
 #include "InspectorClientImpl.h"
 #include "LayerRendererChromium.h"
 #include "NotificationPresenterImpl.h"
+#include "SpeechInputClientImpl.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/RefCounted.h>
 
@@ -511,6 +512,10 @@ private:
 #endif
     static const WebInputEvent* m_currentInputEvent;
 
+#if ENABLE(INPUT_SPEECH)
+    SpeechInputClientImpl m_speechInputClient;
+#endif
+
     OwnPtr<WebGLES2Context> m_gles2Context;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list