| Index: chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc
|
| diff --git a/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc b/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc
|
| index 58574c3101e621c2dbc4faa3d5ec9f365fc15c20..73e68f8d616240f34876aef19a0747db22f181d5 100644
|
| --- a/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc
|
| +++ b/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc
|
| @@ -48,6 +48,9 @@ class SpeechRecognitionBubbleGtk : public SpeechRecognitionBubbleBase,
|
| SpeechRecognitionBubbleGtk(WebContents* web_contents,
|
| Delegate* delegate,
|
| const gfx::Rect& element_rect);
|
| + SpeechRecognitionBubbleGtk(int render_process_id, int render_view_id,
|
| + Delegate* delegate,
|
| + const gfx::Rect& element_rect);
|
| virtual ~SpeechRecognitionBubbleGtk();
|
|
|
| private:
|
| @@ -95,6 +98,22 @@ SpeechRecognitionBubbleGtk::SpeechRecognitionBubbleGtk(
|
| mic_settings_(NULL) {
|
| }
|
|
|
| +SpeechRecognitionBubbleGtk::SpeechRecognitionBubbleGtk(
|
| + int render_process_id, int render_view_id, Delegate* delegate,
|
| + const gfx::Rect& element_rect)
|
| + : SpeechRecognitionBubbleBase(render_process_id, render_process_id),
|
| + delegate_(delegate),
|
| + bubble_(NULL),
|
| + element_rect_(element_rect),
|
| + did_invoke_close_(false),
|
| + label_(NULL),
|
| + cancel_button_(NULL),
|
| + try_again_button_(NULL),
|
| + icon_(NULL),
|
| + icon_container_(NULL),
|
| + mic_settings_(NULL) {
|
| +}
|
| +
|
| SpeechRecognitionBubbleGtk::~SpeechRecognitionBubbleGtk() {
|
| // The |Close| call below invokes our |BubbleClosing| method. Since we were
|
| // destroyed by the caller we don't need to call them back, hence set this
|
| @@ -117,7 +136,7 @@ void SpeechRecognitionBubbleGtk::OnMicSettingsClicked(GtkWidget* widget) {
|
| }
|
|
|
| void SpeechRecognitionBubbleGtk::Show() {
|
| - if (bubble_)
|
| + if (bubble_ || !GetWebContents())
|
| return; // Nothing further to do since the bubble is already visible.
|
|
|
| // We use a vbox to arrange the controls (label, image, button bar) vertically
|
| @@ -207,12 +226,12 @@ void SpeechRecognitionBubbleGtk::Show() {
|
| }
|
|
|
| void SpeechRecognitionBubbleGtk::Hide() {
|
| - if (bubble_)
|
| + if (bubble_ && GetWebContents())
|
| bubble_->Close();
|
| }
|
|
|
| void SpeechRecognitionBubbleGtk::UpdateLayout() {
|
| - if (!bubble_)
|
| + if (!bubble_ || !GetWebContents())
|
| return;
|
|
|
| if (display_mode() == DISPLAY_MODE_MESSAGE) {
|
| @@ -298,3 +317,12 @@ SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble(
|
| const gfx::Rect& element_rect) {
|
| return new SpeechRecognitionBubbleGtk(web_contents, delegate, element_rect);
|
| }
|
| +
|
| +SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble(
|
| + int render_process_id, int render_view_id,
|
| + SpeechRecognitionBubble::Delegate* delegate,
|
| + const gfx::Rect& element_rect) {
|
| + return new SpeechRecognitionBubbleGtk(render_process_id, render_view_id,
|
| + delegate, element_rect);
|
| +}
|
| +
|
|
|