| 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 CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "content/public/common/speech_recognition_error.h" | 11 #include "content/public/common/speech_recognition_error.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class SpeechRecognitionEventListener; | 15 class SpeechRecognitionEventListener; |
| 16 struct SpeechRecognitionResult; | 16 struct SpeechRecognitionResult; |
| 17 | 17 |
| 18 // Allows embedders to display the current state of recognition, for getting the | 18 // Allows embedders to display the current state of recognition, for getting the |
| 19 // user's permission and for fetching optional request information. | 19 // user's permission and for fetching optional request information. |
| 20 class SpeechRecognitionManagerDelegate { | 20 class SpeechRecognitionManagerDelegate { |
| 21 public: | 21 public: |
| 22 virtual ~SpeechRecognitionManagerDelegate() {} | 22 virtual ~SpeechRecognitionManagerDelegate() {} |
| 23 | 23 |
| 24 // Get the optional diagnostic hardware information if available. | |
| 25 // This is called on the IO thread. | |
| 26 virtual void GetDiagnosticInformation(bool* can_report_metrics, | |
| 27 std::string* hardware_info) = 0; | |
| 28 | |
| 29 // Checks (asynchronously) if current setup allows speech recognition. | 24 // Checks (asynchronously) if current setup allows speech recognition. |
| 30 // This is called on the IO thread. | 25 // This is called on the IO thread. |
| 31 virtual void CheckRecognitionIsAllowed( | 26 virtual void CheckRecognitionIsAllowed( |
| 32 int session_id, | 27 int session_id, |
| 33 base::Callback<void(bool ask_user, bool is_allowed)> callback) = 0; | 28 base::Callback<void(bool ask_user, bool is_allowed)> callback) = 0; |
| 34 | 29 |
| 35 // Checks whether the delegate is interested (returning a non nullptr ptr) or | 30 // Checks whether the delegate is interested (returning a non nullptr ptr) or |
| 36 // not (returning nullptr) in receiving a copy of all sessions events. | 31 // not (returning nullptr) in receiving a copy of all sessions events. |
| 37 // This is called on the IO thread. | 32 // This is called on the IO thread. |
| 38 virtual SpeechRecognitionEventListener* GetEventListener() = 0; | 33 virtual SpeechRecognitionEventListener* GetEventListener() = 0; |
| 39 | 34 |
| 40 // Checks whether the speech recognition for the given renderer should filter | 35 // Checks whether the speech recognition for the given renderer should filter |
| 41 // profanities or not. | 36 // profanities or not. |
| 42 virtual bool FilterProfanities(int render_process_id) = 0; | 37 virtual bool FilterProfanities(int render_process_id) = 0; |
| 43 }; | 38 }; |
| 44 | 39 |
| 45 } // namespace content | 40 } // namespace content |
| 46 | 41 |
| 47 #endif // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ | 42 #endif // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
| OLD | NEW |