[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:29:22 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e55beb36c32eaeb50307c598ab55534c3f7d24b2
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jul 27 07:50:57 2010 +0000

    2010-07-27  Satish Sampath  <satish at chromium.org>
    
            Reviewed by Kent Tamura.
    
            Simplify speech input plumbing in webcore and webkit
            https://bugs.webkit.org/show_bug.cgi?id=43008
    
            No new tests as functionality is not changed.
    
            * GNUmakefile.am: Removed a header file.
            * WebCore.gypi:
            * WebCore.pro:
            * WebCore.vcproj/WebCore.vcproj:
            * WebCore.xcodeproj/project.pbxproj:
            * page/Page.cpp:
            (WebCore::Page::speechInput): Creates and returns SpeechInput when needed.
            * page/Page.h:
            * page/SpeechInput.cpp: Added methods to proxy and callbacks between input elements and WebKit
            (WebCore::SpeechInput::SpeechInput):
            (WebCore::SpeechInput::didCompleteRecording):
            (WebCore::SpeechInput::didCompleteRecognition):
            (WebCore::SpeechInput::setRecognitionResult):
            (WebCore::SpeechInput::startRecognition):
            (WebCore::SpeechInput::stopRecording):
            * page/SpeechInput.h:
            * page/SpeechInputClient.h:
            * page/SpeechInputClientListener.h: Removed.
            * page/SpeechInputListener.h:
            * rendering/TextControlInnerElements.cpp: Added one more callback.
            (WebCore::InputFieldSpeechButtonElement::defaultEventHandler):
            (WebCore::InputFieldSpeechButtonElement::speechInput):
            (WebCore::InputFieldSpeechButtonElement::didCompleteRecognition):
            * rendering/TextControlInnerElements.h:
    2010-07-27  Satish Sampath  <satish at chromium.org>
    
            Reviewed by Kent Tamura.
    
            Simplify speech input plumbing in webcore and webkit
            https://bugs.webkit.org/show_bug.cgi?id=43008
    
            * src/SpeechInputClientImpl.cpp: Move functionality to WebCore::SpeechInput and make this a dummy proxy.
            (WebKit::SpeechInputClientImpl::startRecognition):
            (WebKit::SpeechInputClientImpl::cancelRecognition):
            (WebKit::SpeechInputClientImpl::didCompleteRecording):
            (WebKit::SpeechInputClientImpl::didCompleteRecognition):
            (WebKit::SpeechInputClientImpl::setRecognitionResult):
            * src/SpeechInputClientImpl.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64111 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3ad3284..eeec11f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-07-27  Satish Sampath  <satish at chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        Simplify speech input plumbing in webcore and webkit
+        https://bugs.webkit.org/show_bug.cgi?id=43008
+
+        No new tests as functionality is not changed.
+
+        * GNUmakefile.am: Removed a header file.
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/Page.cpp:
+        (WebCore::Page::speechInput): Creates and returns SpeechInput when needed.
+        * page/Page.h:
+        * page/SpeechInput.cpp: Added methods to proxy and callbacks between input elements and WebKit
+        (WebCore::SpeechInput::SpeechInput):
+        (WebCore::SpeechInput::didCompleteRecording):
+        (WebCore::SpeechInput::didCompleteRecognition):
+        (WebCore::SpeechInput::setRecognitionResult):
+        (WebCore::SpeechInput::startRecognition):
+        (WebCore::SpeechInput::stopRecording):
+        * page/SpeechInput.h:
+        * page/SpeechInputClient.h:
+        * page/SpeechInputClientListener.h: Removed.
+        * page/SpeechInputListener.h:
+        * rendering/TextControlInnerElements.cpp: Added one more callback.
+        (WebCore::InputFieldSpeechButtonElement::defaultEventHandler):
+        (WebCore::InputFieldSpeechButtonElement::speechInput):
+        (WebCore::InputFieldSpeechButtonElement::didCompleteRecognition):
+        * rendering/TextControlInnerElements.h:
+
 2010-07-27  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Ojan Vafai.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 8339ffb..f7217ac 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2952,7 +2952,6 @@ webcore_sources += \
 	WebCore/page/SpeechInput.cpp \
 	WebCore/page/SpeechInput.h \
 	WebCore/page/SpeechInputClient.h \
-	WebCore/page/SpeechInputClientListener.h \
 	WebCore/page/SpeechInputListener.h
 
 else
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index b83256e..7d7cff5 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -2040,7 +2040,6 @@
             'page/SpeechInput.cpp',
             'page/SpeechInput.h',
             'page/SpeechInputClient.h',
-            'page/SpeechInputClientListener.h',
             'page/SpeechInputListener.h',
             'page/SuspendableTimer.cpp',
             'page/SuspendableTimer.h',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 0905422..0751809 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1612,7 +1612,6 @@ HEADERS += \
     page/SpatialNavigation.h \
     page/SpeechInput.h \
     page/SpeechInputClient.h \
-    page/SpeechInputClientListener.h \
     page/SpeechInputListener.h \
     page/WindowFeatures.h \
     page/WorkerNavigator.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index a97ffa7..8195439 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -22501,10 +22501,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\page\SpeechInputClientListener.h"
-				>
-			</File>
-			<File
 				RelativePath="..\page\SpeechInputListener.h"
 				>
 			</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 3d5bf32..74de681 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1351,7 +1351,6 @@
 		7578F90B11DDF26900D933C5 /* SpeechInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7578F90811DDF26900D933C5 /* SpeechInput.cpp */; };
 		7578F90C11DDF26900D933C5 /* SpeechInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 7578F90911DDF26900D933C5 /* SpeechInput.h */; };
 		7578F90D11DDF26900D933C5 /* SpeechInputClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7578F90A11DDF26900D933C5 /* SpeechInputClient.h */; };
