| 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" | |
| 10 #include "content/browser/speech/speech_input_manager.h" | 9 #include "content/browser/speech/speech_input_manager.h" |
| 11 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/browser_message_filter.h" |
| 12 #include "net/url_request/url_request_context_getter.h" | 12 #include "net/url_request/url_request_context_getter.h" |
| 13 | 13 |
| 14 struct SpeechInputHostMsg_StartRecognition_Params; | 14 struct SpeechInputHostMsg_StartRecognition_Params; |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class ResourceContext; | 17 class ResourceContext; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace speech_input { | 20 namespace speech_input { |
| 21 | 21 |
| 22 // SpeechInputDispatcherHost is a delegate for Speech API messages used by | 22 // SpeechInputDispatcherHost is a delegate for Speech API messages used by |
| 23 // RenderMessageFilter. | 23 // RenderMessageFilter. |
| 24 // It's the complement of SpeechInputDispatcher (owned by RenderView). | 24 // It's the complement of SpeechInputDispatcher (owned by RenderView). |
| 25 class SpeechInputDispatcherHost : public BrowserMessageFilter, | 25 class SpeechInputDispatcherHost : public content::BrowserMessageFilter, |
| 26 public SpeechInputManager::Delegate { | 26 public SpeechInputManager::Delegate { |
| 27 public: | 27 public: |
| 28 class SpeechInputCallers; | 28 class SpeechInputCallers; |
| 29 | 29 |
| 30 SpeechInputDispatcherHost( | 30 SpeechInputDispatcherHost( |
| 31 int render_process_id, | 31 int render_process_id, |
| 32 net::URLRequestContextGetter* context_getter, | 32 net::URLRequestContextGetter* context_getter, |
| 33 SpeechInputPreferences* speech_input_preferences, | 33 SpeechInputPreferences* speech_input_preferences, |
| 34 const content::ResourceContext* resource_context); | 34 const content::ResourceContext* resource_context); |
| 35 | 35 |
| 36 // SpeechInputManager::Delegate methods. | 36 // SpeechInputManager::Delegate methods. |
| 37 virtual void SetRecognitionResult( | 37 virtual void SetRecognitionResult( |
| 38 int caller_id, | 38 int caller_id, |
| 39 const content::SpeechInputResult& result) OVERRIDE; | 39 const content::SpeechInputResult& result) OVERRIDE; |
| 40 virtual void DidCompleteRecording(int caller_id) OVERRIDE; | 40 virtual void DidCompleteRecording(int caller_id) OVERRIDE; |
| 41 virtual void DidCompleteRecognition(int caller_id) OVERRIDE; | 41 virtual void DidCompleteRecognition(int caller_id) OVERRIDE; |
| 42 | 42 |
| 43 // BrowserMessageFilter implementation. | 43 // content::BrowserMessageFilter implementation. |
| 44 virtual bool OnMessageReceived(const IPC::Message& message, | 44 virtual bool OnMessageReceived(const IPC::Message& message, |
| 45 bool* message_was_ok) OVERRIDE; | 45 bool* message_was_ok) OVERRIDE; |
| 46 | 46 |
| 47 // Singleton manager setter useful for tests. | 47 // Singleton manager setter useful for tests. |
| 48 CONTENT_EXPORT static void set_manager(SpeechInputManager* manager); | 48 CONTENT_EXPORT static void set_manager(SpeechInputManager* manager); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 virtual ~SpeechInputDispatcherHost(); | 51 virtual ~SpeechInputDispatcherHost(); |
| 52 | 52 |
| 53 void OnStartRecognition( | 53 void OnStartRecognition( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 67 const content::ResourceContext* resource_context_; | 67 const content::ResourceContext* resource_context_; |
| 68 | 68 |
| 69 static SpeechInputManager* manager_; | 69 static SpeechInputManager* manager_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); | 71 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace speech_input | 74 } // namespace speech_input |
| 75 | 75 |
| 76 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 76 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
| OLD | NEW |