Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / infobars / confirm_infobar_delegate.cc
blob9b9ac8a513d7f1cb0f5f56ecd4c79abfbc15f872
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 "chrome/browser/infobars/confirm_infobar_delegate.h"
7 #include "content/public/browser/navigation_details.h"
8 #include "grit/generated_resources.h"
9 #include "ui/base/l10n/l10n_util.h"
11 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() {
14 InfoBarDelegate::InfoBarAutomationType
15 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const {
16 return CONFIRM_INFOBAR;
19 int ConfirmInfoBarDelegate::GetButtons() const {
20 return BUTTON_OK | BUTTON_CANCEL;
23 base::string16 ConfirmInfoBarDelegate::GetButtonLabel(
24 InfoBarButton button) const {
25 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_OK : IDS_CANCEL);
28 bool ConfirmInfoBarDelegate::NeedElevation(InfoBarButton button) const {
29 return false;
32 bool ConfirmInfoBarDelegate::Accept() {
33 return true;
36 bool ConfirmInfoBarDelegate::Cancel() {
37 return true;
40 base::string16 ConfirmInfoBarDelegate::GetLinkText() const {
41 return base::string16();
44 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
45 return true;
48 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate()
49 : InfoBarDelegate() {
52 bool ConfirmInfoBarDelegate::ShouldExpireInternal(
53 const content::LoadCommittedDetails& details) const {
54 return !details.did_replace_entry &&
55 InfoBarDelegate::ShouldExpireInternal(details);
58 // ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
59 // files.
61 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
62 ConfirmInfoBarDelegate* confirm_delegate =
63 delegate->AsConfirmInfoBarDelegate();
64 return confirm_delegate &&
65 (confirm_delegate->GetMessageText() == GetMessageText());
68 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() {
69 return this;