Title: [117043] trunk/Source/WebKit/chromium
Revision
117043
Author
h...@chromium.org
Date
2012-05-15 01:59:58 -0700 (Tue, 15 May 2012)

Log Message

Speech _javascript_ API: Introduce error code enum in Chromium plumbing
https://bugs.webkit.org/show_bug.cgi?id=86353

Reviewed by Adam Barth.

Introduce an enum for receiving error codes from the embedder.
This enum matches the enum in SpeechRecognitionError.

* public/WebSpeechRecognizerClient.h:
* src/AssertMatchingEnums.cpp:
* src/SpeechRecognitionClientProxy.cpp:
(WebKit::SpeechRecognitionClientProxy::didReceiveError):
* src/SpeechRecognitionClientProxy.h:
(SpeechRecognitionClientProxy):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (117042 => 117043)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-15 08:51:10 UTC (rev 117042)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-15 08:59:58 UTC (rev 117043)
@@ -1,3 +1,20 @@
+2012-05-15  Hans Wennborg  <h...@chromium.org>
+
+        Speech _javascript_ API: Introduce error code enum in Chromium plumbing
+        https://bugs.webkit.org/show_bug.cgi?id=86353
+
+        Reviewed by Adam Barth.
+
+        Introduce an enum for receiving error codes from the embedder.
+        This enum matches the enum in SpeechRecognitionError.
+
+        * public/WebSpeechRecognizerClient.h:
+        * src/AssertMatchingEnums.cpp:
+        * src/SpeechRecognitionClientProxy.cpp:
+        (WebKit::SpeechRecognitionClientProxy::didReceiveError):
+        * src/SpeechRecognitionClientProxy.h:
+        (SpeechRecognitionClientProxy):
+
 2012-05-14  Shinya Kawanaka  <shin...@chromium.org> 
 
         document.execCommand('Indent') in the direct child of ShadowRoot causes a crash.

Modified: trunk/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h (117042 => 117043)


--- trunk/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h	2012-05-15 08:51:10 UTC (rev 117042)
+++ trunk/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h	2012-05-15 08:59:58 UTC (rev 117043)
@@ -37,6 +37,18 @@
 // A client for reporting progress on speech recognition for a specific handle.
 class WebSpeechRecognizerClient {
 public:
+    enum ErrorCode {
+        OtherError = 0,
+        NoSpeechError = 1,
+        AbortedError = 2,
+        AudioCaptureError = 3,
+        NetworkError = 4,
+        NotAllowedError = 5,
+        ServiceNotAllowedError = 6,
+        BadGrammarError = 7,
+        LanguageNotSupportedError = 8
+    };
+
     // These methods correspond to the events described in the spec:
     // http://speech-_javascript_-api-spec.googlecode.com/git/speechapi.html#speechreco-events
 
@@ -74,8 +86,7 @@
     virtual void didDeleteResult(const WebSpeechRecognitionHandle&, unsigned resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) = 0;
 
     // To be called when a speech recognition error occurs.
-    // FIXME: Introduce an enum for the error code.
-    virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, unsigned short code) = 0;
+    virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, ErrorCode) = 0;
 
     // To be called when the recognizer has begun to listen to the audio with
     // the intention of recognizing.

Modified: trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp (117042 => 117043)


--- trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp	2012-05-15 08:51:10 UTC (rev 117042)
+++ trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp	2012-05-15 08:59:58 UTC (rev 117043)
@@ -63,6 +63,7 @@
 #include "PlatformCursor.h"
 #include "ReferrerPolicy.h"
 #include "Settings.h"
+#include "SpeechRecognitionError.h"
 #include "StorageInfo.h"
 #include "TextAffinity.h"
 #include "TextChecking.h"
@@ -92,6 +93,7 @@
 #include "WebPageVisibilityState.h"
 #include "WebScrollbar.h"
 #include "WebSettings.h"
+#include "WebSpeechRecognizerClient.h"
 #include "WebStorageQuotaError.h"
 #include "WebStorageQuotaType.h"
 #include "WebTextAffinity.h"
@@ -563,6 +565,18 @@
 COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateClosed, PeerConnection00::ICE_CLOSED);
 #endif
 
+#if ENABLE(SCRIPTED_SPEECH)
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::OtherError, SpeechRecognitionError::OTHER);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NoSpeechError, SpeechRecognitionError::NO_SPEECH);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::AbortedError, SpeechRecognitionError::ABORTED);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::AudioCaptureError, SpeechRecognitionError::AUDIO_CAPTURE);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NetworkError, SpeechRecognitionError::NETWORK);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NotAllowedError, SpeechRecognitionError::NOT_ALLOWED);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::ServiceNotAllowedError, SpeechRecognitionError::SERVICE_NOT_ALLOWED);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::BadGrammarError, SpeechRecognitionError::BAD_GRAMMAR);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::LanguageNotSupportedError, SpeechRecognitionError::LANGUAGE_NOT_SUPPORTED);
+#endif
+
 COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyAlways, ReferrerPolicyAlways);
 COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyDefault, ReferrerPolicyDefault);
 COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyNever, ReferrerPolicyNever);

Modified: trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp (117042 => 117043)


--- trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp	2012-05-15 08:51:10 UTC (rev 117042)
+++ trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp	2012-05-15 08:59:58 UTC (rev 117043)
@@ -136,7 +136,7 @@
     recognition->didDeleteResult(resultIndex, SpeechRecognitionResultList::create(resultHistoryVector));
 }
 
-void SpeechRecognitionClientProxy::didReceiveError(const WebSpeechRecognitionHandle& handle, const WebString& message, unsigned short code)
+void SpeechRecognitionClientProxy::didReceiveError(const WebSpeechRecognitionHandle& handle, const WebString& message, WebSpeechRecognizerClient::ErrorCode code)
 {
     RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
     SpeechRecognitionError::Code errorCode = static_cast<SpeechRecognitionError::Code>(code);

Modified: trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h (117042 => 117043)


--- trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h	2012-05-15 08:51:10 UTC (rev 117042)
+++ trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h	2012-05-15 08:59:58 UTC (rev 117043)
@@ -60,7 +60,7 @@
     virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE;
     virtual void didReceiveNoMatch(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&) OVERRIDE;
     virtual void didDeleteResult(const WebSpeechRecognitionHandle&, unsigned resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE;
-    virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, unsigned short code) OVERRIDE;
+    virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, WebSpeechRecognizerClient::ErrorCode) OVERRIDE;
     virtual void didStart(const WebSpeechRecognitionHandle&) OVERRIDE;
     virtual void didEnd(const WebSpeechRecognitionHandle&) OVERRIDE;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to