Index: chrome/browser/ui/views/speech_recognition_bubble_views.cc |
diff --git a/chrome/browser/ui/views/speech_recognition_bubble_views.cc b/chrome/browser/ui/views/speech_recognition_bubble_views.cc |
index f7a122c5f24f4c1251d2bcceca1dac7bee0eb3c2..17370e75836a9af70c2d543ea7124817f7cbf0a3 100644 |
--- a/chrome/browser/ui/views/speech_recognition_bubble_views.cc |
+++ b/chrome/browser/ui/views/speech_recognition_bubble_views.cc |
@@ -312,7 +312,7 @@ void SpeechRecognitionBubbleView::Layout() { |
// Implementation of SpeechRecognitionBubble. |
class SpeechRecognitionBubbleImpl : public SpeechRecognitionBubbleBase { |
public: |
- SpeechRecognitionBubbleImpl(WebContents* web_contents, |
+ SpeechRecognitionBubbleImpl(int render_process_id, int render_view_id, |
Delegate* delegate, |
const gfx::Rect& element_rect); |
virtual ~SpeechRecognitionBubbleImpl(); |
@@ -334,9 +334,9 @@ class SpeechRecognitionBubbleImpl : public SpeechRecognitionBubbleBase { |
}; |
SpeechRecognitionBubbleImpl::SpeechRecognitionBubbleImpl( |
- WebContents* web_contents, Delegate* delegate, |
+ int render_process_id, int render_view_id, Delegate* delegate, |
const gfx::Rect& element_rect) |
- : SpeechRecognitionBubbleBase(web_contents), |
+ : SpeechRecognitionBubbleBase(render_process_id, render_view_id), |
delegate_(delegate), |
bubble_(NULL), |
element_rect_(element_rect) { |
@@ -350,11 +350,14 @@ SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() { |
} |
void SpeechRecognitionBubbleImpl::Show() { |
+ WebContents* web_contents = GetWebContents(); |
+ if (!web_contents) |
+ return; |
+ |
if (!bubble_) { |
views::View* icon = NULL; |
// Anchor to the location bar, in case |element_rect| is offscreen. |
- WebContents* web_contents = GetWebContents(); |
Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
if (browser) { |
BrowserView* browser_view = |
@@ -380,25 +383,26 @@ void SpeechRecognitionBubbleImpl::Show() { |
} |
void SpeechRecognitionBubbleImpl::Hide() { |
- if (bubble_) |
+ if (bubble_ && GetWebContents()) |
sky
2014/02/14 16:37:56
Why is Hide gated by a WebContents? Doesn't this m
Tommy Widenflycht
2014/02/17 09:46:34
Maybe that was a bit of overkill but the bubble is
|
bubble_->GetWidget()->Hide(); |
} |
void SpeechRecognitionBubbleImpl::UpdateLayout() { |
- if (bubble_) |
+ if (bubble_ && GetWebContents()) |
bubble_->UpdateLayout(display_mode(), message_text(), icon_image()); |
} |
void SpeechRecognitionBubbleImpl::UpdateImage() { |
- if (bubble_) |
+ if (bubble_ && GetWebContents()) |
bubble_->SetImage(icon_image()); |
} |
} // namespace |
SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( |
- WebContents* web_contents, |
+ int render_process_id, int render_view_id, |
sky
2014/02/14 16:37:56
nit: when you wrap, one param per line.
Tommy Widenflycht
2014/02/17 09:46:34
Done.
|
SpeechRecognitionBubble::Delegate* delegate, |
const gfx::Rect& element_rect) { |
- return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); |
+ return new SpeechRecognitionBubbleImpl(render_process_id, render_view_id, |
+ delegate, element_rect); |
} |