Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Side by Side Diff: content/public/browser/speech_recognition_manager_delegate.h

Issue 9972011: Speech refactoring: Reimplemented SpeechRecognitionManagerImpl as a FSM. (CL1.7) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased from master. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "content/public/common/speech_recognition_error.h" 11 #include "content/public/common/speech_recognition_error.h"
12 12
13 namespace gfx {
14 class Rect;
15 }
16
17 namespace content { 13 namespace content {
18 14
19 struct SpeechRecognitionResult; 15 struct SpeechRecognitionResult;
20 16
21 // Allows embedders to display the current state of recognition, for getting the 17 // Allows embedders to display the current state of recognition, for getting the
22 // user's permission and for fetching optional request information. 18 // user's permission and for fetching optional request information.
23 class SpeechRecognitionManagerDelegate { 19 class SpeechRecognitionManagerDelegate {
24 public: 20 public:
25 // Describes the microphone errors that are reported via ShowMicError.
26 enum MicError {
27 MIC_ERROR_NO_DEVICE_AVAILABLE = 0,
28 MIC_ERROR_DEVICE_IN_USE
29 };
30
31 virtual ~SpeechRecognitionManagerDelegate() {} 21 virtual ~SpeechRecognitionManagerDelegate() {}
32 22
33 // Get the optional request information if available. 23 // Get the optional diagnostic hardware information if available.
34 virtual void GetRequestInfo(bool* can_report_metrics, 24 virtual void GetDiagnosticInformation(bool* can_report_metrics,
35 std::string* request_info) = 0; 25 std::string* hardware_info) = 0;
36 26
37 // Called when recognition has been requested from point |element_rect_| on 27 // Called when recognition has been requested. The source point of the view
38 // the view port for the given caller. The embedder should call the 28 // port can be retrieved looking-up the session context.
39 // StartRecognition or CancelRecognition methods on SpeechInutManager in 29 // The embedder should call the StartRecognition or CancelRecognition methods
40 // response. 30 // on SpeechInutManager in response. TODO(primiano) ?!?.
Satish 2012/04/19 13:03:19 is this TODO required? If so, should be at the sta
Primiano Tucci (use gerrit) 2012/04/20 16:06:43 Done.
41 virtual void ShowRecognitionRequested(int session_id, 31 virtual void ShowRecognitionRequested(int session_id) = 0;
42 int render_process_id, 32
43 int render_view_id, 33 // Check if current UI set-up allow speech recognition.
Satish 2012/04/19 13:03:19 allow -> allows
Primiano Tucci (use gerrit) 2012/04/20 16:06:43 Done.
44 const gfx::Rect& element_rect) = 0; 34 virtual bool CheckRecognitionIsAllowed(int session_id) = 0;
Satish 2012/04/19 13:03:19 could rename as 'IsRecognitionAllowed'
Primiano Tucci (use gerrit) 2012/04/20 16:06:43 Done.
45 35
46 // Called when recognition is starting up. 36 // Called when recognition is starting up.
47 virtual void ShowWarmUp(int session_id) = 0; 37 virtual void ShowWarmUp(int session_id) = 0;
48 38
49 // Called when recognition has started. 39 // Called when recognition has started.
50 virtual void ShowRecognizing(int session_id) = 0; 40 virtual void ShowRecognizing(int session_id) = 0;
51 41
52 // Called when recording has started. 42 // Called when recording has started.
53 virtual void ShowRecording(int session_id) = 0; 43 virtual void ShowRecording(int session_id) = 0;
54 44
55 // Continuously updated with the current input volume. 45 // Continuously updated with the current input volume.
56 virtual void ShowInputVolume(int session_id, 46 virtual void ShowInputVolume(int session_id,
57 float volume, 47 float volume,
58 float noise_volume) = 0; 48 float noise_volume) = 0;
59 49
60 // Called when no microphone has been found.
61 virtual void ShowMicError(int session_id, MicError error) = 0;
62
63 // Called when there has been a error with the recognition. 50 // Called when there has been a error with the recognition.
64 virtual void ShowRecognizerError(int session_id, 51 virtual void ShowError(int session_id,
65 SpeechRecognitionErrorCode error) = 0; 52 const SpeechRecognitionError& error) = 0;
66 53
67 // Called when recognition has ended or has been canceled. 54 // Called when recognition has ended or has been canceled.
68 virtual void DoClose(int session_id) = 0; 55 virtual void DoClose(int session_id) = 0;
69 }; 56 };
70 57
71 } // namespace content 58 } // namespace content
72 59
73 #endif // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_ 60 #endif // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698