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

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

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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 | « chrome/browser/infobars/infobar_delegate.h ('k') | chrome/browser/infobars/infobar_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/infobars/infobar_delegate.cc
===================================================================
--- chrome/browser/infobars/infobar_delegate.cc (revision 238220)
+++ chrome/browser/infobars/infobar_delegate.cc (working copy)
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "build/build_config.h"
+#include "chrome/browser/infobars/infobar.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
@@ -98,6 +99,13 @@
return NULL;
}
+void InfoBarDelegate::StoreActiveEntryUniqueID() {
+ DCHECK(web_contents());
+ NavigationEntry* active_entry =
+ web_contents()->GetController().GetActiveEntry();
+ contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0;
+}
+
gfx::Image InfoBarDelegate::GetIcon() const {
int icon_id = GetIconID();
return (icon_id == kNoIconID) ? gfx::Image() :
@@ -104,18 +112,12 @@
ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id);
}
-InfoBarDelegate::InfoBarDelegate(InfoBarService* owner)
- : contents_unique_id_(0),
- owner_(owner) {
- if (owner_)
- StoreActiveEntryUniqueID();
+content::WebContents* InfoBarDelegate::web_contents() {
+ return (infobar_ && infobar_->owner()) ?
+ infobar_->owner()->web_contents() : NULL;
}
-void InfoBarDelegate::StoreActiveEntryUniqueID() {
- DCHECK(web_contents());
- NavigationEntry* active_entry =
- web_contents()->GetController().GetActiveEntry();
- contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0;
+InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) {
}
bool InfoBarDelegate::ShouldExpireInternal(
@@ -127,8 +129,3 @@
details.entry->GetTransitionType()) ==
content::PAGE_TRANSITION_RELOAD);
}
-
-void InfoBarDelegate::RemoveSelf() {
- if (owner_)
- owner_->RemoveInfoBar(this); // Clears |owner_|.
-}
« no previous file with comments | « chrome/browser/infobars/infobar_delegate.h ('k') | chrome/browser/infobars/infobar_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698