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