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/infobar.h" |
7 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
8 #include "ui/strings/grit/ui_strings.h" | 10 #include "ui/strings/grit/ui_strings.h" |
9 | 11 |
10 using infobars::InfoBarDelegate; | 12 using infobars::InfoBarDelegate; |
11 | 13 |
12 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() { | 14 ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() { |
13 } | 15 } |
14 | 16 |
15 InfoBarDelegate::InfoBarAutomationType | 17 InfoBarDelegate::InfoBarAutomationType |
16 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const { | 18 ConfirmInfoBarDelegate::GetInfoBarAutomationType() const { |
(...skipping 27 matching lines...) Expand all Loading... |
44 } | 46 } |
45 | 47 |
46 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 48 bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
47 return true; | 49 return true; |
48 } | 50 } |
49 | 51 |
50 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate() | 52 ConfirmInfoBarDelegate::ConfirmInfoBarDelegate() |
51 : InfoBarDelegate() { | 53 : InfoBarDelegate() { |
52 } | 54 } |
53 | 55 |
| 56 // static |
| 57 scoped_ptr<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( |
| 58 infobars::InfoBarManager* infobar_manager, |
| 59 scoped_ptr<ConfirmInfoBarDelegate> delegate) { |
| 60 DCHECK(infobar_manager); |
| 61 return infobar_manager->CreateConfirmInfoBar(delegate.Pass()); |
| 62 } |
| 63 |
54 bool ConfirmInfoBarDelegate::ShouldExpireInternal( | 64 bool ConfirmInfoBarDelegate::ShouldExpireInternal( |
55 const NavigationDetails& details) const { | 65 const NavigationDetails& details) const { |
56 return !details.did_replace_entry && | 66 return !details.did_replace_entry && |
57 InfoBarDelegate::ShouldExpireInternal(details); | 67 InfoBarDelegate::ShouldExpireInternal(details); |
58 } | 68 } |
59 | 69 |
60 // ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific | |
61 // files. | |
62 | |
63 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { | 70 bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { |
64 ConfirmInfoBarDelegate* confirm_delegate = | 71 ConfirmInfoBarDelegate* confirm_delegate = |
65 delegate->AsConfirmInfoBarDelegate(); | 72 delegate->AsConfirmInfoBarDelegate(); |
66 return confirm_delegate && | 73 return confirm_delegate && |
67 (confirm_delegate->GetMessageText() == GetMessageText()); | 74 (confirm_delegate->GetMessageText() == GetMessageText()); |
68 } | 75 } |
69 | 76 |
70 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() { | 77 ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() { |
71 return this; | 78 return this; |
72 } | 79 } |
OLD | NEW |