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

Unified Diff: chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc

Issue 148343008: Speech Recognition API: Safeguarding against page closes during startup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed WebContent versions 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
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..f08157e8911e0a334417a841e7979136133ef336 100644
--- a/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc
@@ -45,7 +45,7 @@ const GdkColor& kLabelTextColor = ui::kGdkBlack;
class SpeechRecognitionBubbleGtk : public SpeechRecognitionBubbleBase,
public BubbleDelegateGtk {
public:
- SpeechRecognitionBubbleGtk(WebContents* web_contents,
+ SpeechRecognitionBubbleGtk(int render_process_id, int render_view_id,
Delegate* delegate,
const gfx::Rect& element_rect);
virtual ~SpeechRecognitionBubbleGtk();
@@ -80,9 +80,9 @@ class SpeechRecognitionBubbleGtk : public SpeechRecognitionBubbleBase,
};
SpeechRecognitionBubbleGtk::SpeechRecognitionBubbleGtk(
- 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_process_id),
delegate_(delegate),
bubble_(NULL),
element_rect_(element_rect),
@@ -117,7 +117,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 +207,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) {
@@ -293,8 +293,9 @@ void SpeechRecognitionBubbleGtk::BubbleClosing(BubbleGtk* bubble,
} // namespace
SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble(
- WebContents* web_contents,
- Delegate* delegate,
+ int render_process_id, int render_view_id,
+ SpeechRecognitionBubble::Delegate* delegate,
const gfx::Rect& element_rect) {
- return new SpeechRecognitionBubbleGtk(web_contents, delegate, element_rect);
+ return new SpeechRecognitionBubbleGtk(render_process_id, render_view_id,
+ delegate, element_rect);
}

Powered by Google App Engine
This is Rietveld 408576698