-		7578F91F11E4E32800D933C5 /* SpeechInputClientListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7578F91D11E4E32800D933C5 /* SpeechInputClientListener.h */; };
 		7578F92011E4E32800D933C5 /* SpeechInputListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7578F91E11E4E32800D933C5 /* SpeechInputListener.h */; };
 		75793E830D0CE0B3007FC0AC /* MessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */; };
 		75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793E810D0CE0B3007FC0AC /* MessageEvent.h */; };
@@ -7126,7 +7125,6 @@
 		7578F90811DDF26900D933C5 /* SpeechInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpeechInput.cpp; sourceTree = "<group>"; };
 		7578F90911DDF26900D933C5 /* SpeechInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechInput.h; sourceTree = "<group>"; };
 		7578F90A11DDF26900D933C5 /* SpeechInputClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechInputClient.h; sourceTree = "<group>"; };
-		7578F91D11E4E32800D933C5 /* SpeechInputClientListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechInputClientListener.h; sourceTree = "<group>"; };
 		7578F91E11E4E32800D933C5 /* SpeechInputListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechInputListener.h; sourceTree = "<group>"; };
 		75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = MessageEvent.cpp; path = dom/MessageEvent.cpp; sourceTree = SOURCE_ROOT; };
 		75793E810D0CE0B3007FC0AC /* MessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = MessageEvent.h; path = dom/MessageEvent.h; sourceTree = SOURCE_ROOT; };
@@ -12386,7 +12384,6 @@
 				7578F90811DDF26900D933C5 /* SpeechInput.cpp */,
 				7578F90911DDF26900D933C5 /* SpeechInput.h */,
 				7578F90A11DDF26900D933C5 /* SpeechInputClient.h */,
-				7578F91D11E4E32800D933C5 /* SpeechInputClientListener.h */,
 				7578F91E11E4E32800D933C5 /* SpeechInputListener.h */,
 				62C1217A11AB9E76003C462C /* SuspendableTimer.cpp */,
 				62C1217B11AB9E77003C462C /* SuspendableTimer.h */,
@@ -19383,7 +19380,6 @@
 				626CDE0F1140424C001E5A68 /* SpatialNavigation.h in Headers */,
 				7578F90C11DDF26900D933C5 /* SpeechInput.h in Headers */,
 				7578F90D11DDF26900D933C5 /* SpeechInputClient.h in Headers */,
-				7578F91F11E4E32800D933C5 /* SpeechInputClientListener.h in Headers */,
 				7578F92011E4E32800D933C5 /* SpeechInputListener.h in Headers */,
 				93309E12099E64920056E581 /* SplitElementCommand.h in Headers */,
 				93309E14099E64920056E581 /* SplitTextNodeCommand.h in Headers */,
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index aaf3d4c..1fd9355 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -62,6 +62,7 @@
 #include "SelectionController.h"
 #include "Settings.h"
 #include "SharedBuffer.h"
+#include "SpeechInput.h"
 #include "SpeechInputClient.h"
 #include "StringHash.h"
 #include "TextResourceDecoder.h"
