blob: dfe04c7d5717a6a4126b25f1d90a58938a7564d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
#define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
#pragma once
#include <string>
#include "content/public/common/speech_recognition_result.h"
namespace gfx {
class Rect;
}
namespace content {
struct SpeechRecognitionResult;
// Allows embedders to display the current state of recognition, for getting the
// user's permission and for fetching optional request information.
class SpeechRecognitionManagerDelegate {
public:
// Describes the microphone errors that are reported via ShowMicError.
enum MicError {
MIC_ERROR_NO_DEVICE_AVAILABLE = 0,
MIC_ERROR_DEVICE_IN_USE
};
virtual ~SpeechRecognitionManagerDelegate() {}
// Get the optional request information if available.
virtual void GetRequestInfo(bool* can_report_metrics,
std::string* request_info) = 0;
// Called when recognition has been requested from point |element_rect_| on
// the view port for the given caller. The embedder should call the
// StartRecognition or CancelRecognition methods on SpeechInutManager in
// response.
virtual void ShowRecognitionRequested(int caller_id,
int render_process_id,
int render_view_id,
const gfx::Rect& element_rect) = 0;
// Called when recognition is starting up.
virtual void ShowWarmUp(int caller_id) = 0;
// Called when recognition has started.
virtual void ShowRecognizing(int caller_id) = 0;
// Called when recording has started.
virtual void ShowRecording(int caller_id) = 0;
// Continuously updated with the current input volume.
virtual void ShowInputVolume(int caller_id,
float volume,
float noise_volume) = 0;
// Called when no microphone has been found.
virtual void ShowMicError(int caller_id, MicError error) = 0;
// Called when there has been a error with the recognition.
virtual void ShowRecognizerError(int caller_id,
SpeechRecognitionErrorCode error) = 0;
// Called when recognition has ended or has been canceled.
virtual void DoClose(int caller_id) = 0;
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
|