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) { |
blundell
2014/04/09 09:41:21
This should live in InfoBarService per the discuss
|
+ if (!infobar || !infobar->owner()) |
+ return NULL; |
+ |
+ InfoBarService* infobar_service = |
blundell
2014/04/09 09:41:21
Maybe a warning about only calling this function i
|
+ 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) { |