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.
4 
5 #include "components/infobars/core/confirm_infobar_delegate.h"
6 
7 #include "build/build_config.h"
8 #include "ui/base/l10n/l10n_util.h"
9 #include "ui/strings/grit/ui_strings.h"
10 
11 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() = default;
12 
EqualsDelegate(infobars::InfoBarDelegate * delegate) const13 bool ConfirmInfoBarDelegate::EqualsDelegate(
14     infobars::InfoBarDelegate* delegate) const {
15   ConfirmInfoBarDelegate* confirm_delegate =
16       delegate->AsConfirmInfoBarDelegate();
17   return confirm_delegate &&
18          (confirm_delegate->GetMessageText() == GetMessageText());
19 }
20 
AsConfirmInfoBarDelegate()21 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() {
22   return this;
23 }
24 
25 infobars::InfoBarDelegate::InfoBarAutomationType
GetInfoBarAutomationType() const26 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const {
27   return CONFIRM_INFOBAR;
28 }
29 
GetTitleText() const30 base::string16 ConfirmInfoBarDelegate::GetTitleText() const {
31   return base::string16();
32 }
33 
GetMessageElideBehavior() const34 gfx::ElideBehavior ConfirmInfoBarDelegate::GetMessageElideBehavior() const {
35   return gfx::ELIDE_TAIL;
36 }
37 
GetButtons() const38 int ConfirmInfoBarDelegate::GetButtons() const {
39   return BUTTON_OK | BUTTON_CANCEL;
40 }
41 
GetButtonLabel(InfoBarButton button) const42 base::string16 ConfirmInfoBarDelegate::GetButtonLabel(
43     InfoBarButton button) const {
44   return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_APP_OK
45                                                          : IDS_APP_CANCEL);
46 }
47 
OKButtonTriggersUACPrompt() const48 bool ConfirmInfoBarDelegate::OKButtonTriggersUACPrompt() const {
49   return false;
50 }
51 
52 #if defined(OS_IOS)
UseIconBackgroundTint() const53 bool ConfirmInfoBarDelegate::UseIconBackgroundTint() const {
54   return true;
55 }
56 #endif
57 
Accept()58 bool ConfirmInfoBarDelegate::Accept() {
59   return true;
60 }
61 
Cancel()62 bool ConfirmInfoBarDelegate::Cancel() {
63   return true;
64 }
65 
66 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate() = default;
67