diff options
author | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-02 22:05:41 +0000 |
---|---|---|
committer | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-02 22:05:41 +0000 |
commit | 25bed9245b56e3f22644bd27e223ca03c4ca467e (patch) | |
tree | 9c57395fb55c1587a163f911d511339e29fad5d8 /content/renderer | |
parent | c660de10b58b985273675396a214a3f4bf968a20 (diff) | |
download | chromium_src-25bed9245b56e3f22644bd27e223ca03c4ca467e.zip chromium_src-25bed9245b56e3f22644bd27e223ca03c4ca467e.tar.gz chromium_src-25bed9245b56e3f22644bd27e223ca03c4ca467e.tar.bz2 |
Start removing support for the experimental x-webkit-speech API
The API has been considered deprecated for some time, and was disabled
in https://src.chromium.org/viewvc/blink?revision=171373&view=revision
BUG=223198
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/260903010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/context_menu_params_builder.cc | 1 | ||||
-rw-r--r-- | content/renderer/input_tag_speech_dispatcher.cc | 147 | ||||
-rw-r--r-- | content/renderer/input_tag_speech_dispatcher.h | 56 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 12 | ||||
-rw-r--r-- | content/renderer/render_view_impl.h | 8 |
5 files changed, 0 insertions, 224 deletions
diff --git a/content/renderer/context_menu_params_builder.cc b/content/renderer/context_menu_params_builder.cc index d56c6ea..48355e8 100644 --- a/content/renderer/context_menu_params_builder.cc +++ b/content/renderer/context_menu_params_builder.cc @@ -32,7 +32,6 @@ ContextMenuParams ContextMenuParamsBuilder::Build( params.selection_text = data.selectedText; params.misspelled_word = data.misspelledWord; params.misspelling_hash = data.misspellingHash; - params.speech_input_enabled = data.isSpeechInputEnabled; params.spellcheck_enabled = data.isSpellCheckingEnabled; params.is_editable = data.isEditable; params.writing_direction_default = data.writingDirectionDefault; diff --git a/content/renderer/input_tag_speech_dispatcher.cc b/content/renderer/input_tag_speech_dispatcher.cc deleted file mode 100644 index 092eb2e..0000000 --- a/content/renderer/input_tag_speech_dispatcher.cc +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/renderer/input_tag_speech_dispatcher.h" - -#include "base/strings/utf_string_conversions.h" -#include "content/common/speech_recognition_messages.h" -#include "content/renderer/render_view_impl.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/web/WebDocument.h" -#include "third_party/WebKit/public/web/WebElement.h" -#include "third_party/WebKit/public/web/WebFrame.h" -#include "third_party/WebKit/public/web/WebInputElement.h" -#include "third_party/WebKit/public/web/WebNode.h" -#include "third_party/WebKit/public/web/WebSecurityOrigin.h" -#include "third_party/WebKit/public/web/WebSpeechInputListener.h" -#include "third_party/WebKit/public/web/WebView.h" - -using blink::WebDocument; -using blink::WebElement; -using blink::WebFrame; -using blink::WebInputElement; -using blink::WebNode; -using blink::WebView; - -namespace content { - -InputTagSpeechDispatcher::InputTagSpeechDispatcher( - RenderViewImpl* render_view, - blink::WebSpeechInputListener* listener) - : RenderViewObserver(render_view), - listener_(listener) { -} - -bool InputTagSpeechDispatcher::OnMessageReceived( - const IPC::Message& message) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(InputTagSpeechDispatcher, message) - IPC_MESSAGE_HANDLER(InputTagSpeechMsg_SetRecognitionResults, - OnSpeechRecognitionResults) - IPC_MESSAGE_HANDLER(InputTagSpeechMsg_RecordingComplete, - OnSpeechRecordingComplete) - IPC_MESSAGE_HANDLER(InputTagSpeechMsg_RecognitionComplete, - OnSpeechRecognitionComplete) - IPC_MESSAGE_HANDLER(InputTagSpeechMsg_ToggleSpeechInput, - OnSpeechRecognitionToggleSpeechInput) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; -} - -bool InputTagSpeechDispatcher::startRecognition( - int request_id, - const blink::WebRect& element_rect, - const blink::WebString& language, - const blink::WebString& grammar, - const blink::WebSecurityOrigin& origin) { - DVLOG(1) << "InputTagSpeechDispatcher::startRecognition enter"; - - InputTagSpeechHostMsg_StartRecognition_Params params; - params.grammar = base::UTF16ToUTF8(grammar); - params.language = base::UTF16ToUTF8(language); - params.origin_url = base::UTF16ToUTF8(origin.toString()); - params.render_view_id = routing_id(); - params.request_id = request_id; - params.element_rect = element_rect; - - Send(new InputTagSpeechHostMsg_StartRecognition(params)); - DVLOG(1) << "InputTagSpeechDispatcher::startRecognition exit"; - return true; -} - -void InputTagSpeechDispatcher::cancelRecognition(int request_id) { - DVLOG(1) << "InputTagSpeechDispatcher::cancelRecognition enter"; - Send(new InputTagSpeechHostMsg_CancelRecognition(routing_id(), request_id)); - DVLOG(1) << "InputTagSpeechDispatcher::cancelRecognition exit"; -} - -void InputTagSpeechDispatcher::stopRecording(int request_id) { - DVLOG(1) << "InputTagSpeechDispatcher::stopRecording enter"; - Send(new InputTagSpeechHostMsg_StopRecording(routing_id(), - request_id)); - DVLOG(1) << "InputTagSpeechDispatcher::stopRecording exit"; -} - -void InputTagSpeechDispatcher::OnSpeechRecognitionResults( - int request_id, - const SpeechRecognitionResults& results) { - DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecognitionResults enter"; - DCHECK_EQ(results.size(), 1U); - - const SpeechRecognitionResult& result = results[0]; - blink::WebSpeechInputResultArray webkit_result(result.hypotheses.size()); - for (size_t i = 0; i < result.hypotheses.size(); ++i) { - webkit_result[i].assign(result.hypotheses[i].utterance, - result.hypotheses[i].confidence); - } - listener_->setRecognitionResult(request_id, webkit_result); - - DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecognitionResults exit"; -} - -void InputTagSpeechDispatcher::OnSpeechRecordingComplete(int request_id) { - DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecordingComplete enter"; - listener_->didCompleteRecording(request_id); - DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecordingComplete exit"; -} - -void InputTagSpeechDispatcher::OnSpeechRecognitionComplete(int request_id) { - DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecognitionComplete enter"; - listener_->didCompleteRecognition(request_id); - DVLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecognitionComplete exit"; -} - -void InputTagSpeechDispatcher::OnSpeechRecognitionToggleSpeechInput() { - DVLOG(1) <<"InputTagSpeechDispatcher::OnSpeechRecognitionToggleSpeechInput"; - - WebView* web_view = render_view()->GetWebView(); - - WebFrame* frame = web_view->mainFrame(); - if (!frame) - return; - - WebDocument document = frame->document(); - if (document.isNull()) - return; - - blink::WebElement element = document.focusedElement(); - if (element.isNull()) - return; - - blink::WebInputElement* input_element = blink::toWebInputElement(&element); - if (!input_element) - return; - if (!input_element->isSpeechInputEnabled()) - return; - - if (input_element->getSpeechInputState() == WebInputElement::Idle) { - input_element->startSpeechInput(); - } else { - input_element->stopSpeechInput(); - } -} - -} // namespace content diff --git a/content/renderer/input_tag_speech_dispatcher.h b/content/renderer/input_tag_speech_dispatcher.h deleted file mode 100644 index ee9dda9..0000000 --- a/content/renderer/input_tag_speech_dispatcher.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_RENDERER_INPUT_TAG_SPEECH_DISPATCHER_H_ -#define CONTENT_RENDERER_INPUT_TAG_SPEECH_DISPATCHER_H_ - -#include "base/basictypes.h" -#include "content/public/common/speech_recognition_result.h" -#include "content/public/renderer/render_view_observer.h" -#include "third_party/WebKit/public/web/WebSpeechInputController.h" - -namespace blink { -class WebSpeechInputListener; -} - -namespace content { -class RenderViewImpl; -struct SpeechRecognitionResult; - -// InputTagSpeechDispatcher is a delegate for messages used by WebKit. It's -// the complement of InputTagSpeechDispatcherHost (owned by RenderViewHost). -class InputTagSpeechDispatcher : public RenderViewObserver, - public blink::WebSpeechInputController { - public: - InputTagSpeechDispatcher(RenderViewImpl* render_view, - blink::WebSpeechInputListener* listener); - - private: - // RenderView::Observer implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - - // blink::WebSpeechInputController. - virtual bool startRecognition(int request_id, - const blink::WebRect& element_rect, - const blink::WebString& language, - const blink::WebString& grammar, - const blink::WebSecurityOrigin& origin); - - virtual void cancelRecognition(int request_id); - virtual void stopRecording(int request_id); - - void OnSpeechRecognitionResults( - int request_id, const SpeechRecognitionResults& results); - void OnSpeechRecordingComplete(int request_id); - void OnSpeechRecognitionComplete(int request_id); - void OnSpeechRecognitionToggleSpeechInput(); - - blink::WebSpeechInputListener* listener_; - - DISALLOW_COPY_AND_ASSIGN(InputTagSpeechDispatcher); -}; - -} // namespace content - -#endif // CONTENT_RENDERER_INPUT_TAG_SPEECH_DISPATCHER_H_ diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 7290a4b..3305a7c 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -85,7 +85,6 @@ #include "content/renderer/idle_user_detector.h" #include "content/renderer/ime_event_guard.h" #include "content/renderer/input/input_handler_manager.h" -#include "content/renderer/input_tag_speech_dispatcher.h" #include "content/renderer/internal_document_state_data.h" #include "content/renderer/load_progress_tracker.h" #include "content/renderer/media/audio_device_factory.h" @@ -671,7 +670,6 @@ RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) has_scrolled_focused_editable_node_into_rect_(false), push_messaging_dispatcher_(NULL), geolocation_dispatcher_(NULL), - input_tag_speech_dispatcher_(NULL), speech_recognition_dispatcher_(NULL), media_stream_dispatcher_(NULL), browser_plugin_manager_(NULL), @@ -3862,16 +3860,6 @@ blink::WebGeolocationClient* RenderViewImpl::geolocationClient() { return geolocation_dispatcher_; } -blink::WebSpeechInputController* RenderViewImpl::speechInputController( - blink::WebSpeechInputListener* listener) { -#if defined(ENABLE_INPUT_SPEECH) - if (!input_tag_speech_dispatcher_) - input_tag_speech_dispatcher_ = - new InputTagSpeechDispatcher(this, listener); -#endif - return input_tag_speech_dispatcher_; -} - blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { if (!speech_recognition_dispatcher_) speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 2349389..374dc34 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -106,8 +106,6 @@ class WebMouseEvent; class WebPeerConnectionHandler; class WebPeerConnectionHandlerClient; class WebSocketStreamHandle; -class WebSpeechInputController; -class WebSpeechInputListener; class WebSpeechRecognizer; class WebStorageNamespace; class WebTouchEvent; @@ -142,7 +140,6 @@ class GeolocationDispatcher; class HistoryController; class HistoryEntry; class ImageResourceFetcher; -class InputTagSpeechDispatcher; class LoadProgressTracker; class MidiDispatcher; class MediaStreamClient; @@ -467,8 +464,6 @@ class CONTENT_EXPORT RenderViewImpl virtual void didUpdateInspectorSetting(const blink::WebString& key, const blink::WebString& value); virtual blink::WebGeolocationClient* geolocationClient(); - virtual blink::WebSpeechInputController* speechInputController( - blink::WebSpeechInputListener* listener); virtual blink::WebSpeechRecognizer* speechRecognizer(); virtual void zoomLimitsChanged(double minimum_level, double maximum_level); virtual void zoomLevelChanged(); @@ -1138,9 +1133,6 @@ class CONTENT_EXPORT RenderViewImpl // The geolocation dispatcher attached to this view, lazily initialized. GeolocationDispatcher* geolocation_dispatcher_; - // The speech dispatcher attached to this view, lazily initialized. - InputTagSpeechDispatcher* input_tag_speech_dispatcher_; - // The speech recognition dispatcher attached to this view, lazily // initialized. SpeechRecognitionDispatcher* speech_recognition_dispatcher_; |