Home | History | Annotate | Download | only in tab_contents
      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 
     11 int ConfirmInfoBarDelegate::GetButtons() const {
     12   return BUTTON_OK | BUTTON_CANCEL;
     13 }
     14 
     15 string16 ConfirmInfoBarDelegate::GetButtonLabel(InfoBarButton button) const {
     16   return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_OK : IDS_CANCEL);
     17 }
     18 
     19 bool ConfirmInfoBarDelegate::NeedElevation(InfoBarButton button) const {
     20   return false;
     21 }
     22 
     23 bool ConfirmInfoBarDelegate::Accept() {
     24   return true;
     25 }
     26 
     27 bool ConfirmInfoBarDelegate::Cancel() {
     28   return true;
     29 }
     30 
     31 string16 ConfirmInfoBarDelegate::GetLinkText() {
     32   return string16();
     33 }
     34 
     35 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
     36   return true;
     37 }
     38 
     39 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate(TabContents* contents)
     40     : InfoBarDelegate(contents) {
     41 }
     42 
     43 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() {
     44 }
     45 
     46 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
     47   ConfirmInfoBarDelegate* confirm_delegate =
     48       delegate->AsConfirmInfoBarDelegate();
     49   return confirm_delegate &&
     50       (confirm_delegate->GetMessageText() == GetMessageText());
     51 }
     52 
     53 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() {
     54   return this;
     55 }
     56