| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/infobars/infobar_delegate.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "build/build_config.h" | |
| 9 #include "chrome/browser/infobars/infobar.h" | |
| 10 #include "chrome/browser/infobars/infobar_manager.h" | |
| 11 #include "ui/base/resource/resource_bundle.h" | |
| 12 | |
| 13 const int InfoBarDelegate::kNoIconID = 0; | |
| 14 | |
| 15 InfoBarDelegate::~InfoBarDelegate() { | |
| 16 } | |
| 17 | |
| 18 InfoBarDelegate::InfoBarAutomationType | |
| 19 InfoBarDelegate::GetInfoBarAutomationType() const { | |
| 20 return UNKNOWN_INFOBAR; | |
| 21 } | |
| 22 | |
| 23 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { | |
| 24 return false; | |
| 25 } | |
| 26 | |
| 27 bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const { | |
| 28 if (!details.is_navigation_to_different_page) | |
| 29 return false; | |
| 30 | |
| 31 return ShouldExpireInternal(details); | |
| 32 } | |
| 33 | |
| 34 void InfoBarDelegate::InfoBarDismissed() { | |
| 35 } | |
| 36 | |
| 37 int InfoBarDelegate::GetIconID() const { | |
| 38 return kNoIconID; | |
| 39 } | |
| 40 | |
| 41 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { | |
| 42 return WARNING_TYPE; | |
| 43 } | |
| 44 | |
| 45 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() { | |
| 46 return NULL; | |
| 47 } | |
| 48 | |
| 49 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { | |
| 50 return NULL; | |
| 51 } | |
| 52 | |
| 53 ExtensionInfoBarDelegate* InfoBarDelegate::AsExtensionInfoBarDelegate() { | |
| 54 return NULL; | |
| 55 } | |
| 56 | |
| 57 InsecureContentInfoBarDelegate* | |
| 58 InfoBarDelegate::AsInsecureContentInfoBarDelegate() { | |
| 59 return NULL; | |
| 60 } | |
| 61 | |
| 62 MediaStreamInfoBarDelegate* InfoBarDelegate::AsMediaStreamInfoBarDelegate() { | |
| 63 return NULL; | |
| 64 } | |
| 65 | |
| 66 PopupBlockedInfoBarDelegate* InfoBarDelegate::AsPopupBlockedInfoBarDelegate() { | |
| 67 return NULL; | |
| 68 } | |
| 69 | |
| 70 RegisterProtocolHandlerInfoBarDelegate* | |
| 71 InfoBarDelegate::AsRegisterProtocolHandlerInfoBarDelegate() { | |
| 72 return NULL; | |
| 73 } | |
| 74 | |
| 75 ScreenCaptureInfoBarDelegate* | |
| 76 InfoBarDelegate::AsScreenCaptureInfoBarDelegate() { | |
| 77 return NULL; | |
| 78 } | |
| 79 | |
| 80 ThemeInstalledInfoBarDelegate* | |
| 81 InfoBarDelegate::AsThemePreviewInfobarDelegate() { | |
| 82 return NULL; | |
| 83 } | |
| 84 | |
| 85 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() { | |
| 86 return NULL; | |
| 87 } | |
| 88 | |
| 89 void InfoBarDelegate::StoreActiveEntryUniqueID() { | |
| 90 contents_unique_id_ = infobar()->owner()->GetActiveEntryID(); | |
| 91 } | |
| 92 | |
| 93 gfx::Image InfoBarDelegate::GetIcon() const { | |
| 94 int icon_id = GetIconID(); | |
| 95 return (icon_id == kNoIconID) ? gfx::Image() : | |
| 96 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); | |
| 97 } | |
| 98 | |
| 99 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { | |
| 100 } | |
| 101 | |
| 102 bool InfoBarDelegate::ShouldExpireInternal( | |
| 103 const NavigationDetails& details) const { | |
| 104 // NOTE: If you change this, be sure to check and adjust the behavior of | |
| 105 // anyone who overrides this as necessary! | |
| 106 return (contents_unique_id_ != details.entry_id) || details.is_reload; | |
| 107 } | |
| OLD | NEW |