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_|. |
+} |