| 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 int InfoBarDelegate::GetIconID() const { | 39 int InfoBarDelegate::GetIconID() const { |
| 40 return kNoIconID; | 40 return kNoIconID; |
| 41 } | 41 } |
| 42 | 42 |
| 43 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { | 43 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { |
| 44 return WARNING_TYPE; | 44 return WARNING_TYPE; |
| 45 } | 45 } |
| 46 | 46 |
| 47 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() { | 47 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() { |
| 48 return NULL; | 48 return nullptr; |
| 49 } | 49 } |
| 50 | 50 |
| 51 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { | 51 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { |
| 52 return NULL; | 52 return nullptr; |
| 53 } | 53 } |
| 54 | 54 |
| 55 ExtensionInfoBarDelegate* InfoBarDelegate::AsExtensionInfoBarDelegate() { | 55 ExtensionInfoBarDelegate* InfoBarDelegate::AsExtensionInfoBarDelegate() { |
| 56 return NULL; | 56 return nullptr; |
| 57 } | 57 } |
| 58 | 58 |
| 59 InsecureContentInfoBarDelegate* | 59 InsecureContentInfoBarDelegate* |
| 60 InfoBarDelegate::AsInsecureContentInfoBarDelegate() { | 60 InfoBarDelegate::AsInsecureContentInfoBarDelegate() { |
| 61 return NULL; | 61 return nullptr; |
| 62 } | 62 } |
| 63 | 63 |
| 64 MediaStreamInfoBarDelegate* InfoBarDelegate::AsMediaStreamInfoBarDelegate() { | 64 MediaStreamInfoBarDelegate* InfoBarDelegate::AsMediaStreamInfoBarDelegate() { |
| 65 return NULL; | 65 return nullptr; |
| 66 } |
| 67 |
| 68 NativeAppInfoBarDelegate* InfoBarDelegate::AsNativeAppInfoBarDelegate() { |
| 69 return nullptr; |
| 66 } | 70 } |
| 67 | 71 |
| 68 PopupBlockedInfoBarDelegate* InfoBarDelegate::AsPopupBlockedInfoBarDelegate() { | 72 PopupBlockedInfoBarDelegate* InfoBarDelegate::AsPopupBlockedInfoBarDelegate() { |
| 69 return NULL; | 73 return nullptr; |
| 70 } | 74 } |
| 71 | 75 |
| 72 RegisterProtocolHandlerInfoBarDelegate* | 76 RegisterProtocolHandlerInfoBarDelegate* |
| 73 InfoBarDelegate::AsRegisterProtocolHandlerInfoBarDelegate() { | 77 InfoBarDelegate::AsRegisterProtocolHandlerInfoBarDelegate() { |
| 74 return NULL; | 78 return nullptr; |
| 75 } | 79 } |
| 76 | 80 |
| 77 ScreenCaptureInfoBarDelegate* | 81 ScreenCaptureInfoBarDelegate* |
| 78 InfoBarDelegate::AsScreenCaptureInfoBarDelegate() { | 82 InfoBarDelegate::AsScreenCaptureInfoBarDelegate() { |
| 79 return NULL; | 83 return nullptr; |
| 80 } | 84 } |
| 81 | 85 |
| 82 ThemeInstalledInfoBarDelegate* | 86 ThemeInstalledInfoBarDelegate* |
| 83 InfoBarDelegate::AsThemePreviewInfobarDelegate() { | 87 InfoBarDelegate::AsThemePreviewInfobarDelegate() { |
| 84 return NULL; | 88 return nullptr; |
| 85 } | 89 } |
| 86 | 90 |
| 87 translate::TranslateInfoBarDelegate* | 91 translate::TranslateInfoBarDelegate* |
| 88 InfoBarDelegate::AsTranslateInfoBarDelegate() { | 92 InfoBarDelegate::AsTranslateInfoBarDelegate() { |
| 89 return NULL; | 93 return nullptr; |
| 90 } | 94 } |
| 91 | 95 |
| 92 void InfoBarDelegate::StoreActiveEntryUniqueID() { | 96 void InfoBarDelegate::StoreActiveEntryUniqueID() { |
| 93 contents_unique_id_ = infobar()->owner()->GetActiveEntryID(); | 97 contents_unique_id_ = infobar()->owner()->GetActiveEntryID(); |
| 94 } | 98 } |
| 95 | 99 |
| 96 gfx::Image InfoBarDelegate::GetIcon() const { | 100 gfx::Image InfoBarDelegate::GetIcon() const { |
| 97 int icon_id = GetIconID(); | 101 int icon_id = GetIconID(); |
| 98 return (icon_id == kNoIconID) ? gfx::Image() : | 102 return (icon_id == kNoIconID) ? gfx::Image() : |
| 99 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); | 103 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); |
| 100 } | 104 } |
| 101 | 105 |
| 102 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { | 106 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { |
| 103 } | 107 } |
| 104 | 108 |
| 105 bool InfoBarDelegate::ShouldExpireInternal( | 109 bool InfoBarDelegate::ShouldExpireInternal( |
| 106 const NavigationDetails& details) const { | 110 const NavigationDetails& details) const { |
| 107 // 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 |
| 108 // anyone who overrides this as necessary! | 112 // anyone who overrides this as necessary! |
| 109 return (contents_unique_id_ != details.entry_id) || details.is_reload; | 113 return (contents_unique_id_ != details.entry_id) || details.is_reload; |
| 110 } | 114 } |
| 111 | 115 |
| 112 } // namespace infobars | 116 } // namespace infobars |
| OLD | NEW |