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 21 matching lines...) Expand all Loading... |
32 virtual void SetRecognitionResult(int caller_id, | 32 virtual void SetRecognitionResult(int caller_id, |
33 const SpeechInputResultArray& result); | 33 const SpeechInputResultArray& result); |
34 virtual void DidCompleteRecording(int caller_id); | 34 virtual void DidCompleteRecording(int caller_id); |
35 virtual void DidCompleteRecognition(int caller_id); | 35 virtual void DidCompleteRecognition(int caller_id); |
36 | 36 |
37 // BrowserMessageFilter implementation. | 37 // BrowserMessageFilter implementation. |
38 virtual bool OnMessageReceived(const IPC::Message& message, | 38 virtual bool OnMessageReceived(const IPC::Message& message, |
39 bool* message_was_ok); | 39 bool* message_was_ok); |
40 | 40 |
41 // Singleton manager setter useful for tests. | 41 // Singleton manager setter useful for tests. |
42 CONTENT_EXPORT static void set_manager(SpeechInputManager* manager) { | 42 CONTENT_EXPORT static void set_manager(SpeechInputManager* manager); |
43 manager_ = manager; | |
44 } | |
45 | 43 |
46 private: | 44 private: |
47 virtual ~SpeechInputDispatcherHost(); | 45 virtual ~SpeechInputDispatcherHost(); |
48 | 46 |
49 void OnStartRecognition( | 47 void OnStartRecognition( |
50 const SpeechInputHostMsg_StartRecognition_Params ¶ms); | 48 const SpeechInputHostMsg_StartRecognition_Params ¶ms); |
51 void OnCancelRecognition(int render_view_id, int request_id); | 49 void OnCancelRecognition(int render_view_id, int request_id); |
52 void OnStopRecording(int render_view_id, int request_id); | 50 void OnStopRecording(int render_view_id, int request_id); |
53 | 51 |
54 // Returns the speech input manager to forward events to, creating one if | 52 // Returns the speech input manager to forward events to, creating one if |
55 // needed. | 53 // needed. |
56 SpeechInputManager* manager(); | 54 SpeechInputManager* manager(); |
57 | 55 |
58 int render_process_id_; | 56 int render_process_id_; |
59 bool may_have_pending_requests_; // Set if we received any speech IPC request | 57 bool may_have_pending_requests_; // Set if we received any speech IPC request |
60 | 58 |
61 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 59 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
62 scoped_refptr<SpeechInputPreferences> speech_input_preferences_; | 60 scoped_refptr<SpeechInputPreferences> speech_input_preferences_; |
63 | 61 |
64 static SpeechInputManager* manager_; | 62 static SpeechInputManager* manager_; |
65 | 63 |
66 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); | 64 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); |
67 }; | 65 }; |
68 | 66 |
69 } // namespace speech_input | 67 } // namespace speech_input |
70 | 68 |
71 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 69 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
OLD | NEW |