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

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

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
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
Index: trunk/src/chrome/browser/infobars/infobar_delegate.cc
===================================================================
--- trunk/src/chrome/browser/infobars/infobar_delegate.cc (revision 238401)
+++ trunk/src/chrome/browser/infobars/infobar_delegate.cc (working copy)
@@ -6,7 +6,6 @@
#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"
@@ -99,25 +98,24 @@
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() :
ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id);
}
-content::WebContents* InfoBarDelegate::web_contents() {
- return (infobar_ && infobar_->owner()) ?
- infobar_->owner()->web_contents() : NULL;
+InfoBarDelegate::InfoBarDelegate(InfoBarService* owner)
+ : contents_unique_id_(0),
+ owner_(owner) {
+ if (owner_)
+ StoreActiveEntryUniqueID();
}
-InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) {
+void InfoBarDelegate::StoreActiveEntryUniqueID() {
+ DCHECK(web_contents());
+ NavigationEntry* active_entry =
+ web_contents()->GetController().GetActiveEntry();
+ contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0;
}
bool InfoBarDelegate::ShouldExpireInternal(
@@ -129,3 +127,8 @@
details.entry->GetTransitionType()) ==
content::PAGE_TRANSITION_RELOAD);
}
+
+void InfoBarDelegate::RemoveSelf() {
+ if (owner_)
+ owner_->RemoveInfoBar(this); // Clears |owner_|.
+}
« no previous file with comments | « trunk/src/chrome/browser/infobars/infobar_delegate.h ('k') | trunk/src/chrome/browser/infobars/infobar_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698