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_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/browser/speech/speech_input_manager_delegate.h" | 9 #include "content/browser/speech/speech_input_manager_delegate.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/browser/browser_message_filter.h" | 11 #include "content/public/browser/browser_message_filter.h" |
12 #include "net/url_request/url_request_context_getter.h" | 12 #include "net/url_request/url_request_context_getter.h" |
13 | 13 |
| 14 class AudioManager; |
14 struct SpeechInputHostMsg_StartRecognition_Params; | 15 struct SpeechInputHostMsg_StartRecognition_Params; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class ResourceContext; | |
18 class SpeechInputPreferences; | 18 class SpeechInputPreferences; |
19 } | 19 } |
20 | 20 |
21 namespace speech_input { | 21 namespace speech_input { |
22 | 22 |
23 class SpeechInputManager; | 23 class SpeechInputManager; |
24 | 24 |
25 // SpeechInputDispatcherHost is a delegate for Speech API messages used by | 25 // SpeechInputDispatcherHost is a delegate for Speech API messages used by |
26 // RenderMessageFilter. | 26 // RenderMessageFilter. |
27 // It's the complement of SpeechInputDispatcher (owned by RenderView). | 27 // It's the complement of SpeechInputDispatcher (owned by RenderView). |
28 class SpeechInputDispatcherHost : public content::BrowserMessageFilter, | 28 class SpeechInputDispatcherHost : public content::BrowserMessageFilter, |
29 public content::SpeechInputManagerDelegate { | 29 public content::SpeechInputManagerDelegate { |
30 public: | 30 public: |
31 class SpeechInputCallers; | 31 class SpeechInputCallers; |
32 | 32 |
33 SpeechInputDispatcherHost( | 33 SpeechInputDispatcherHost( |
34 int render_process_id, | 34 int render_process_id, |
35 net::URLRequestContextGetter* context_getter, | 35 net::URLRequestContextGetter* context_getter, |
36 content::SpeechInputPreferences* speech_input_preferences, | 36 content::SpeechInputPreferences* speech_input_preferences, |
37 content::ResourceContext* resource_context); | 37 AudioManager* audio_manager); |
38 | 38 |
39 // SpeechInputManager::Delegate methods. | 39 // SpeechInputManager::Delegate methods. |
40 virtual void SetRecognitionResult( | 40 virtual void SetRecognitionResult( |
41 int caller_id, | 41 int caller_id, |
42 const content::SpeechInputResult& result) OVERRIDE; | 42 const content::SpeechInputResult& result) OVERRIDE; |
43 virtual void DidCompleteRecording(int caller_id) OVERRIDE; | 43 virtual void DidCompleteRecording(int caller_id) OVERRIDE; |
44 virtual void DidCompleteRecognition(int caller_id) OVERRIDE; | 44 virtual void DidCompleteRecognition(int caller_id) OVERRIDE; |
45 | 45 |
46 // content::BrowserMessageFilter implementation. | 46 // content::BrowserMessageFilter implementation. |
47 virtual bool OnMessageReceived(const IPC::Message& message, | 47 virtual bool OnMessageReceived(const IPC::Message& message, |
(...skipping 12 matching lines...) Expand all Loading... |
60 | 60 |
61 // Returns the speech input manager to forward events to, creating one if | 61 // Returns the speech input manager to forward events to, creating one if |
62 // needed. | 62 // needed. |
63 SpeechInputManager* manager(); | 63 SpeechInputManager* manager(); |
64 | 64 |
65 int render_process_id_; | 65 int render_process_id_; |
66 bool may_have_pending_requests_; // Set if we received any speech IPC request | 66 bool may_have_pending_requests_; // Set if we received any speech IPC request |
67 | 67 |
68 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 68 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
69 scoped_refptr<content::SpeechInputPreferences> speech_input_preferences_; | 69 scoped_refptr<content::SpeechInputPreferences> speech_input_preferences_; |
70 content::ResourceContext* resource_context_; | 70 AudioManager* audio_manager_; |
71 | 71 |
72 static SpeechInputManager* manager_; | 72 static SpeechInputManager* manager_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); | 74 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace speech_input | 77 } // namespace speech_input |
78 | 78 |
79 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 79 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
OLD | NEW |