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 base::string16
ConfirmInfoBarDelegate::GetButtonLabel(
24 InfoBarButton button
) const {
25 return l10n_util::GetStringUTF16((button
== BUTTON_OK
) ? IDS_OK
: IDS_CANCEL
);
28 bool ConfirmInfoBarDelegate::NeedElevation(InfoBarButton button
) const {
32 bool ConfirmInfoBarDelegate::Accept() {
36 bool ConfirmInfoBarDelegate::Cancel() {
40 base::string16
ConfirmInfoBarDelegate::GetLinkText() const {
41 return base::string16();
44 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition
) {
48 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate()
52 bool ConfirmInfoBarDelegate::ShouldExpireInternal(
53 const content::LoadCommittedDetails
& details
) const {
54 return !details
.did_replace_entry
&&
55 InfoBarDelegate::ShouldExpireInternal(details
);
58 // ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
61 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate
* delegate
) const {
62 ConfirmInfoBarDelegate
* confirm_delegate
=
63 delegate
->AsConfirmInfoBarDelegate();
64 return confirm_delegate
&&
65 (confirm_delegate
->GetMessageText() == GetMessageText());
68 ConfirmInfoBarDelegate
* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() {