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

Unified Diff: chrome/browser/infobars/infobar_delegate.cc

Issue 228293004: InfoBarService inherits from InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a ShutDown method Created 6 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/infobars/infobar_manager.h » ('j') | chrome/browser/infobars/infobar_manager.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15:00:11 The plan would be to make this helper function pub
Peter Kasting 2014/04/08 20:39:56 I didn't go this route for two reasons: (1) Callsi
droger 2014/04/08 20:54:46 About (2), I don't think we still need to have dif
Peter Kasting 2014/04/08 21:41:35 Right, I was suggesting that the base class route
+ 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) {
« no previous file with comments | « no previous file | chrome/browser/infobars/infobar_manager.h » ('j') | chrome/browser/infobars/infobar_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698