Changeset 64042 in webkit
- Timestamp:
- Jul 26, 2010 4:52:50 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 13 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64041 r64042 1 2010-07-26 Satish Sampath <satish@chromium.org> 2 3 Reviewed by Steve Block. 4 5 Add WebKit plumbing to connect speech requests and callbacks between WebCore and the embedder. 6 https://bugs.webkit.org/show_bug.cgi?id=42367 7 8 No new tests, the relevant LayoutTestController bindings will be added in the next patch. 9 10 * page/SpeechInput.cpp: renamed a method. 11 * page/SpeechInput.h: renamed a method. 12 * page/SpeechInputClient.h: added an extra method to optionally let users stop recording once they have spoken. 13 * page/SpeechInputClientListener.h: renamed a method. 14 * page/SpeechInputListener.h: renamed a method. 15 1 16 2010-07-26 Andreas Kling <andreas.kling@nokia.com> 2 17 -
trunk/WebCore/page/SpeechInput.cpp
r63230 r64042 46 46 } 47 47 48 void SpeechInput:: recordingComplete()48 void SpeechInput::didCompleteRecording() 49 49 { 50 m_listener-> recordingComplete();50 m_listener->didCompleteRecording(); 51 51 } 52 52 -
trunk/WebCore/page/SpeechInput.h
r63230 r64042 55 55 56 56 // SpeechInputClient::Listener methods. 57 virtual void recordingComplete();57 virtual void didCompleteRecording(); 58 58 virtual void setRecognitionResult(const String&); 59 59 -
trunk/WebCore/page/SpeechInputClient.h
r63230 r64042 43 43 virtual bool startRecognition(SpeechInputClientListener* listener) = 0; 44 44 45 // Stops audio recording and performs recognition with the audio recorded until now 46 // (does not discard audio). 47 virtual void stopRecording() = 0; 48 45 49 protected: 46 50 virtual ~SpeechInputClient() { } -
trunk/WebCore/page/SpeechInputClientListener.h
r63230 r64042 41 41 class SpeechInputClientListener { 42 42 public: 43 virtual void recordingComplete() = 0; 43 // Informs that audio recording has completed and recognition is underway. 44 virtual void didCompleteRecording() = 0; 45 46 // Gives results from speech recognition, either partial or the final results. 47 // This method can potentially get called multiple times if there are partial results 48 // available as the user keeps speaking. If the speech could not be recognized properly 49 // or if there was any other errors in the process, this method may never be called. 44 50 virtual void setRecognitionResult(const String& result) = 0; 45 51 -
trunk/WebCore/page/SpeechInputListener.h
r63230 r64042 41 41 class SpeechInputListener { 42 42 public: 43 virtual void recordingComplete() = 0; 43 // Informs that audio recording has completed and recognition is underway. 44 virtual void didCompleteRecording() = 0; 45 46 // Gives results from speech recognition, either partial or the final results. 47 // This method can potentially get called multiple times if there are partial results 48 // available as the user keeps speaking. If the speech could not be recognized properly 49 // or if there was any other errors in the process, this method may never be called. 44 50 virtual void setRecognitionResult(const String& result) = 0; 45 51 -
trunk/WebCore/rendering/TextControlInnerElements.cpp
r63929 r64042 398 398 } 399 399 400 void InputFieldSpeechButtonElement:: recordingComplete()400 void InputFieldSpeechButtonElement::didCompleteRecording() 401 401 { 402 402 // FIXME: Add UI feedback here to indicate that audio recording stopped and recognition is -
trunk/WebCore/rendering/TextControlInnerElements.h
r63582 r64042 125 125 126 126 // SpeechInputListener methods. 127 void recordingComplete();127 void didCompleteRecording(); 128 128 void setRecognitionResult(const String& result); 129 129 -
trunk/WebKit/chromium/ChangeLog
r64035 r64042 1 2010-07-26 Satish Sampath <satish@chromium.org> 2 3 Reviewed by Steve Block. 4 5 Add WebKit plumbing to connect speech requests and callbacks between WebCore and the embedder. 6 https://bugs.webkit.org/show_bug.cgi?id=42367 7 8 No new tests, the relevant LayoutTestController bindings and tests will be added in the next patch. 9 10 * public/WebSpeechInputController.h: Added new interface, implemented by embedder and called by WebKit 11 (WebKit::WebSpeechInputController::~WebSpeechInputController): 12 * public/WebSpeechInputListener.h: Added new interface, implemented by WebKit and called by embedder. 13 (WebKit::WebSpeechInputListener::~WebSpeechInputListener): 14 * public/WebViewClient.h: 15 (WebKit::WebViewClient::createSpeechInputClient): New method to get the embedder's speech input client interface. 16 * src/SpeechInputClientImpl.cpp: Added new class, implementation of a two way connector between WebCore 17 and the embedder for requests and responses. 18 (WebKit::SpeechInputClientImpl::SpeechInputClientImpl): 19 (WebKit::SpeechInputClientImpl::~SpeechInputClientImpl): 20 (WebKit::SpeechInputClientImpl::startRecognition): 21 (WebKit::SpeechInputClientImpl::stopRecording): 22 (WebKit::SpeechInputClientImpl::didCompleteRecording): 23 (WebKit::SpeechInputClientImpl::setRecognitionResult): 24 (WebKit::SpeechInputClientImpl::didCompleteRecognition): 25 * src/SpeechInputClientImpl.h: Added. 26 * src/WebViewImpl.cpp: 27 (WebKit::WebViewImpl::WebViewImpl): Pass on the above mentioned speech input connector to WebCore. 28 * src/WebViewImpl.h: 29 1 30 2010-07-26 Ilya Tikhonovsky <loislo@chromium.org> 2 31 -
trunk/WebKit/chromium/WebKit.gyp
r63874 r64042 235 235 'public/WebSocketStreamHandle.h', 236 236 'public/WebSocketStreamHandleClient.h', 237 'public/WebSpeechInputController.h', 238 'public/WebSpeechInputListener.h', 237 239 'public/WebStorageArea.h', 238 240 'public/WebStorageEventDispatcher.h', … … 340 342 'src/SharedWorkerRepository.cpp', 341 343 'src/SocketStreamHandle.cpp', 344 'src/SpeechInputClientImpl.cpp', 345 'src/SpeechInputClientImpl.h', 342 346 'src/StorageAreaProxy.cpp', 343 347 'src/StorageAreaProxy.h', -
trunk/WebKit/chromium/public/WebSpeechInputController.h
r64041 r64042 29 29 */ 30 30 31 #ifndef SpeechInputClientListener_h32 #define SpeechInputClientListener_h31 #ifndef WebSpeechInputController_h 32 #define WebSpeechInputController_h 33 33 34 #i f ENABLE(INPUT_SPEECH)34 #include "WebCommon.h" 35 35 36 namespace Web Core{36 namespace WebKit { 37 37 38 class String; 38 // Provides an embedder API called by WebKit. 39 class WebSpeechInputController { 40 public: 41 // Starts speech recognition. Speech will get recorded until the endpointer detects silence, 42 // runs to the limit or stopRecording is called. Progress indications and the recognized 43 // text are returned via the listener interface. 44 virtual bool startRecognition() 45 { 46 WEBKIT_ASSERT_NOT_REACHED(); 47 return false; 48 } 39 49 40 // Provides an interface for the embedder to call into WebCore. 41 class SpeechInputClientListener { 42 public: 43 virtual void recordingComplete() = 0; 44 virtual void setRecognitionResult(const String& result) = 0; 50 // Cancels an ongoing recognition and discards any audio recorded so far. No partial 51 // recognition results are returned to the listener. 52 virtual void cancelRecognition() { WEBKIT_ASSERT_NOT_REACHED(); } 53 54 // Stops audio recording and performs recognition with the audio recorded until now 55 // (does not discard audio). This is an optional call and is typically invoked if the user 56 // wants to stop recording audio as soon as they finished speaking. Otherwise, the speech 57 // recording 'endpointer' should detect silence in the input and stop recording automatically. 58 // Call startRecognition() to record audio and recognize speech again. 59 virtual void stopRecording() { WEBKIT_ASSERT_NOT_REACHED(); } 45 60 46 61 protected: 47 virtual ~ SpeechInputClientListener() { }62 virtual ~WebSpeechInputController() { } 48 63 }; 49 64 50 } // namespace Web Core65 } // namespace WebKit 51 66 52 #endif // ENABLE(INPUT_SPEECH) 53 54 #endif // SpeechInputClientListener_h 67 #endif // WebSpeechInputController_h -
trunk/WebKit/chromium/public/WebViewClient.h
r63379 r64042 56 56 class WebNotificationPresenter; 57 57 class WebRange; 58 class WebSpeechInputController; 59 class WebSpeechInputListener; 58 60 class WebStorageNamespace; 59 61 class WebURL; … … 332 334 333 335 // Access the embedder API for geolocation services. 334 virtual WebKit::WebGeolocationService* geolocationService() { return 0; } 336 virtual WebGeolocationService* geolocationService() { return 0; } 337 338 // Speech -------------------------------------------------------------- 339 340 // Access the embedder API for speech input services. 341 virtual WebSpeechInputController* speechInputController( 342 WebSpeechInputListener*) { return 0; } 335 343 336 344 protected: -
trunk/WebKit/chromium/src/SpeechInputClientImpl.cpp
r64041 r64042 30 30 31 31 #include "config.h" 32 #include "SpeechInput.h" 32 #include "SpeechInputClientImpl.h" 33 34 #include "PlatformString.h" 35 #include "WebSpeechInputController.h" 36 #include "WebString.h" 37 #include "WebViewClient.h" 38 #include "page/SpeechInputClientListener.h" 33 39 34 40 #if ENABLE(INPUT_SPEECH) 35 41 36 #include "Frame.h" 37 #include "SpeechInputClient.h" 38 #include "SpeechInputListener.h" 42 namespace WebKit { 39 43 40 namespace WebCore { 44 SpeechInputClientImpl::SpeechInputClientImpl(WebViewClient* web_view_client) 45 : m_controller(web_view_client->speechInputController(this)) 46 , m_listener(0) 47 { 48 ASSERT(m_controller); 49 } 41 50 42 SpeechInput::SpeechInput(SpeechInputClient* client, SpeechInputListener* listener) 43 : m_client(client) 44 , m_listener(listener) 51 SpeechInputClientImpl::~SpeechInputClientImpl() 45 52 { 46 53 } 47 54 48 void SpeechInput::recordingComplete()55 bool SpeechInputClientImpl::startRecognition(WebCore::SpeechInputClientListener* listener) 49 56 { 50 m_listener->recordingComplete(); 57 // Cancel any ongoing recognition first. No callbacks will be issued to that listener. 58 if (m_listener) 59 m_controller->cancelRecognition(); 60 61 m_listener = listener; 62 return m_controller->startRecognition(); 51 63 } 52 64 53 void SpeechInput ::setRecognitionResult(const String& result)65 void SpeechInputClientImpl::stopRecording() 54 66 { 55 m_listener->setRecognitionResult(result); 67 ASSERT(m_listener); 68 m_controller->stopRecording(); 56 69 } 57 70 58 bool SpeechInput::startRecognition()71 void SpeechInputClientImpl::didCompleteRecording() 59 72 { 60 if (m_client)61 return m_client->startRecognition(this);62 return false;73 ASSERT(m_listener); 74 if (m_listener) 75 m_listener->didCompleteRecording(); 63 76 } 64 77 65 } // namespace WebCore 78 void SpeechInputClientImpl::didCompleteRecognition() 79 { 80 ASSERT(m_listener); 81 m_listener = 0; 82 } 83 84 void SpeechInputClientImpl::setRecognitionResult(const WebString& result) 85 { 86 ASSERT(m_listener); 87 if (m_listener) 88 m_listener->setRecognitionResult(result); 89 } 90 91 } // namespace WebKit 66 92 67 93 #endif // ENABLE(INPUT_SPEECH) -
trunk/WebKit/chromium/src/SpeechInputClientImpl.h
r64041 r64042 29 29 */ 30 30 31 #ifndef SpeechInputClient _h32 #define SpeechInputClient _h31 #ifndef SpeechInputClientImpl_h 32 #define SpeechInputClientImpl_h 33 33 34 34 #if ENABLE(INPUT_SPEECH) 35 35 36 #include "WebSpeechInputListener.h" 37 #include "page/SpeechInputClient.h" 38 36 39 namespace WebCore { 40 class SpeechInputClientListener; 41 } 37 42 38 class SpeechInputClientListener; 43 namespace WebKit { 39 44 40 // Provides an interface for SpeechInput to call into the embedder. 41 class SpeechInputClient { 45 class WebSpeechInputController; 46 class WebViewClient; 47 48 class SpeechInputClientImpl 49 : public WebCore::SpeechInputClient, 50 public WebSpeechInputListener { 42 51 public: 43 virtual bool startRecognition(SpeechInputClientListener* listener) = 0; 52 SpeechInputClientImpl(WebViewClient*); 53 virtual ~SpeechInputClientImpl(); 44 54 45 protected: 46 virtual ~SpeechInputClient() { } 55 // SpeechInputClient methods. 56 bool startRecognition(WebCore::SpeechInputClientListener*); 57 void stopRecording(); 58 59 // WebSpeechInputListener methods. 60 void didCompleteRecording(); 61 void setRecognitionResult(const WebString&); 62 void didCompleteRecognition(); 63 64 private: 65 WebSpeechInputController* m_controller; // To call into the embedder. 66 WebCore::SpeechInputClientListener* m_listener; // Valid when recognition is in progress. 47 67 }; 48 68 49 } // namespace Web Core69 } // namespace WebKit 50 70 51 71 #endif // ENABLE(INPUT_SPEECH) 52 72 53 #endif // SpeechInputClient _h73 #endif // SpeechInputClientImpl_h -
trunk/WebKit/chromium/src/WebViewImpl.cpp
r63905 r64042 259 259 , m_isAcceleratedCompositingActive(false) 260 260 #endif 261 #if ENABLE(INPUT_SPEECH) 262 , m_speechInputClient(client) 263 #endif 261 264 , m_gles2Context(0) 262 265 { … … 279 282 m_page->backForwardList()->setClient(&m_backForwardListClientImpl); 280 283 m_page->setGroupName(pageGroupName); 284 #if ENABLE(INPUT_SPEECH) 285 m_page->setSpeechInputClient(&m_speechInputClient); 286 #endif 281 287 282 288 m_inspectorSettingsMap.set(new SettingsMap); -
trunk/WebKit/chromium/src/WebViewImpl.h
r63905 r64042 48 48 #include "LayerRendererChromium.h" 49 49 #include "NotificationPresenterImpl.h" 50 #include "SpeechInputClientImpl.h" 50 51 #include <wtf/OwnPtr.h> 51 52 #include <wtf/RefCounted.h> … … 512 513 static const WebInputEvent* m_currentInputEvent; 513 514 515 #if ENABLE(INPUT_SPEECH) 516 SpeechInputClientImpl m_speechInputClient; 517 #endif 518 514 519 OwnPtr<WebGLES2Context> m_gles2Context; 515 520 };
Note: See TracChangeset
for help on using the changeset viewer.