| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/infobars/core/confirm_infobar_delegate.h" | 5 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" |
| 8 #include "components/infobars/core/confirm_infobar_delegate_factory.h" |
| 9 #include "components/infobars/core/infobar.h" |
| 7 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 8 #include "ui/strings/grit/ui_strings.h" | 11 #include "ui/strings/grit/ui_strings.h" |
| 9 | 12 |
| 10 using infobars::InfoBarDelegate; | 13 using infobars::InfoBarDelegate; |
| 11 | 14 |
| 12 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() { | 15 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() { |
| 13 } | 16 } |
| 14 | 17 |
| 15 InfoBarDelegate::InfoBarAutomationType | 18 InfoBarDelegate::InfoBarAutomationType |
| 16 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const { | 19 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 44 } | 47 } |
| 45 | 48 |
| 46 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 49 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
| 47 return true; | 50 return true; |
| 48 } | 51 } |
| 49 | 52 |
| 50 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate() | 53 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate() |
| 51 : InfoBarDelegate() { | 54 : InfoBarDelegate() { |
| 52 } | 55 } |
| 53 | 56 |
| 57 // static |
| 58 scoped_ptr<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( |
| 59 scoped_ptr<ConfirmInfoBarDelegate> delegate) { |
| 60 DCHECK(ConfirmInfoBarDelegateFactory::GetInstance()) |
| 61 << "No ConfirmInfoBarDelegateFactory registered"; |
| 62 return ConfirmInfoBarDelegateFactory::GetInstance()->CreateInfoBar( |
| 63 delegate.Pass()); |
| 64 } |
| 65 |
| 54 bool ConfirmInfoBarDelegate::ShouldExpireInternal( | 66 bool ConfirmInfoBarDelegate::ShouldExpireInternal( |
| 55 const NavigationDetails& details) const { | 67 const NavigationDetails& details) const { |
| 56 return !details.did_replace_entry && | 68 return !details.did_replace_entry && |
| 57 InfoBarDelegate::ShouldExpireInternal(details); | 69 InfoBarDelegate::ShouldExpireInternal(details); |
| 58 } | 70 } |
| 59 | 71 |
| 60 // ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific | 72 // ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific |
| 61 // files. | 73 // files. |
| 62 | 74 |
| 63 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { | 75 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { |
| 64 ConfirmInfoBarDelegate* confirm_delegate = | 76 ConfirmInfoBarDelegate* confirm_delegate = |
| 65 delegate->AsConfirmInfoBarDelegate(); | 77 delegate->AsConfirmInfoBarDelegate(); |
| 66 return confirm_delegate && | 78 return confirm_delegate && |
| 67 (confirm_delegate->GetMessageText() == GetMessageText()); | 79 (confirm_delegate->GetMessageText() == GetMessageText()); |
| 68 } | 80 } |
| 69 | 81 |
| 70 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() { | 82 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() { |
| 71 return this; | 83 return this; |
| 72 } | 84 } |
| OLD | NEW |