| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
| 6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
| 12 #include "speech_input_manager.h" | 12 #include "speech_input_manager.h" |
| 13 | 13 |
| 14 namespace speech_input { | 14 namespace speech_input { |
| 15 | 15 |
| 16 // SpeechInputDispatcherHost is a delegate for Speech API messages used by | 16 // SpeechInputDispatcherHost is a delegate for Speech API messages used by |
| 17 // ResourceMessageFilter. | 17 // ResourceMessageFilter. |
| 18 // It's the complement of SpeechInputDispatcher (owned by RenderView). | 18 // It's the complement of SpeechInputDispatcher (owned by RenderView). |
| 19 class SpeechInputDispatcherHost | 19 class SpeechInputDispatcherHost |
| 20 : public base::RefCountedThreadSafe<SpeechInputDispatcherHost>, | 20 : public base::RefCountedThreadSafe<SpeechInputDispatcherHost>, |
| 21 public SpeechInputManager::Listener { | 21 public SpeechInputManager::Delegate { |
| 22 public: | 22 public: |
| 23 explicit SpeechInputDispatcherHost(int resource_message_filter_process_id); | 23 explicit SpeechInputDispatcherHost(int resource_message_filter_process_id); |
| 24 | 24 |
| 25 // SpeechInputManager::Listener methods. | 25 // SpeechInputManager::Delegate methods. |
| 26 void SetRecognitionResult(int render_view_id, const string16& result); | 26 void SetRecognitionResult(int render_view_id, const string16& result); |
| 27 void DidCompleteRecording(int render_view_id); | 27 void DidCompleteRecording(int render_view_id); |
| 28 void DidCompleteRecognition(int render_view_id); | 28 void DidCompleteRecognition(int render_view_id); |
| 29 | 29 |
| 30 // Called to possibly handle the incoming IPC message. Returns true if | 30 // Called to possibly handle the incoming IPC message. Returns true if |
| 31 // handled. | 31 // handled. |
| 32 bool OnMessageReceived(const IPC::Message& msg, bool* msg_was_ok); | 32 bool OnMessageReceived(const IPC::Message& msg, bool* msg_was_ok); |
| 33 | 33 |
| 34 // Factory setter useful for tests. | 34 // Factory setter useful for tests. |
| 35 static void set_manager_factory(SpeechInputManager::FactoryMethod* factory) { | 35 static void set_manager_factory(SpeechInputManager::FactoryMethod* factory) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 54 scoped_ptr<SpeechInputManager> manager_; | 54 scoped_ptr<SpeechInputManager> manager_; |
| 55 | 55 |
| 56 static SpeechInputManager::FactoryMethod* manager_factory_; | 56 static SpeechInputManager::FactoryMethod* manager_factory_; |
| 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 // CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 63 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
| OLD | NEW |