OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_H_ | |
6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_H_ | |
7 #pragma once | |
8 | |
9 #include "gfx/rect.h" | |
10 | |
11 class TabContents; | |
12 | |
13 // SpeechInputBubble displays a popup info bubble during speech recognition, | |
14 // points to the html element which requested speech input and shows recognition | |
15 // progress events. The popup is closed by the user clicking anywhere outside | |
16 // the popup window, or by the caller invoking the |Close| method. | |
sky
2010/08/24 16:08:28
Update your comments.
| |
17 class SpeechInputBubble { | |
18 public: | |
19 // Informs listeners of user actions in the bubble. | |
20 class Delegate { | |
21 public: | |
22 // Invoked when the user cancels speech recognition by clicking on the | |
23 // cancel button. The InfoBubble is still active and the caller should close | |
24 // it if necessary. | |
25 virtual void RecognitionCancelled() = 0; | |
26 | |
27 // Invoked when the user clicks outside the InfoBubble causing it to close. | |
28 // The InfoBubble window is no longer visible on screen and the caller can | |
29 // free the InfoBubble instance. | |
30 virtual void InfoBubbleClosed() = 0; | |
sky
2010/08/24 16:08:28
You should mention this isn't invoked if the Speec
| |
31 | |
32 protected: | |
33 virtual ~Delegate() { | |
34 } | |
35 }; | |
36 | |
37 // Factory method to create new instances. | |
38 // Creates and displays the bubble. | |
39 // |tab_contents| is the TabContents hosting the page. | |
40 // |element_rect| is the display bounds of the html element requesting speech | |
41 // input (in page coordinates). | |
sky
2010/08/24 16:08:28
Seems like this should be in screen coordinates ot
Satish
2010/08/24 16:22:04
The callers get this rect from webkit hence know a
| |
42 static SpeechInputBubble* Create(TabContents* tab_contents, | |
43 Delegate* delegate, | |
44 const gfx::Rect& element_rect); | |
45 // Factory method definition useful for tests. | |
46 typedef SpeechInputBubble* (FactoryMethod)(TabContents*, | |
sky
2010/08/24 16:08:28
Is this needed?
Satish
2010/08/24 16:22:04
Yes, for unit testing the code using this object i
sky
2010/08/24 16:49:57
Can you add it when you need it then.
| |
47 Delegate*, | |
48 const gfx::Rect&); | |
49 virtual ~SpeechInputBubble() {} | |
50 | |
51 // Indicates to the user that recognition is in progress. | |
52 virtual void SetRecognizingMode() = 0; | |
53 }; | |
54 | |
55 // This typedef is to workaround the issue with certain versions of | |
56 // Visual Studio where it gets confused between multiple Delegate | |
57 // classes and gives a C2500 error. (I saw this error on the try bots - | |
58 // the workaround was not needed for my machine). | |
59 typedef SpeechInputBubble::Delegate SpeechInputBubbleDelegate; | |
60 | |
61 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_H_ | |
OLD | NEW |