| 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 18 matching lines...) Expand all Loading... |
| 29 bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const { | 29 bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const { |
| 30 if (!details.is_navigation_to_different_page) | 30 if (!details.is_navigation_to_different_page) |
| 31 return false; | 31 return false; |
| 32 | 32 |
| 33 return ShouldExpireInternal(details); | 33 return ShouldExpireInternal(details); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void InfoBarDelegate::InfoBarDismissed() { | 36 void InfoBarDelegate::InfoBarDismissed() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 int InfoBarDelegate::GetIconID() const { | |
| 40 return kNoIconID; | |
| 41 } | |
| 42 | |
| 43 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { | 39 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { |
| 44 return WARNING_TYPE; | 40 return WARNING_TYPE; |
| 45 } | 41 } |
| 46 | 42 |
| 47 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() { | 43 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() { |
| 48 return nullptr; | 44 return nullptr; |
| 49 } | 45 } |
| 50 | 46 |
| 51 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { | 47 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { |
| 52 return nullptr; | 48 return nullptr; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 81 ScreenCaptureInfoBarDelegate* | 77 ScreenCaptureInfoBarDelegate* |
| 82 InfoBarDelegate::AsScreenCaptureInfoBarDelegate() { | 78 InfoBarDelegate::AsScreenCaptureInfoBarDelegate() { |
| 83 return nullptr; | 79 return nullptr; |
| 84 } | 80 } |
| 85 | 81 |
| 86 ThemeInstalledInfoBarDelegate* | 82 ThemeInstalledInfoBarDelegate* |
| 87 InfoBarDelegate::AsThemePreviewInfobarDelegate() { | 83 InfoBarDelegate::AsThemePreviewInfobarDelegate() { |
| 88 return nullptr; | 84 return nullptr; |
| 89 } | 85 } |
| 90 | 86 |
| 87 ThreeDAPIInfoBarDelegate* InfoBarDelegate::AsThreeDAPIInfoBarDelegate() { |
| 88 return nullptr; |
| 89 } |
| 90 |
| 91 translate::TranslateInfoBarDelegate* | 91 translate::TranslateInfoBarDelegate* |
| 92 InfoBarDelegate::AsTranslateInfoBarDelegate() { | 92 InfoBarDelegate::AsTranslateInfoBarDelegate() { |
| 93 return nullptr; | 93 return nullptr; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void InfoBarDelegate::StoreActiveEntryUniqueID() { | 96 void InfoBarDelegate::StoreActiveEntryUniqueID() { |
| 97 contents_unique_id_ = infobar()->owner()->GetActiveEntryID(); | 97 contents_unique_id_ = infobar()->owner()->GetActiveEntryID(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 gfx::Image InfoBarDelegate::GetIcon() const { | 100 gfx::Image InfoBarDelegate::GetIcon() const { |
| 101 int icon_id = GetIconID(); | 101 int icon_id = GetIconID(); |
| 102 return (icon_id == kNoIconID) ? gfx::Image() : | 102 return (icon_id == kNoIconID) ? gfx::Image() : |
| 103 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); | 103 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); |
| 104 } | 104 } |
| 105 | 105 |
| 106 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { | 106 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool InfoBarDelegate::ShouldExpireInternal( | 109 bool InfoBarDelegate::ShouldExpireInternal( |
| 110 const NavigationDetails& details) const { | 110 const NavigationDetails& details) const { |
| 111 // NOTE: If you change this, be sure to check and adjust the behavior of | 111 // NOTE: If you change this, be sure to check and adjust the behavior of |
| 112 // anyone who overrides this as necessary! | 112 // anyone who overrides this as necessary! |
| 113 return (contents_unique_id_ != details.entry_id) || details.is_reload; | 113 return (contents_unique_id_ != details.entry_id) || details.is_reload; |
| 114 } | 114 } |
| 115 | 115 |
| 116 int InfoBarDelegate::GetIconID() const { |
| 117 return kNoIconID; |
| 118 } |
| 119 |
| 116 } // namespace infobars | 120 } // namespace infobars |
| OLD | NEW |