blob: 4ddab1bebf6621536886db5a0aca9ee614dd3702 (
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
|
// Copyright (c) 2010 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 CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_H_
#define CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_H_
#pragma once
#include "gfx/rect.h"
class TabContents;
// SpeechInputBubble displays a popup info bubble during speech recognition,
// points to the html element which requested speech input and shows recognition
// progress events. The popup is closed by the user clicking anywhere outside
// the popup window, or by the caller destroying this object.
class SpeechInputBubble {
public:
// Informs listeners of user actions in the bubble.
class Delegate {
public:
// Invoked when the user cancels speech recognition by clicking on the
// cancel button. The InfoBubble is still active and the caller should close
// it if necessary.
virtual void RecognitionCancelled() = 0;
// Invoked when the user clicks outside the InfoBubble causing it to close.
// The InfoBubble window is no longer visible on screen and the caller can
// free the InfoBubble instance. This callback is not issued if the bubble
// got closed because the object was destroyed by the caller.
virtual void InfoBubbleClosed() = 0;
protected:
virtual ~Delegate() {
}
};
// Factory method to create new instances.
// Creates and displays the bubble.
// |tab_contents| is the TabContents hosting the page.
// |element_rect| is the display bounds of the html element requesting speech
// input (in page coordinates).
static SpeechInputBubble* Create(TabContents* tab_contents,
Delegate* delegate,
const gfx::Rect& element_rect);
virtual ~SpeechInputBubble() {}
// Indicates to the user that recognition is in progress.
virtual void SetRecognizingMode() = 0;
};
// This typedef is to workaround the issue with certain versions of
// Visual Studio where it gets confused between multiple Delegate
// classes and gives a C2500 error. (I saw this error on the try bots -
// the workaround was not needed for my machine).
typedef SpeechInputBubble::Delegate SpeechInputBubbleDelegate;
#endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_H_
|