summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/infobars
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 01:55:10 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 01:55:10 +0000
commit818b9257c3348614cee083020d9b3414cb22e3f6 (patch)
tree7ae644f983c6c0b7080e933627ef1ed84b4ae754 /chrome/browser/views/infobars
parentab63e26f6872c804cb50637982dba419bfb1b45c (diff)
downloadchromium_src-818b9257c3348614cee083020d9b3414cb22e3f6.zip
chromium_src-818b9257c3348614cee083020d9b3414cb22e3f6.tar.gz
chromium_src-818b9257c3348614cee083020d9b3414cb22e3f6.tar.bz2
Fix crash with plugin installer infobar due to the infobardelegate not being removed from the containing TabContents.
http://crbug.com/4620 Review URL: http://codereview.chromium.org/12624 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/infobars')
-rw-r--r--chrome/browser/views/infobars/infobars.cc14
-rw-r--r--chrome/browser/views/infobars/infobars.h4
2 files changed, 13 insertions, 5 deletions
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index 466a74f..52fcf55 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -150,11 +150,15 @@ int InfoBar::GetAvailableWidth() const {
return close_button_->x() - kIconLabelSpacing;
}
+void InfoBar::RemoveInfoBar() const {
+ container_->RemoveDelegate(delegate());
+}
+
// InfoBar, views::BaseButton::ButtonListener implementation: ------------------
void InfoBar::ButtonPressed(views::BaseButton* sender) {
if (sender == close_button_)
- container_->RemoveDelegate(delegate());
+ RemoveInfoBar();
}
// InfoBar, AnimationDelegate implementation: ----------------------------------
@@ -320,11 +324,11 @@ void ConfirmInfoBar::ViewHierarchyChanged(bool is_add,
void ConfirmInfoBar::ButtonPressed(views::NativeButton* sender) {
if (sender == ok_button_) {
- GetDelegate()->Accept();
- AnimateClose();
+ if (GetDelegate()->Accept())
+ RemoveInfoBar();
} else if (sender == cancel_button_) {
- GetDelegate()->Cancel();
- AnimateClose();
+ if (GetDelegate()->Cancel())
+ RemoveInfoBar();
} else {
NOTREACHED();
}
diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h
index f2ccc73..028632b 100644
--- a/chrome/browser/views/infobars/infobars.h
+++ b/chrome/browser/views/infobars/infobars.h
@@ -64,6 +64,10 @@ class InfoBar : public views::View,
// excluding the close button.
virtual int GetAvailableWidth() const;
+ // Removes our associated InfoBarDelegate from the associated TabContents.
+ // (Will lead to this InfoBar being closed).
+ void RemoveInfoBar() const;
+
private:
// Overridden from views::Button::ButtonListener:
virtual void ButtonPressed(views::BaseButton* sender);