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

Side by Side Diff: content/renderer/speech_recognition_dispatcher.h

Issue 10273006: Introduced SpeechRecognitionDispatcher(Host) classes, handling dispatch of IPC messages for continu… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased (because of CL1.11 reverted and recommitted) Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/speech_recognition_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_
6 #define CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_
7 #pragma once
8
9 #include <map>
10
11 #include "base/basictypes.h"
12 #include "content/public/renderer/render_view_observer.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechRecognitionH andle.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechRecognizer.h "
16
17 class RenderViewImpl;
18
19 namespace content {
20 struct SpeechRecognitionError;
21 struct SpeechRecognitionResult;
22 }
23
24 // SpeechRecognitionDispatcher is a delegate for methods used by WebKit for
25 // scripted JS speech APIs. It's the complement of
26 // SpeechRecognitionDispatcherHost (owned by RenderViewHost).
27 class SpeechRecognitionDispatcher : public content::RenderViewObserver,
28 public WebKit::WebSpeechRecognizer {
29 public:
30 explicit SpeechRecognitionDispatcher(RenderViewImpl* render_view);
31 virtual ~SpeechRecognitionDispatcher();
32
33 private:
34 // RenderViewObserver implementation.
35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
36
37 // WebKit::WebSpeechRecognizer implementation.
38 virtual void start(const WebKit::WebSpeechRecognitionHandle&,
39 const WebKit::WebSpeechRecognitionParams&,
40 WebKit::WebSpeechRecognizerClient*) OVERRIDE;
41 virtual void stop(const WebKit::WebSpeechRecognitionHandle&,
42 WebKit::WebSpeechRecognizerClient*) OVERRIDE;
43 virtual void abort(const WebKit::WebSpeechRecognitionHandle&,
44 WebKit::WebSpeechRecognizerClient*) OVERRIDE;
45
46 void OnRecognitionStarted(int request_id);
47 void OnAudioStarted(int request_id);
48 void OnSoundStarted(int request_id);
49 void OnSoundEnded(int request_id);
50 void OnAudioEnded(int request_id);
51 void OnErrorOccurred(int request_id,
52 const content::SpeechRecognitionError& error);
53 void OnRecognitionEnded(int request_id);
54 void OnResultRetrieved(int request_id,
55 const content::SpeechRecognitionResult& result);
56
57 int GetIDForHandle(const WebKit::WebSpeechRecognitionHandle& handle);
58 const WebKit::WebSpeechRecognitionHandle& GetHandleFromID(int handle_id);
59
60 // The WebKit client class that we use to send events back to the JS world.
61 WebKit::WebSpeechRecognizerClient* recognizer_client_;
62
63 typedef std::map<int, WebKit::WebSpeechRecognitionHandle> HandleMap;
64 HandleMap handle_map_;
65 int next_id_;
66
67 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcher);
68 };
69
70 #endif // CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/speech_recognition_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698