Chromium Code Reviews| Index: chrome/browser/speech/speech_recognition_bubble.cc |
| diff --git a/chrome/browser/speech/speech_recognition_bubble.cc b/chrome/browser/speech/speech_recognition_bubble.cc |
| index fa31bb322848043705e75c4cbef3ec230403fd46..b7ca6cad9ba3da5a8a091d0c37b4b8382c7ed48a 100644 |
| --- a/chrome/browser/speech/speech_recognition_bubble.cc |
| +++ b/chrome/browser/speech/speech_recognition_bubble.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/bind.h" |
| #include "base/lazy_instance.h" |
| #include "base/message_loop/message_loop.h" |
| +#include "chrome/browser/tab_contents/tab_util.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_view.h" |
| #include "grit/generated_resources.h" |
| @@ -122,27 +123,35 @@ SpeechRecognitionBubble::FactoryMethod SpeechRecognitionBubble::factory_ = NULL; |
| const int SpeechRecognitionBubble::kBubbleTargetOffsetX = 10; |
| SpeechRecognitionBubble* SpeechRecognitionBubble::Create( |
| - WebContents* web_contents, Delegate* delegate, |
| + int render_process_id, int render_view_id, Delegate* delegate, |
| const gfx::Rect& element_rect) { |
| - if (factory_) |
| - return (*factory_)(web_contents, delegate, element_rect); |
| + |
| + WebContents* web_contents = |
| + tab_util::GetWebContentsByID(render_process_id, render_view_id); |
| // Has the tab already closed before bubble create request was processed? |
| if (!web_contents) |
| return NULL; |
| - return CreateNativeBubble(web_contents, delegate, element_rect); |
| + if (factory_) |
| + return (*factory_)(web_contents, delegate, element_rect); |
| + |
| + return CreateNativeBubble(render_process_id, render_view_id, |
| + delegate, element_rect); |
| } |
| SpeechRecognitionBubbleBase::SpeechRecognitionBubbleBase( |
| - WebContents* web_contents) |
| + int render_process_id, int render_view_id) |
| : weak_factory_(this), |
| animation_step_(0), |
| display_mode_(DISPLAY_MODE_RECORDING), |
| - web_contents_(web_contents), |
| + render_process_id_(render_process_id), |
| + render_view_id_(render_view_id), |
| scale_(1.0f) { |
| + WebContents* web_contents = GetWebContents(); |
| + DCHECK(web_contents); |
|
tommi (sloooow) - chröme
2014/02/10 22:32:53
nit: since you check web_contents immediately afte
|
| gfx::NativeView view = |
| - web_contents_ ? web_contents_->GetView()->GetNativeView() : NULL; |
| + web_contents ? web_contents->GetView()->GetNativeView() : NULL; |
| gfx::Screen* screen = gfx::Screen::GetScreenFor(view); |
| gfx::Display display = screen->GetDisplayNearestWindow(view); |
| scale_ = display.device_scale_factor(); |
| @@ -263,7 +272,7 @@ void SpeechRecognitionBubbleBase::SetInputVolume(float volume, |
| } |
| WebContents* SpeechRecognitionBubbleBase::GetWebContents() { |
| - return web_contents_; |
| + return tab_util::GetWebContentsByID(render_process_id_, render_view_id_); |
| } |
| void SpeechRecognitionBubbleBase::SetImage(const gfx::ImageSkia& image) { |