| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | |
| 6 | |
| 7 #include "grit/generated_resources.h" | |
| 8 #include "ui/base/l10n/l10n_util.h" | |
| 9 | |
| 10 using infobars::InfoBarDelegate; | |
| 11 | |
| 12 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() { | |
| 13 } | |
| 14 | |
| 15 InfoBarDelegate::InfoBarAutomationType | |
| 16 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const { | |
| 17 return CONFIRM_INFOBAR; | |
| 18 } | |
| 19 | |
| 20 int ConfirmInfoBarDelegate::GetButtons() const { | |
| 21 return BUTTON_OK | BUTTON_CANCEL; | |
| 22 } | |
| 23 | |
| 24 base::string16 ConfirmInfoBarDelegate::GetButtonLabel( | |
| 25 InfoBarButton button) const { | |
| 26 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_OK : IDS_CANCEL); | |
| 27 } | |
| 28 | |
| 29 bool ConfirmInfoBarDelegate::OKButtonTriggersUACPrompt() const { | |
| 30 return false; | |
| 31 } | |
| 32 | |
| 33 bool ConfirmInfoBarDelegate::Accept() { | |
| 34 return true; | |
| 35 } | |
| 36 | |
| 37 bool ConfirmInfoBarDelegate::Cancel() { | |
| 38 return true; | |
| 39 } | |
| 40 | |
| 41 base::string16 ConfirmInfoBarDelegate::GetLinkText() const { | |
| 42 return base::string16(); | |
| 43 } | |
| 44 | |
| 45 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | |
| 46 return true; | |
| 47 } | |
| 48 | |
| 49 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate() | |
| 50 : InfoBarDelegate() { | |
| 51 } | |
| 52 | |
| 53 bool ConfirmInfoBarDelegate::ShouldExpireInternal( | |
| 54 const NavigationDetails& details) const { | |
| 55 return !details.did_replace_entry && | |
| 56 InfoBarDelegate::ShouldExpireInternal(details); | |
| 57 } | |
| 58 | |
| 59 // ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific | |
| 60 // files. | |
| 61 | |
| 62 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { | |
| 63 ConfirmInfoBarDelegate* confirm_delegate = | |
| 64 delegate->AsConfirmInfoBarDelegate(); | |
| 65 return confirm_delegate && | |
| 66 (confirm_delegate->GetMessageText() == GetMessageText()); | |
| 67 } | |
| 68 | |
| 69 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() { | |
| 70 return this; | |
| 71 } | |
| OLD | NEW |