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_INPUT_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_SPEECH_INPUT_MANAGER_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "content/public/common/speech_input_result.h" | 11 #include "content/public/common/speech_recognition_result.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Rect; | 14 class Rect; |
15 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 struct SpeechInputResult; | 19 struct SpeechRecognitionResult; |
20 | 20 |
21 // Allows embedders to display the current state of recognition, for getting the | 21 // Allows embedders to display the current state of recognition, for getting the |
22 // user's permission and for fetching optional request information. | 22 // user's permission and for fetching optional request information. |
23 class SpeechInputManagerDelegate { | 23 class SpeechRecognitionManagerDelegate { |
24 public: | 24 public: |
25 // Describes the microphone errors that are reported via ShowMicError. | 25 // Describes the microphone errors that are reported via ShowMicError. |
26 enum MicError { | 26 enum MicError { |
27 MIC_ERROR_NO_DEVICE_AVAILABLE = 0, | 27 MIC_ERROR_NO_DEVICE_AVAILABLE = 0, |
28 MIC_ERROR_DEVICE_IN_USE | 28 MIC_ERROR_DEVICE_IN_USE |
29 }; | 29 }; |
30 | 30 |
31 virtual ~SpeechInputManagerDelegate() {} | 31 virtual ~SpeechRecognitionManagerDelegate() {} |
32 | 32 |
33 // Get the optional request information if available. | 33 // Get the optional request information if available. |
34 virtual void GetRequestInfo(bool* can_report_metrics, | 34 virtual void GetRequestInfo(bool* can_report_metrics, |
35 std::string* request_info) = 0; | 35 std::string* request_info) = 0; |
36 | 36 |
37 // Called when recognition has been requested from point |element_rect_| on | 37 // Called when recognition has been requested from point |element_rect_| on |
38 // the view port for the given caller. The embedder should call the | 38 // the view port for the given caller. The embedder should call the |
39 // StartRecognition or CancelRecognition methods on SpeechInutManager in | 39 // StartRecognition or CancelRecognition methods on SpeechInutManager in |
40 // response. | 40 // response. |
41 virtual void ShowRecognitionRequested(int caller_id, | 41 virtual void ShowRecognitionRequested(int caller_id, |
(...skipping 13 matching lines...) Expand all Loading... |
55 // Continuously updated with the current input volume. | 55 // Continuously updated with the current input volume. |
56 virtual void ShowInputVolume(int caller_id, | 56 virtual void ShowInputVolume(int caller_id, |
57 float volume, | 57 float volume, |
58 float noise_volume) = 0; | 58 float noise_volume) = 0; |
59 | 59 |
60 // Called when no microphone has been found. | 60 // Called when no microphone has been found. |
61 virtual void ShowMicError(int caller_id, MicError error) = 0; | 61 virtual void ShowMicError(int caller_id, MicError error) = 0; |
62 | 62 |
63 // Called when there has been a error with the recognition. | 63 // Called when there has been a error with the recognition. |
64 virtual void ShowRecognizerError(int caller_id, | 64 virtual void ShowRecognizerError(int caller_id, |
65 SpeechInputError error) = 0; | 65 SpeechRecognitionErrorCode error) = 0; |
66 | 66 |
67 // Called when recognition has ended or has been canceled. | 67 // Called when recognition has ended or has been canceled. |
68 virtual void DoClose(int caller_id) = 0; | 68 virtual void DoClose(int caller_id) = 0; |
69 }; | 69 }; |
70 | 70 |
71 } // namespace content | 71 } // namespace content |
72 | 72 |
73 #endif // CONTENT_PUBLIC_BROWSER_SPEECH_INPUT_MANAGER_DELEGATE_H_ | 73 #endif // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ |
OLD | NEW |