| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // SpeechInputManager::Delegate methods. | 26 // SpeechInputManager::Delegate methods. |
| 27 virtual void SetRecognitionResult(int caller_id, | 27 virtual void SetRecognitionResult(int caller_id, |
| 28 const SpeechInputResultArray& result); | 28 const SpeechInputResultArray& result); |
| 29 virtual void DidCompleteRecording(int caller_id); | 29 virtual void DidCompleteRecording(int caller_id); |
| 30 virtual void DidCompleteRecognition(int caller_id); | 30 virtual void DidCompleteRecognition(int caller_id); |
| 31 | 31 |
| 32 // BrowserMessageFilter implementation. | 32 // BrowserMessageFilter implementation. |
| 33 virtual bool OnMessageReceived(const IPC::Message& message, | 33 virtual bool OnMessageReceived(const IPC::Message& message, |
| 34 bool* message_was_ok); | 34 bool* message_was_ok); |
| 35 | 35 |
| 36 // Singleton accessor setter useful for tests. | 36 // Singleton manager setter useful for tests. |
| 37 static void set_manager_accessor(SpeechInputManager::AccessorMethod* method) { | 37 static void set_manager(SpeechInputManager* manager) { |
| 38 manager_accessor_ = method; | 38 manager_ = manager; |
| 39 } | 39 } |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 virtual ~SpeechInputDispatcherHost(); | 42 virtual ~SpeechInputDispatcherHost(); |
| 43 | 43 |
| 44 void OnStartRecognition( | 44 void OnStartRecognition( |
| 45 const SpeechInputHostMsg_StartRecognition_Params ¶ms); | 45 const SpeechInputHostMsg_StartRecognition_Params ¶ms); |
| 46 void OnCancelRecognition(int render_view_id, int request_id); | 46 void OnCancelRecognition(int render_view_id, int request_id); |
| 47 void OnStopRecording(int render_view_id, int request_id); | 47 void OnStopRecording(int render_view_id, int request_id); |
| 48 | 48 |
| 49 // Returns the speech input manager to forward events to, creating one if | 49 // Returns the speech input manager to forward events to, creating one if |
| 50 // needed. | 50 // needed. |
| 51 SpeechInputManager* manager(); | 51 SpeechInputManager* manager(); |
| 52 | 52 |
| 53 int render_process_id_; | 53 int render_process_id_; |
| 54 bool may_have_pending_requests_; // Set if we received any speech IPC request | 54 bool may_have_pending_requests_; // Set if we received any speech IPC request |
| 55 | 55 |
| 56 static SpeechInputManager::AccessorMethod* manager_accessor_; | 56 static SpeechInputManager* manager_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); | 58 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace speech_input | 61 } // namespace speech_input |
| 62 | 62 |
| 63 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 63 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
| OLD | NEW |