OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/infobar_delegate.h" | 5 #include "components/infobars/core/infobar_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
10 #include "components/infobars/core/infobar_manager.h" | 10 #include "components/infobars/core/infobar_manager.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 int icon_id = GetIconID(); | 34 int icon_id = GetIconID(); |
35 return (icon_id == kNoIconID) ? gfx::Image() : | 35 return (icon_id == kNoIconID) ? gfx::Image() : |
36 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); | 36 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); |
37 } | 37 } |
38 | 38 |
39 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { | 39 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { |
40 return false; | 40 return false; |
41 } | 41 } |
42 | 42 |
43 bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const { | 43 bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const { |
44 if (!details.is_navigation_to_different_page) | 44 return details.is_navigation_to_different_page && !details.did_replace_entry; |
45 return false; | |
46 | |
47 return ShouldExpireInternal(details); | |
48 } | 45 } |
49 | 46 |
50 void InfoBarDelegate::InfoBarDismissed() { | 47 void InfoBarDelegate::InfoBarDismissed() { |
51 } | 48 } |
52 | 49 |
53 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() { | 50 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() { |
54 return nullptr; | 51 return nullptr; |
55 } | 52 } |
56 | 53 |
57 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { | 54 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 89 |
93 ThreeDAPIInfoBarDelegate* InfoBarDelegate::AsThreeDAPIInfoBarDelegate() { | 90 ThreeDAPIInfoBarDelegate* InfoBarDelegate::AsThreeDAPIInfoBarDelegate() { |
94 return nullptr; | 91 return nullptr; |
95 } | 92 } |
96 | 93 |
97 translate::TranslateInfoBarDelegate* | 94 translate::TranslateInfoBarDelegate* |
98 InfoBarDelegate::AsTranslateInfoBarDelegate() { | 95 InfoBarDelegate::AsTranslateInfoBarDelegate() { |
99 return nullptr; | 96 return nullptr; |
100 } | 97 } |
101 | 98 |
102 void InfoBarDelegate::StoreActiveEntryUniqueID() { | 99 InfoBarDelegate::InfoBarDelegate() { |
103 contents_unique_id_ = infobar()->owner()->GetActiveEntryID(); | |
104 } | |
105 | |
106 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { | |
107 } | |
108 | |
109 bool InfoBarDelegate::ShouldExpireInternal( | |
110 const NavigationDetails& details) const { | |
111 // NOTE: If you change this, be sure to check and adjust the behavior of | |
112 // anyone who overrides this as necessary! | |
113 return (contents_unique_id_ != details.entry_id) || details.is_reload; | |
114 } | 100 } |
115 | 101 |
116 } // namespace infobars | 102 } // namespace infobars |
OLD | NEW |