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 "chrome/browser/speech/speech_input_manager.h" | 11 #include "chrome/browser/speech/speech_input_manager.h" |
12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.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::Delegate { | 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::Delegate methods. | 25 // SpeechInputManager::Delegate methods. |
26 void SetRecognitionResult(int caller_id, const string16& result); | 26 void SetRecognitionResult(int caller_id, |
| 27 const SpeechInputResultArray& result); |
27 void DidCompleteRecording(int caller_id); | 28 void DidCompleteRecording(int caller_id); |
28 void DidCompleteRecognition(int caller_id); | 29 void DidCompleteRecognition(int caller_id); |
29 | 30 |
30 // Called to possibly handle the incoming IPC message. Returns true if | 31 // Called to possibly handle the incoming IPC message. Returns true if |
31 // handled. | 32 // handled. |
32 bool OnMessageReceived(const IPC::Message& msg, bool* msg_was_ok); | 33 bool OnMessageReceived(const IPC::Message& msg, bool* msg_was_ok); |
33 | 34 |
34 // Singleton accessor setter useful for tests. | 35 // Singleton accessor setter useful for tests. |
35 static void set_manager_accessor(SpeechInputManager::AccessorMethod* method) { | 36 static void set_manager_accessor(SpeechInputManager::AccessorMethod* method) { |
36 manager_accessor_ = method; | 37 manager_accessor_ = method; |
(...skipping 19 matching lines...) Expand all Loading... |
56 SpeechInputCallers* callers_; // weak reference to a singleton. | 57 SpeechInputCallers* callers_; // weak reference to a singleton. |
57 | 58 |
58 static SpeechInputManager::AccessorMethod* manager_accessor_; | 59 static SpeechInputManager::AccessorMethod* manager_accessor_; |
59 | 60 |
60 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); | 61 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); |
61 }; | 62 }; |
62 | 63 |
63 } // namespace speech_input | 64 } // namespace speech_input |
64 | 65 |
65 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 66 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
OLD | NEW |