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