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