• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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 "chrome/browser/tab_contents/confirm_infobar_delegate.h"
6 
7 #include "content/browser/tab_contents/tab_contents.h"
8 #include "grit/generated_resources.h"
9 #include "ui/base/l10n/l10n_util.h"
10 
GetButtons() const11 int ConfirmInfoBarDelegate::GetButtons() const {
12   return BUTTON_OK | BUTTON_CANCEL;
13 }
14 
GetButtonLabel(InfoBarButton button) const15 string16 ConfirmInfoBarDelegate::GetButtonLabel(InfoBarButton button) const {
16   return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_OK : IDS_CANCEL);
17 }
18 
NeedElevation(InfoBarButton button) const19 bool ConfirmInfoBarDelegate::NeedElevation(InfoBarButton button) const {
20   return false;
21 }
22 
Accept()23 bool ConfirmInfoBarDelegate::Accept() {
24   return true;
25 }
26 
Cancel()27 bool ConfirmInfoBarDelegate::Cancel() {
28   return true;
29 }
30 
GetLinkText()31 string16 ConfirmInfoBarDelegate::GetLinkText() {
32   return string16();
33 }
34 
LinkClicked(WindowOpenDisposition disposition)35 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
36   return true;
37 }
38 
ConfirmInfoBarDelegate(TabContents * contents)39 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate(TabContents* contents)
40     : InfoBarDelegate(contents) {
41 }
42 
~ConfirmInfoBarDelegate()43 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() {
44 }
45 
EqualsDelegate(InfoBarDelegate * delegate) const46 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
47   ConfirmInfoBarDelegate* confirm_delegate =
48       delegate->AsConfirmInfoBarDelegate();
49   return confirm_delegate &&
50       (confirm_delegate->GetMessageText() == GetMessageText());
51 }
52 
AsConfirmInfoBarDelegate()53 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() {
54   return this;
55 }
56