Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / components / infobars / core / infobar_delegate.cc
blob84cd0e1015289851931785a27263b3765241c816
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
3 // found in the LICENSE file.
5 #include "components/infobars/core/infobar_delegate.h"
7 #include "base/logging.h"
8 #include "build/build_config.h"
9 #include "components/infobars/core/infobar.h"
10 #include "components/infobars/core/infobar_manager.h"
11 #include "ui/base/resource/resource_bundle.h"
13 namespace infobars {
15 const int InfoBarDelegate::kNoIconID = 0;
17 InfoBarDelegate::~InfoBarDelegate() {
20 InfoBarDelegate::InfoBarAutomationType
21 InfoBarDelegate::GetInfoBarAutomationType() const {
22 return UNKNOWN_INFOBAR;
25 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const {
26 return WARNING_TYPE;
29 int InfoBarDelegate::GetIconID() const {
30 return kNoIconID;
33 gfx::Image InfoBarDelegate::GetIcon() const {
34 int icon_id = GetIconID();
35 return (icon_id == kNoIconID) ? gfx::Image() :
36 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id);
39 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
40 return false;
43 bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const {
44 if (!details.is_navigation_to_different_page)
45 return false;
47 return ShouldExpireInternal(details);
50 void InfoBarDelegate::InfoBarDismissed() {
53 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() {
54 return nullptr;
57 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() {
58 return nullptr;
61 InsecureContentInfoBarDelegate*
62 InfoBarDelegate::AsInsecureContentInfoBarDelegate() {
63 return nullptr;
66 MediaStreamInfoBarDelegate* InfoBarDelegate::AsMediaStreamInfoBarDelegate() {
67 return nullptr;
70 NativeAppInfoBarDelegate* InfoBarDelegate::AsNativeAppInfoBarDelegate() {
71 return nullptr;
74 PopupBlockedInfoBarDelegate* InfoBarDelegate::AsPopupBlockedInfoBarDelegate() {
75 return nullptr;
78 RegisterProtocolHandlerInfoBarDelegate*
79 InfoBarDelegate::AsRegisterProtocolHandlerInfoBarDelegate() {
80 return nullptr;
83 ScreenCaptureInfoBarDelegate*
84 InfoBarDelegate::AsScreenCaptureInfoBarDelegate() {
85 return nullptr;
88 ThemeInstalledInfoBarDelegate*
89 InfoBarDelegate::AsThemePreviewInfobarDelegate() {
90 return nullptr;
93 ThreeDAPIInfoBarDelegate* InfoBarDelegate::AsThreeDAPIInfoBarDelegate() {
94 return nullptr;
97 translate::TranslateInfoBarDelegate*
98 InfoBarDelegate::AsTranslateInfoBarDelegate() {
99 return nullptr;
102 void InfoBarDelegate::StoreActiveEntryUniqueID() {
103 contents_unique_id_ = infobar()->owner()->GetActiveEntryID();
106 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) {
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;
116 } // namespace infobars