Index: chrome/browser/speech/speech_recognition_bubble.h |
diff --git a/chrome/browser/speech/speech_recognition_bubble.h b/chrome/browser/speech/speech_recognition_bubble.h |
index 6ca5a73c7c3b3d12ef8bb72011eb674ad5e1ba3b..f351a11a04f525bc3223501c7de3b8fed3732ccb 100644 |
--- a/chrome/browser/speech/speech_recognition_bubble.h |
+++ b/chrome/browser/speech/speech_recognition_bubble.h |
@@ -55,19 +55,37 @@ class SpeechRecognitionBubble { |
} |
}; |
- // Factory method to create new instances. |
+ // Factory methods to create new instances. |
// Creates the bubble, call |Show| to display it on screen. |
+ |
// |web_contents| is the WebContents hosting the page. |
// |element_rect| is the display bounds of the html element requesting speech |
// recognition (in page coordinates). |
- static SpeechRecognitionBubble* Create(content::WebContents* web_contents, |
- Delegate* delegate, |
- const gfx::Rect& element_rect); |
+ // This should ONLY be called from for tests |
sky
2014/02/12 18:12:18
Isn't there a way to make the tests go through the
|
+ static SpeechRecognitionBubble* Create( |
+ content::WebContents*, |
+ Delegate* delegate, |
+ const gfx::Rect& element_rect); |
+ |
+ // |render_process_id| and |render_view_id| is used to extract the |
+ // correct WebContents. |
+ // |element_rect| is the display bounds of the html element requesting speech |
+ // recognition (in page coordinates). |
+ static SpeechRecognitionBubble* Create( |
+ int render_process_id, |
+ int render_view_id, |
+ Delegate* delegate, |
+ const gfx::Rect& element_rect); |
- // This is implemented by platform specific code to create the underlying |
+ // These are implemented by platform specific code to create the underlying |
// bubble window. Not to be called directly by users of this class. |
static SpeechRecognitionBubble* CreateNativeBubble( |
- content::WebContents* web_contents, |
+ content::WebContents*, |
+ Delegate* delegate, |
+ const gfx::Rect& element_rect); |
+ static SpeechRecognitionBubble* CreateNativeBubble( |
+ int render_process_id, |
+ int render_view_id, |
Delegate* delegate, |
const gfx::Rect& element_rect); |
@@ -135,7 +153,10 @@ class SpeechRecognitionBubbleBase : public SpeechRecognitionBubble { |
DISPLAY_MODE_MESSAGE |
}; |
- explicit SpeechRecognitionBubbleBase(content::WebContents* web_contents); |
+ // Only for tests |
+ explicit SpeechRecognitionBubbleBase(content::WebContents* test_web_contents); |
+ |
+ SpeechRecognitionBubbleBase(int render_process_id, int render_view_id); |
virtual ~SpeechRecognitionBubbleBase(); |
// SpeechRecognitionBubble methods |
@@ -160,6 +181,8 @@ class SpeechRecognitionBubbleBase : public SpeechRecognitionBubble { |
gfx::ImageSkia icon_image(); |
private: |
+ void Initialize(); |
+ |
void DoRecognizingAnimationStep(); |
void DoWarmingUpAnimationStep(); |
void SetImage(const gfx::ImageSkia& image); |
@@ -179,8 +202,12 @@ class SpeechRecognitionBubbleBase : public SpeechRecognitionBubble { |
scoped_ptr<SkBitmap> mic_image_; |
// A temporary buffer image used in creating the above mic image. |
scoped_ptr<SkBitmap> buffer_image_; |
+ |
// WebContents in which this this bubble gets displayed. |
- content::WebContents* web_contents_; |
+ content::WebContents* test_web_contents_; |
+ int render_process_id_; |
+ int render_view_id_; |
+ |
// The current image displayed in the bubble's icon widget. |
gfx::ImageSkia icon_image_; |
// The scale factor used for the web-contents. |