| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ | 6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/public/browser/speech_recognition_event_listener.h" | 10 #include "content/public/browser/speech_recognition_event_listener.h" |
| 11 #include "content/public/browser/speech_recognition_manager_delegate.h" | 11 #include "content/public/browser/speech_recognition_manager_delegate.h" |
| 12 #include "content/public/browser/speech_recognition_session_config.h" | 12 #include "content/public/browser/speech_recognition_session_config.h" |
| 13 | 13 |
| 14 namespace content { |
| 15 class WebContents; |
| 16 } // namespace content |
| 17 |
| 14 namespace speech { | 18 namespace speech { |
| 15 | 19 |
| 16 // This is Chrome's implementation of the SpeechRecognitionManagerDelegate | 20 // This is Chrome's implementation of the SpeechRecognitionManagerDelegate |
| 17 // interface. | 21 // interface. |
| 18 class ChromeSpeechRecognitionManagerDelegate | 22 class ChromeSpeechRecognitionManagerDelegate |
| 19 : public content::SpeechRecognitionManagerDelegate, | 23 : public content::SpeechRecognitionManagerDelegate, |
| 20 public content::SpeechRecognitionEventListener { | 24 public content::SpeechRecognitionEventListener { |
| 21 public: | 25 public: |
| 22 ChromeSpeechRecognitionManagerDelegate(); | 26 ChromeSpeechRecognitionManagerDelegate(); |
| 23 ~ChromeSpeechRecognitionManagerDelegate() override; | 27 ~ChromeSpeechRecognitionManagerDelegate() override; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 // SpeechRecognitionManagerDelegate methods. | 48 // SpeechRecognitionManagerDelegate methods. |
| 45 void GetDiagnosticInformation(bool* can_report_metrics, | 49 void GetDiagnosticInformation(bool* can_report_metrics, |
| 46 std::string* hardware_info) override; | 50 std::string* hardware_info) override; |
| 47 void CheckRecognitionIsAllowed( | 51 void CheckRecognitionIsAllowed( |
| 48 int session_id, | 52 int session_id, |
| 49 base::Callback<void(bool ask_user, bool is_allowed)> callback) override; | 53 base::Callback<void(bool ask_user, bool is_allowed)> callback) override; |
| 50 content::SpeechRecognitionEventListener* GetEventListener() override; | 54 content::SpeechRecognitionEventListener* GetEventListener() override; |
| 51 bool FilterProfanities(int render_process_id) override; | 55 bool FilterProfanities(int render_process_id) override; |
| 52 | 56 |
| 53 // Callback called by |tab_watcher_| on the IO thread to signal tab closure. | 57 // Callback called by |tab_watcher_| on the IO thread to signal tab closure. |
| 54 virtual void TabClosedCallback(int render_process_id, int render_view_id); | 58 virtual void TabClosedCallback(content::WebContents* web_contents); |
| 55 | 59 |
| 56 private: | 60 private: |
| 57 class OptionalRequestInfo; | 61 class OptionalRequestInfo; |
| 58 class TabWatcher; | 62 class TabWatcher; |
| 59 | 63 |
| 60 // Checks for VIEW_TYPE_TAB_CONTENTS host in the UI thread and notifies back | 64 // Checks for VIEW_TYPE_TAB_CONTENTS host in the UI thread and notifies back |
| 61 // the result in the IO thread through |callback|. | 65 // the result in the IO thread through |callback|. |
| 62 static void CheckRenderViewType( | 66 static void CheckRenderViewType( |
| 63 base::Callback<void(bool ask_user, bool is_allowed)> callback, | 67 base::Callback<void(bool ask_user, bool is_allowed)> callback, |
| 64 int render_process_id, | 68 const content::SpeechRecognitionSessionContext& context); |
| 65 int render_view_id); | |
| 66 | 69 |
| 67 scoped_refptr<OptionalRequestInfo> optional_request_info_; | 70 scoped_refptr<OptionalRequestInfo> optional_request_info_; |
| 68 scoped_refptr<TabWatcher> tab_watcher_; | 71 scoped_refptr<TabWatcher> tab_watcher_; |
| 69 | 72 |
| 70 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionManagerDelegate); | 73 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionManagerDelegate); |
| 71 }; | 74 }; |
| 72 | 75 |
| 73 } // namespace speech | 76 } // namespace speech |
| 74 | 77 |
| 75 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ | 78 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
| OLD | NEW |