Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9426)

Unified Diff: chrome/renderer/speech_input_dispatcher.h

Issue 3035035: Adds chromium side plumbing to pass speech input calls back and forth with WebKit. (Closed)
Patch Set: Addressed all comments. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/speech_input_dispatcher.h
diff --git a/chrome/renderer/speech_input_dispatcher.h b/chrome/renderer/speech_input_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..ccb69a918effb98c038c7b76531c512d3931740d
--- /dev/null
+++ b/chrome/renderer/speech_input_dispatcher.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 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 CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_
+#define CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_
+
+#include "base/basictypes.h"
+#include "ipc/ipc_message.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputController.h"
+
+class GURL;
+class RenderView;
+
+namespace WebKit {
+class WebSpeechInputListener;
+}
+
+// SpeechInputDispatcher is a delegate for speech input messages used by WebKit.
+// It's the complement of SpeechInputDispatcherHost (owned by RenderViewHost).
+class SpeechInputDispatcher : public WebKit::WebSpeechInputController {
+ public:
+ SpeechInputDispatcher(RenderView* render_view,
+ WebKit::WebSpeechInputListener* listener);
+
+ // Called to possibly handle the incoming IPC message. Returns true if
+ // handled. Called in render thread.
+ bool OnMessageReceived(const IPC::Message& msg);
+
+ // WebKit::WebSpeechInputController.
+ bool startRecognition();
+ void cancelRecognition();
+ void stopRecording();
+
+ private:
+ void OnSpeechRecognitionResult(const string16& result);
+ void OnSpeechRecordingComplete();
+ void OnSpeechRecognitionComplete();
+
+ RenderView* render_view_;
+ WebKit::WebSpeechInputListener* listener_;
+
+ DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcher);
+};
+
+#endif // CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698