| 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 "net/url_request/url_request_context_getter.h" | 12 #include "net/url_request/url_request_context_getter.h" |
| 12 | 13 |
| 13 struct SpeechInputHostMsg_StartRecognition_Params; | 14 struct SpeechInputHostMsg_StartRecognition_Params; |
| 14 | 15 |
| 15 namespace speech_input { | 16 namespace speech_input { |
| 16 | 17 |
| 17 // SpeechInputDispatcherHost is a delegate for Speech API messages used by | 18 // SpeechInputDispatcherHost is a delegate for Speech API messages used by |
| 18 // RenderMessageFilter. | 19 // RenderMessageFilter. |
| 19 // It's the complement of SpeechInputDispatcher (owned by RenderView). | 20 // It's the complement of SpeechInputDispatcher (owned by RenderView). |
| 20 class SpeechInputDispatcherHost : public BrowserMessageFilter, | 21 class SpeechInputDispatcherHost : public BrowserMessageFilter, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 31 virtual void SetRecognitionResult(int caller_id, | 32 virtual void SetRecognitionResult(int caller_id, |
| 32 const SpeechInputResultArray& result); | 33 const SpeechInputResultArray& result); |
| 33 virtual void DidCompleteRecording(int caller_id); | 34 virtual void DidCompleteRecording(int caller_id); |
| 34 virtual void DidCompleteRecognition(int caller_id); | 35 virtual void DidCompleteRecognition(int caller_id); |
| 35 | 36 |
| 36 // BrowserMessageFilter implementation. | 37 // BrowserMessageFilter implementation. |
| 37 virtual bool OnMessageReceived(const IPC::Message& message, | 38 virtual bool OnMessageReceived(const IPC::Message& message, |
| 38 bool* message_was_ok); | 39 bool* message_was_ok); |
| 39 | 40 |
| 40 // Singleton manager setter useful for tests. | 41 // Singleton manager setter useful for tests. |
| 41 static void set_manager(SpeechInputManager* manager) { | 42 CONTENT_EXPORT static void set_manager(SpeechInputManager* manager) { |
| 42 manager_ = manager; | 43 manager_ = manager; |
| 43 } | 44 } |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 virtual ~SpeechInputDispatcherHost(); | 47 virtual ~SpeechInputDispatcherHost(); |
| 47 | 48 |
| 48 void OnStartRecognition( | 49 void OnStartRecognition( |
| 49 const SpeechInputHostMsg_StartRecognition_Params ¶ms); | 50 const SpeechInputHostMsg_StartRecognition_Params ¶ms); |
| 50 void OnCancelRecognition(int render_view_id, int request_id); | 51 void OnCancelRecognition(int render_view_id, int request_id); |
| 51 void OnStopRecording(int render_view_id, int request_id); | 52 void OnStopRecording(int render_view_id, int request_id); |
| 52 | 53 |
| 53 // Returns the speech input manager to forward events to, creating one if | 54 // Returns the speech input manager to forward events to, creating one if |
| 54 // needed. | 55 // needed. |
| 55 SpeechInputManager* manager(); | 56 SpeechInputManager* manager(); |
| 56 | 57 |
| 57 int render_process_id_; | 58 int render_process_id_; |
| 58 bool may_have_pending_requests_; // Set if we received any speech IPC request | 59 bool may_have_pending_requests_; // Set if we received any speech IPC request |
| 59 | 60 |
| 60 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 61 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
| 61 scoped_refptr<SpeechInputPreferences> speech_input_preferences_; | 62 scoped_refptr<SpeechInputPreferences> speech_input_preferences_; |
| 62 | 63 |
| 63 static SpeechInputManager* manager_; | 64 static SpeechInputManager* manager_; |
| 64 | 65 |
| 65 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); | 66 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 } // namespace speech_input | 69 } // namespace speech_input |
| 69 | 70 |
| 70 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 71 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
| OLD | NEW |