Roll DEPS for libelf clang compilation fix.
[chromium-blink-merge.git] / components / infobars / core / confirm_infobar_delegate.cc
blob694c74fb4f8f38f0a12ba5687faa190e152a45ee
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 {
31 return false;
34 bool ConfirmInfoBarDelegate::Accept() {
35 return true;
38 bool ConfirmInfoBarDelegate::Cancel() {
39 return true;
42 base::string16 ConfirmInfoBarDelegate::GetLinkText() const {
43 return base::string16();
46 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
47 return true;
50 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate()
51 : InfoBarDelegate() {
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
61 // files.
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() {
71 return this;