Chromium Code Reviews| Index: chrome/browser/infobars/infobar_delegate.cc |
| diff --git a/chrome/browser/infobars/infobar_delegate.cc b/chrome/browser/infobars/infobar_delegate.cc |
| index 5a6970758935c1eeae2e58a2472febcb53205db5..bdc0e36065a307121311270731b3324e3d18fc17 100644 |
| --- a/chrome/browser/infobars/infobar_delegate.cc |
| +++ b/chrome/browser/infobars/infobar_delegate.cc |
| @@ -14,6 +14,17 @@ |
| #include "content/public/browser/web_contents.h" |
| #include "ui/base/resource/resource_bundle.h" |
| +namespace { |
| +content::WebContents* WebContentsFromInfoBar(InfoBar* infobar) { |
|
droger
2014/04/08 12:11:00
The plan would be to make this helper function pub
|
| + if (!infobar || !infobar->owner()) |
| + return NULL; |
| + |
| + InfoBarService* infobar_service = |
| + static_cast<InfoBarService*>(infobar->owner()); |
| + return infobar_service->web_contents(); |
| +} |
| +} // namespace |
| + |
| using content::NavigationEntry; |
| // InfoBarDelegate ------------------------------------------------------------ |
| @@ -108,8 +119,7 @@ gfx::Image InfoBarDelegate::GetIcon() const { |
| } |
| content::WebContents* InfoBarDelegate::web_contents() { |
| - return (infobar_ && infobar_->owner()) ? |
| - infobar_->owner()->web_contents() : NULL; |
| + return WebContentsFromInfoBar(infobar_); |
| } |
| InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { |