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.
5 #include "components/infobars/core/confirm_infobar_delegate.h"
7 #include "grit/ui_strings.h"
8 #include "ui/base/l10n/l10n_util.h"
10 using infobars::InfoBarDelegate
;
12 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() {
15 InfoBarDelegate::InfoBarAutomationType
16 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const {
17 return CONFIRM_INFOBAR
;
20 int ConfirmInfoBarDelegate::GetButtons() const {
21 return BUTTON_OK
| BUTTON_CANCEL
;
24 base::string16
ConfirmInfoBarDelegate::GetButtonLabel(
25 InfoBarButton button
) const {
26 return l10n_util::GetStringUTF16((button
== BUTTON_OK
) ?
27 IDS_APP_OK
: IDS_APP_CANCEL
);
30 bool ConfirmInfoBarDelegate::OKButtonTriggersUACPrompt() const {
34 bool ConfirmInfoBarDelegate::Accept() {
38 bool ConfirmInfoBarDelegate::Cancel() {
42 base::string16
ConfirmInfoBarDelegate::GetLinkText() const {
43 return base::string16();
46 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition
) {
50 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate()
54 bool ConfirmInfoBarDelegate::ShouldExpireInternal(
55 const NavigationDetails
& details
) const {
56 return !details
.did_replace_entry
&&
57 InfoBarDelegate::ShouldExpireInternal(details
);
60 // ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
63 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate
* delegate
) const {
64 ConfirmInfoBarDelegate
* confirm_delegate
=
65 delegate
->AsConfirmInfoBarDelegate();
66 return confirm_delegate
&&
67 (confirm_delegate
->GetMessageText() == GetMessageText());
70 ConfirmInfoBarDelegate
* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() {