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

Unified Diff: chrome/browser/ui/views/speech_recognition_bubble_views.cc

Issue 148343008: Speech Recognition API: Safeguarding against page closes during startup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments Created 6 years, 10 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
« no previous file with comments | « chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..559fbcc9d76dbe07da6e7a33a74f81c8d0180820 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 =
@@ -385,20 +388,22 @@ void SpeechRecognitionBubbleImpl::Hide() {
}
void SpeechRecognitionBubbleImpl::UpdateLayout() {
- if (bubble_)
+ if (bubble_ && GetWebContents())
sky 2014/02/18 17:29:45 How come the other implementations have an || and
Tommy Widenflycht 2014/02/19 08:50:26 Because they do an early exit.
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,
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);
}
« no previous file with comments | « chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698