Add abhijeet.k@samsung.com to AUTHORS list.
[chromium-blink-merge.git] / components / infobars / core / confirm_infobar_delegate.cc
blob9c00449a5a22bc0bf1e3ca7245c41ca96e074ca4
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 "base/logging.h"
8 #include "components/infobars/core/infobar.h"
9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/strings/grit/ui_strings.h"
12 using infobars::InfoBarDelegate;
14 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() {
17 InfoBarDelegate::InfoBarAutomationType
18 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const {
19 return CONFIRM_INFOBAR;
22 int ConfirmInfoBarDelegate::GetButtons() const {
23 return BUTTON_OK | BUTTON_CANCEL;
26 base::string16 ConfirmInfoBarDelegate::GetButtonLabel(
27 InfoBarButton button) const {
28 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
29 IDS_APP_OK : IDS_APP_CANCEL);
32 bool ConfirmInfoBarDelegate::OKButtonTriggersUACPrompt() const {
33 return false;
36 bool ConfirmInfoBarDelegate::Accept() {
37 return true;
40 bool ConfirmInfoBarDelegate::Cancel() {
41 return true;
44 base::string16 ConfirmInfoBarDelegate::GetLinkText() const {
45 return base::string16();
48 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
49 return true;
52 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate()
53 : InfoBarDelegate() {
56 bool ConfirmInfoBarDelegate::ShouldExpireInternal(
57 const NavigationDetails& details) const {
58 return !details.did_replace_entry &&
59 InfoBarDelegate::ShouldExpireInternal(details);
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() {
70 return this;