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 "chrome/browser/infobars/confirm_infobar_delegate.h"
7 #include "grit/generated_resources.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
) ? IDS_OK
: IDS_CANCEL
);
29 bool ConfirmInfoBarDelegate::OKButtonTriggersUACPrompt() const {
33 bool ConfirmInfoBarDelegate::Accept() {
37 bool ConfirmInfoBarDelegate::Cancel() {
41 base::string16
ConfirmInfoBarDelegate::GetLinkText() const {
42 return base::string16();
45 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition
) {
49 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate()
53 bool ConfirmInfoBarDelegate::ShouldExpireInternal(
54 const NavigationDetails
& details
) const {
55 return !details
.did_replace_entry
&&
56 InfoBarDelegate::ShouldExpireInternal(details
);
59 // ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
62 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate
* delegate
) const {
63 ConfirmInfoBarDelegate
* confirm_delegate
=
64 delegate
->AsConfirmInfoBarDelegate();
65 return confirm_delegate
&&
66 (confirm_delegate
->GetMessageText() == GetMessageText());
69 ConfirmInfoBarDelegate
* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() {