| OLD | NEW |
| (Empty) |
| 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 "chrome/browser/tab_contents/confirm_infobar_delegate.h" | |
| 6 | |
| 7 #include "content/public/browser/navigation_details.h" | |
| 8 #include "grit/generated_resources.h" | |
| 9 #include "ui/base/l10n/l10n_util.h" | |
| 10 | |
| 11 InfoBarDelegate::InfoBarAutomationType | |
| 12 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const { | |
| 13 return CONFIRM_INFOBAR; | |
| 14 } | |
| 15 | |
| 16 int ConfirmInfoBarDelegate::GetButtons() const { | |
| 17 return BUTTON_OK | BUTTON_CANCEL; | |
| 18 } | |
| 19 | |
| 20 string16 ConfirmInfoBarDelegate::GetButtonLabel(InfoBarButton button) const { | |
| 21 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_OK : IDS_CANCEL); | |
| 22 } | |
| 23 | |
| 24 bool ConfirmInfoBarDelegate::NeedElevation(InfoBarButton button) const { | |
| 25 return false; | |
| 26 } | |
| 27 | |
| 28 bool ConfirmInfoBarDelegate::Accept() { | |
| 29 return true; | |
| 30 } | |
| 31 | |
| 32 bool ConfirmInfoBarDelegate::Cancel() { | |
| 33 return true; | |
| 34 } | |
| 35 | |
| 36 string16 ConfirmInfoBarDelegate::GetLinkText() const { | |
| 37 return string16(); | |
| 38 } | |
| 39 | |
| 40 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | |
| 41 return true; | |
| 42 } | |
| 43 | |
| 44 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate(InfoBarTabHelper* infobar_helper) | |
| 45 : InfoBarDelegate(infobar_helper) { | |
| 46 } | |
| 47 | |
| 48 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() { | |
| 49 } | |
| 50 | |
| 51 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { | |
| 52 ConfirmInfoBarDelegate* confirm_delegate = | |
| 53 delegate->AsConfirmInfoBarDelegate(); | |
| 54 return confirm_delegate && | |
| 55 (confirm_delegate->GetMessageText() == GetMessageText()); | |
| 56 } | |
| 57 | |
| 58 bool ConfirmInfoBarDelegate::ShouldExpireInternal( | |
| 59 const content::LoadCommittedDetails& details) const { | |
| 60 return !details.did_replace_entry && | |
| 61 InfoBarDelegate::ShouldExpireInternal(details); | |
| 62 } | |
| 63 | |
| 64 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() { | |
| 65 return this; | |
| 66 } | |
| OLD | NEW |