diff options
author | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-25 17:59:36 +0000 |
---|---|---|
committer | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-25 17:59:36 +0000 |
commit | e1f4dca7e7fa7cbbc41bf8f9bc90691d0e80dcbf (patch) | |
tree | a1082eca5de605f94190b41ff0dab0ebb7f5a2b5 /chrome/browser/speech | |
parent | 0d9667bedff2c8f7e218a32806b17b39c3dcb407 (diff) | |
download | chromium_src-e1f4dca7e7fa7cbbc41bf8f9bc90691d0e80dcbf.zip chromium_src-e1f4dca7e7fa7cbbc41bf8f9bc90691d0e80dcbf.tar.gz chromium_src-e1f4dca7e7fa7cbbc41bf8f9bc90691d0e80dcbf.tar.bz2 |
Fix a crash in speech input bubble.
Corrected logic in SpeechInputBubbleImpl::Show to find the right
ancestor when invoked in Chrome Frame.
BUG=71929
TEST=none
Review URL: http://codereview.chromium.org/6577033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76068 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/speech')
-rw-r--r-- | chrome/browser/speech/speech_input_bubble_views.cc | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc index 0fca89b..6abe5d5 100644 --- a/chrome/browser/speech/speech_input_bubble_views.cc +++ b/chrome/browser/speech/speech_input_bubble_views.cc @@ -281,19 +281,23 @@ void SpeechInputBubbleImpl::Show() { bubble_content_ = new ContentView(delegate_); UpdateLayout(); - views::Widget* parent = views::Widget::GetWidgetFromNativeWindow( - tab_contents()->view()->GetTopLevelNativeWindow()); - info_bubble_ = InfoBubble::Show(parent, - GetInfoBubbleTarget(element_rect_), - BubbleBorder::TOP_LEFT, bubble_content_, - this); - - // We don't want fade outs when closing because it makes speech recognition - // appear slower than it is. Also setting it to false allows |Close| to - // destroy the bubble immediately instead of waiting for the fade animation - // to end so the caller can manage this object's life cycle like a normal - // stack based or member variable object. - info_bubble_->set_fade_away_on_close(false); + views::Widget* tab = views::Widget::GetWidgetFromNativeView( + tab_contents()->view()->GetNativeView()); + views::Widget* parent = tab ? tab->GetRootWidget() : NULL; + + if (parent) { + info_bubble_ = InfoBubble::Show(parent, + GetInfoBubbleTarget(element_rect_), + BubbleBorder::TOP_LEFT, bubble_content_, + this); + + // We don't want fade outs when closing because it makes speech recognition + // appear slower than it is. Also setting it to false allows |Close| to + // destroy the bubble immediately instead of waiting for the fade animation + // to end so the caller can manage this object's life cycle like a normal + // stack based or member variable object. + info_bubble_->set_fade_away_on_close(false); + } } void SpeechInputBubbleImpl::Hide() { |