Chromium Code Reviews| Index: chrome/browser/tab_contents/infobar_delegate.cc |
| =================================================================== |
| --- chrome/browser/tab_contents/infobar_delegate.cc (revision 72676) |
| +++ chrome/browser/tab_contents/infobar_delegate.cc (working copy) |
| @@ -42,16 +42,12 @@ |
| return WARNING_TYPE; |
| } |
| -AlertInfoBarDelegate* InfoBarDelegate::AsAlertInfoBarDelegate() { |
| - return NULL; |
| -} |
| - |
| ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { |
| return NULL; |
| } |
| CrashedExtensionInfoBarDelegate* |
| -InfoBarDelegate::AsCrashedExtensionInfoBarDelegate() { |
| + InfoBarDelegate::AsCrashedExtensionInfoBarDelegate() { |
| return NULL; |
| } |
| @@ -84,26 +80,6 @@ |
| } |
| -// AlertInfoBarDelegate ------------------------------------------------------- |
| - |
| -bool AlertInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { |
| - AlertInfoBarDelegate* alert_delegate = delegate->AsAlertInfoBarDelegate(); |
| - return alert_delegate && |
| - (alert_delegate->GetMessageText() == GetMessageText()); |
| -} |
| - |
| -AlertInfoBarDelegate::AlertInfoBarDelegate(TabContents* contents) |
| - : InfoBarDelegate(contents) { |
| -} |
| - |
| -AlertInfoBarDelegate::~AlertInfoBarDelegate() { |
| -} |
| - |
| -AlertInfoBarDelegate* AlertInfoBarDelegate::AsAlertInfoBarDelegate() { |
| - return this; |
| -} |
| - |
| - |
| // LinkInfoBarDelegate -------------------------------------------------------- |
| string16 LinkInfoBarDelegate::GetMessageTextWithOffset( |
| @@ -131,7 +107,7 @@ |
| // ConfirmInfoBarDelegate ----------------------------------------------------- |
| int ConfirmInfoBarDelegate::GetButtons() const { |
| - return BUTTON_NONE; |
| + return BUTTON_OK | BUTTON_CANCEL; |
| } |
| string16 ConfirmInfoBarDelegate::GetButtonLabel(InfoBarButton button) const { |
| @@ -159,12 +135,19 @@ |
| } |
| ConfirmInfoBarDelegate::ConfirmInfoBarDelegate(TabContents* contents) |
| - : AlertInfoBarDelegate(contents) { |
| + : InfoBarDelegate(contents) { |
| } |
| ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() { |
| } |
| +bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { |
| + ConfirmInfoBarDelegate* confirm_delegate = |
| + delegate->AsConfirmInfoBarDelegate(); |
| + return confirm_delegate && |
| + (confirm_delegate->GetMessageText() == GetMessageText()); |
| +} |
| + |
| ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() { |
| return this; |
| } |
| @@ -177,7 +160,7 @@ |
| SkBitmap* icon, |
| const string16& message, |
| bool auto_expire) |
| - : AlertInfoBarDelegate(contents), |
| + : ConfirmInfoBarDelegate(contents), |
| icon_(icon), |
| message_(message), |
| auto_expire_(auto_expire) { |
| @@ -188,7 +171,7 @@ |
| bool SimpleAlertInfoBarDelegate::ShouldExpire( |
| const NavigationController::LoadCommittedDetails& details) const { |
| - return auto_expire_ && AlertInfoBarDelegate::ShouldExpire(details); |
| + return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); |
| } |
| void SimpleAlertInfoBarDelegate::InfoBarClosed() { |
| @@ -202,3 +185,7 @@ |
| string16 SimpleAlertInfoBarDelegate::GetMessageText() const { |
| return message_; |
| } |
| + |
| +int SimpleAlertInfoBarDelegate::GetButtons() const { |
| + return BUTTON_NONE; |
| +} |
|
Elliot Glaysher
2011/01/26 20:52:22
Linter wants newline
Peter Kasting
2011/01/26 20:56:01
It has a newline. The linter is wrong about this
|