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 "content/public/browser/navigation_details.h"
8 #include "grit/generated_resources.h"
9 #include "ui/base/l10n/l10n_util.h"
11 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() {
14 InfoBarDelegate::InfoBarAutomationType
15 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const {
16 return CONFIRM_INFOBAR
;
19 int ConfirmInfoBarDelegate::GetButtons() const {
20 return BUTTON_OK
| BUTTON_CANCEL
;
23 string16
ConfirmInfoBarDelegate::GetButtonLabel(InfoBarButton button
) const {
24 return l10n_util::GetStringUTF16((button
== BUTTON_OK
) ? IDS_OK
: IDS_CANCEL
);
27 bool ConfirmInfoBarDelegate::NeedElevation(InfoBarButton button
) const {
31 bool ConfirmInfoBarDelegate::Accept() {
35 bool ConfirmInfoBarDelegate::Cancel() {
39 string16
ConfirmInfoBarDelegate::GetLinkText() const {
43 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition
) {
47 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate(
48 InfoBarService
* infobar_service
)
49 : InfoBarDelegate(infobar_service
) {
52 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate
* delegate
) const {
53 ConfirmInfoBarDelegate
* confirm_delegate
=
54 delegate
->AsConfirmInfoBarDelegate();
55 return confirm_delegate
&&
56 (confirm_delegate
->GetMessageText() == GetMessageText());
59 bool ConfirmInfoBarDelegate::ShouldExpireInternal(
60 const content::LoadCommittedDetails
& details
) const {
61 return !details
.did_replace_entry
&&
62 InfoBarDelegate::ShouldExpireInternal(details
);
65 ConfirmInfoBarDelegate
* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() {