OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 public blink::WebSpeechRecognizer { | 26 public blink::WebSpeechRecognizer { |
27 public: | 27 public: |
28 explicit SpeechRecognitionDispatcher(RenderViewImpl* render_view); | 28 explicit SpeechRecognitionDispatcher(RenderViewImpl* render_view); |
29 virtual ~SpeechRecognitionDispatcher(); | 29 virtual ~SpeechRecognitionDispatcher(); |
30 | 30 |
31 // Aborts all speech recognitions. | 31 // Aborts all speech recognitions. |
32 void AbortAllRecognitions(); | 32 void AbortAllRecognitions(); |
33 | 33 |
34 private: | 34 private: |
35 // RenderViewObserver implementation. | 35 // RenderViewObserver implementation. |
36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 36 virtual bool OnMessageReceived(const IPC::Message& message) override; |
37 | 37 |
38 // blink::WebSpeechRecognizer implementation. | 38 // blink::WebSpeechRecognizer implementation. |
39 virtual void start(const blink::WebSpeechRecognitionHandle&, | 39 virtual void start(const blink::WebSpeechRecognitionHandle&, |
40 const blink::WebSpeechRecognitionParams&, | 40 const blink::WebSpeechRecognitionParams&, |
41 blink::WebSpeechRecognizerClient*) OVERRIDE; | 41 blink::WebSpeechRecognizerClient*) override; |
42 virtual void stop(const blink::WebSpeechRecognitionHandle&, | 42 virtual void stop(const blink::WebSpeechRecognitionHandle&, |
43 blink::WebSpeechRecognizerClient*) OVERRIDE; | 43 blink::WebSpeechRecognizerClient*) override; |
44 virtual void abort(const blink::WebSpeechRecognitionHandle&, | 44 virtual void abort(const blink::WebSpeechRecognitionHandle&, |
45 blink::WebSpeechRecognizerClient*) OVERRIDE; | 45 blink::WebSpeechRecognizerClient*) override; |
46 | 46 |
47 void OnRecognitionStarted(int request_id); | 47 void OnRecognitionStarted(int request_id); |
48 void OnAudioStarted(int request_id); | 48 void OnAudioStarted(int request_id); |
49 void OnSoundStarted(int request_id); | 49 void OnSoundStarted(int request_id); |
50 void OnSoundEnded(int request_id); | 50 void OnSoundEnded(int request_id); |
51 void OnAudioEnded(int request_id); | 51 void OnAudioEnded(int request_id); |
52 void OnErrorOccurred(int request_id, const SpeechRecognitionError& error); | 52 void OnErrorOccurred(int request_id, const SpeechRecognitionError& error); |
53 void OnRecognitionEnded(int request_id); | 53 void OnRecognitionEnded(int request_id); |
54 void OnResultsRetrieved(int request_id, | 54 void OnResultsRetrieved(int request_id, |
55 const SpeechRecognitionResults& result); | 55 const SpeechRecognitionResults& result); |
56 | 56 |
57 int GetOrCreateIDForHandle(const blink::WebSpeechRecognitionHandle& handle); | 57 int GetOrCreateIDForHandle(const blink::WebSpeechRecognitionHandle& handle); |
58 bool HandleExists(const blink::WebSpeechRecognitionHandle& handle); | 58 bool HandleExists(const blink::WebSpeechRecognitionHandle& handle); |
59 const blink::WebSpeechRecognitionHandle& GetHandleFromID(int handle_id); | 59 const blink::WebSpeechRecognitionHandle& GetHandleFromID(int handle_id); |
60 | 60 |
61 // The WebKit client class that we use to send events back to the JS world. | 61 // The WebKit client class that we use to send events back to the JS world. |
62 blink::WebSpeechRecognizerClient* recognizer_client_; | 62 blink::WebSpeechRecognizerClient* recognizer_client_; |
63 | 63 |
64 typedef std::map<int, blink::WebSpeechRecognitionHandle> HandleMap; | 64 typedef std::map<int, blink::WebSpeechRecognitionHandle> HandleMap; |
65 HandleMap handle_map_; | 65 HandleMap handle_map_; |
66 int next_id_; | 66 int next_id_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcher); | 68 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcher); |
69 }; | 69 }; |
70 | 70 |
71 } // namespace content | 71 } // namespace content |
72 | 72 |
73 #endif // CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ | 73 #endif // CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ |
OLD | NEW |