@@ -791,6 +792,16 @@ InspectorTimelineAgent* Page::inspectorTimelineAgent() const
 }
 #endif
 
+#if ENABLE(INPUT_SPEECH)
+SpeechInput* Page::speechInput()
+{
+    ASSERT(m_speechInputClient);
+    if (!m_speechInput.get())
+        m_speechInput.set(new SpeechInput(m_speechInputClient));
+    return m_speechInput.get();
+}
+#endif
+
 void Page::privateBrowsingStateChanged()
 {
     bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled();
diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h
index 8599a83..adca4f0 100644
--- a/WebCore/page/Page.h
+++ b/WebCore/page/Page.h
@@ -70,6 +70,7 @@ namespace WebCore {
     class VisibleSelection;
     class SelectionController;
     class Settings;
+    class SpeechInput;
     class SpeechInputClient;
 
 #if ENABLE(DOM_STORAGE)
@@ -155,7 +156,7 @@ namespace WebCore {
 #endif
 #if ENABLE(INPUT_SPEECH)
         void setSpeechInputClient(SpeechInputClient* client) { m_speechInputClient = client; }
-        SpeechInputClient* speechInputClient() const { return m_speechInputClient; }
+        SpeechInput* speechInput();
 #endif
         Settings* settings() const { return m_settings.get(); }
         ProgressTracker* progress() const { return m_progress.get(); }
@@ -276,6 +277,7 @@ namespace WebCore {
 #endif
 #if ENABLE(INPUT_SPEECH)
         SpeechInputClient* m_speechInputClient;
+        OwnPtr<SpeechInput> m_speechInput;
 #endif
         OwnPtr<Settings> m_settings;
         OwnPtr<ProgressTracker> m_progress;
diff --git a/WebCore/page/SpeechInput.cpp b/WebCore/page/SpeechInput.cpp
index ec338c9..4f37988 100644
--- a/WebCore/page/SpeechInput.cpp
+++ b/WebCore/page/SpeechInput.cpp
@@ -39,27 +39,48 @@
 
 namespace WebCore {
 
-SpeechInput::SpeechInput(SpeechInputClient* client, SpeechInputListener* listener)
+SpeechInput::SpeechInput(SpeechInputClient* client)
     : m_client(client)
-    , m_listener(listener)
+    , m_listener(0)
 {
 }
 
 void SpeechInput::didCompleteRecording()
 {
+    ASSERT(m_listener);
     m_listener->didCompleteRecording();
 }
 
+void SpeechInput::didCompleteRecognition()
+{
+    ASSERT(m_listener);
+    m_listener->didCompleteRecognition();
+    m_listener = 0;
+}
+
 void SpeechInput::setRecognitionResult(const String& result)
 {
+    ASSERT(m_listener);
     m_listener->setRecognitionResult(result);
 }
 
-bool SpeechInput::startRecognition()
+bool SpeechInput::startRecognition(SpeechInputListener* listener)
+{
+    // Cancel any ongoing recognition first.
+    if (m_listener) {
+        m_listener->didCompleteRecognition();
+        m_listener = 0;
+        m_client->cancelRecognition();
+    }
+
+    m_listener = listener;
+    return m_client->startRecognition(this);
+}
+
+void SpeechInput::stopRecording()
 {
-    if (m_client)
-        return m_client->startRecognition(this);
-    return false;
+    ASSERT(m_listener);
+    m_client->stopRecording();
 }
 
 } // namespace WebCore
diff --git a/WebCore/page/SpeechInput.h b/WebCore/page/SpeechInput.h
index 8098f67..2ce0eea 100644
--- a/WebCore/page/SpeechInput.h
+++ b/WebCore/page/SpeechInput.h
@@ -33,7 +33,7 @@
 
 #if ENABLE(INPUT_SPEECH)
 
-#include "SpeechInputClientListener.h"
+#include "SpeechInputListener.h"
 #include <wtf/Noncopyable.h>
 
 namespace WebCore {
@@ -45,21 +45,20 @@ class String;
 // This class connects the input elements requiring speech input with the platform specific
 // speech recognition engine. It provides methods for the input elements to activate speech
 // recognition and methods for the speech recognition engine to return back the results.
-class SpeechInput : public Noncopyable, public SpeechInputClientListener {
+class SpeechInput : public Noncopyable, public SpeechInputListener {
 public:
-    SpeechInput(SpeechInputClient*, SpeechInputListener*);
+    SpeechInput(SpeechInputClient*);
     virtual ~SpeechInput() { }
 
     // Methods invoked by the input elements.
-    virtual bool startRecognition();
+    bool startRecognition(SpeechInputListener* listener);
+    void stopRecording();
 
-    // SpeechInputClient::Listener methods.
+    // SpeechInputListener methods.
     virtual void didCompleteRecording();
+    virtual void didCompleteRecognition();
     virtual void setRecognitionResult(const String&);
 
-protected:
-    SpeechInputClient* client() const { return m_client; }
-
 private:
     SpeechInputClient* m_client;
     SpeechInputListener* m_listener;
diff --git a/WebCore/page/SpeechInputClient.h b/WebCore/page/SpeechInputClient.h
index 5d1ed8b..f6c61cf 100644
--- a/WebCore/page/SpeechInputClient.h
+++ b/WebCore/page/SpeechInputClient.h
@@ -35,17 +35,21 @@
 
 namespace WebCore {
 
-class SpeechInputClientListener;
+class SpeechInputListener;
 
 // Provides an interface for SpeechInput to call into the embedder.
 class SpeechInputClient {
 public:
-    virtual bool startRecognition(SpeechInputClientListener* listener) = 0;
+    virtual bool startRecognition(SpeechInputListener* listener) = 0;
 
     // Stops audio recording and performs recognition with the audio recorded until now
     // (does not discard audio).
     virtual void stopRecording() = 0;
 
+    // Cancels an ongoing recognition and discards any audio recorded so far. No partial
+    // recognition results are returned to the listener.
+    virtual void cancelRecognition() = 0;
+
 protected:
     virtual ~SpeechInputClient() { }
 };
diff --git a/WebCore/page/SpeechInputClientListener.h b/WebCore/page/SpeechInputClientListener.h
deleted file mode 100644
index 483f261..0000000
--- a/WebCore/page/SpeechInputClientListener.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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 SpeechInputClientListener_h
-#define SpeechInputClientListener_h
-
-#if ENABLE(INPUT_SPEECH)
-
-namespace WebCore {
-
-class String;
-
-// Provides an interface for the embedder to call into WebCore.
-class SpeechInputClientListener {
-public:
-    // 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:
-    virtual ~SpeechInputClientListener() { }
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(INPUT_SPEECH)
-
-#endif // SpeechInputClientListener_h
diff --git a/WebCore/page/SpeechInputListener.h b/WebCore/page/SpeechInputListener.h
index 6b4fd9f..1b21a11 100644
--- a/WebCore/page/SpeechInputListener.h
+++ b/WebCore/page/SpeechInputListener.h
@@ -43,6 +43,12 @@ public:
     // Informs that audio recording has completed and recognition is underway.
     virtual void didCompleteRecording() = 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;
+
     // 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
diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp
index 7cd08ae..b29876a 100644
--- a/WebCore/rendering/TextControlInnerElements.cpp
+++ b/WebCore/rendering/TextControlInnerElements.cpp
@@ -380,7 +380,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
                 m_capturing = false;
             }
             if (hovered()) {
-                speechInput()->startRecognition();
+                speechInput()->startRecognition(this);
                 event->setDefaultHandled();
             }
         }
@@ -392,9 +392,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
 
 SpeechInput* InputFieldSpeechButtonElement::speechInput()
 {
-    if (!m_speechInput)
-        m_speechInput.set(new SpeechInput(document()->page()->speechInputClient(), this));
-    return m_speechInput.get();
+    return document()->page()->speechInput();
 }
 
 void InputFieldSpeechButtonElement::didCompleteRecording()
@@ -403,6 +401,11 @@ void InputFieldSpeechButtonElement::didCompleteRecording()
     // in progress.
 }
 
+void InputFieldSpeechButtonElement::didCompleteRecognition()
+{
+    // FIXME: Add UI feedback here to indicate that audio recognition has ended.
+}
+
 void InputFieldSpeechButtonElement::setRecognitionResult(const String& result)
 {
     HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
diff --git a/WebCore/rendering/TextControlInnerElements.h b/WebCore/rendering/TextControlInnerElements.h
index d5dfd63..ed38221 100644
--- a/WebCore/rendering/TextControlInnerElements.h
+++ b/WebCore/rendering/TextControlInnerElements.h
@@ -125,6 +125,7 @@ public:
 
     // SpeechInputListener methods.
     void didCompleteRecording();
+    void didCompleteRecognition();
     void setRecognitionResult(const String& result);
 
 private:
@@ -133,7 +134,6 @@ private:
     SpeechInput* speechInput();
 
     bool m_capturing;
-    OwnPtr<SpeechInput> m_speechInput;
 };
 
 #endif // ENABLE(INPUT_SPEECH)
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 4d6e9dd..fc5c7a3 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-27  Satish Sampath  <satish at chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        Simplify speech input plumbing in webcore and webkit
+        https://bugs.webkit.org/show_bug.cgi?id=43008
+
+        * src/SpeechInputClientImpl.cpp: Move functionality to WebCore::SpeechInput and make this a dummy proxy.
+        (WebKit::SpeechInputClientImpl::startRecognition):
+        (WebKit::SpeechInputClientImpl::cancelRecognition):
+        (WebKit::SpeechInputClientImpl::didCompleteRecording):
+        (WebKit::SpeechInputClientImpl::didCompleteRecognition):
+        (WebKit::SpeechInputClientImpl::setRecognitionResult):
+        * src/SpeechInputClientImpl.h:
+
 2010-07-26  Dominic Mazzoni  <dmazzoni at google.com>
 
         Reviewed by Chris Fleizach.
diff --git a/WebKit/chromium/src/SpeechInputClientImpl.cpp b/WebKit/chromium/src/SpeechInputClientImpl.cpp
index 07be588..8bccacf 100644
--- a/WebKit/chromium/src/SpeechInputClientImpl.cpp
+++ b/WebKit/chromium/src/SpeechInputClientImpl.cpp
@@ -35,7 +35,7 @@
 #include "WebSpeechInputController.h"
 #include "WebString.h"
 #include "WebViewClient.h"
-#include "page/SpeechInputClientListener.h"
+#include "page/SpeechInputListener.h"
 
 #if ENABLE(INPUT_SPEECH)
 
@@ -52,12 +52,8 @@ SpeechInputClientImpl::~SpeechInputClientImpl()
 {
 }
 
-bool SpeechInputClientImpl::startRecognition(WebCore::SpeechInputClientListener* listener)
+bool SpeechInputClientImpl::startRecognition(WebCore::SpeechInputListener* 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();
 }
@@ -68,24 +64,29 @@ void SpeechInputClientImpl::stopRecording()
     m_controller->stopRecording();
 }
 
+void SpeechInputClientImpl::cancelRecognition()
+{
+    ASSERT(m_listener);
+    m_controller->cancelRecognition();
+}
+
 void SpeechInputClientImpl::didCompleteRecording()
 {
     ASSERT(m_listener);
-    if (m_listener)
-        m_listener->didCompleteRecording();
+    m_listener->didCompleteRecording();
 }
 
 void SpeechInputClientImpl::didCompleteRecognition()
 {
     ASSERT(m_listener);
+    m_listener->didCompleteRecognition();
     m_listener = 0;
 }
 
 void SpeechInputClientImpl::setRecognitionResult(const WebString& result)
 {
     ASSERT(m_listener);
-    if (m_listener)
-        m_listener->setRecognitionResult(result);
+    m_listener->setRecognitionResult(result);
 }
 
 } // namespace WebKit
diff --git a/WebKit/chromium/src/SpeechInputClientImpl.h b/WebKit/chromium/src/SpeechInputClientImpl.h
index ffa28c7..5762da8 100644
--- a/WebKit/chromium/src/SpeechInputClientImpl.h
+++ b/WebKit/chromium/src/SpeechInputClientImpl.h
@@ -37,7 +37,7 @@
 #include "page/SpeechInputClient.h"
 
 namespace WebCore {
-class SpeechInputClientListener;
+class SpeechInputListener;
 }
 
 namespace WebKit {
@@ -53,8 +53,9 @@ public:
     virtual ~SpeechInputClientImpl();
 
     // SpeechInputClient methods.
-    bool startRecognition(WebCore::SpeechInputClientListener*);
+    bool startRecognition(WebCore::SpeechInputListener*);
     void stopRecording();
+    void cancelRecognition();
 
     // WebSpeechInputListener methods.
     void didCompleteRecording();
@@ -63,7 +64,7 @@ public:
 
 private:
     WebSpeechInputController* m_controller; // To call into the embedder.
-    WebCore::SpeechInputClientListener* m_listener; // Valid when recognition is in progress.
+    WebCore::SpeechInputListener* m_listener; // Valid when recognition is in progress.
 };
 
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list