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

Unified Diff: chrome/browser/speech/speech_input_bubble.h

Issue 3133034: Adds a speech input info bubble. (Closed)
Patch Set: Reorganised speech bubble into an interface and implementation. Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/speech/speech_input_bubble.h
diff --git a/chrome/browser/speech/speech_input_bubble.h b/chrome/browser/speech/speech_input_bubble.h
new file mode 100644
index 0000000000000000000000000000000000000000..4124e456a13541abd030a6d20a13a10320d335da
--- /dev/null
+++ b/chrome/browser/speech/speech_input_bubble.h
@@ -0,0 +1,61 @@
+// 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 invoking the |Close| method.
sky 2010/08/24 16:08:28 Update your comments.
+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.
+ virtual void InfoBubbleClosed() = 0;
sky 2010/08/24 16:08:28 You should mention this isn't invoked if the Speec
+
+ 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).
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
+ static SpeechInputBubble* Create(TabContents* tab_contents,
+ Delegate* delegate,
+ const gfx::Rect& element_rect);
+ // Factory method definition useful for tests.
+ 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.
+ Delegate*,
+ const gfx::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_

Powered by Google App Engine
This is Rietveld 408576698