Stack sampling profiler: add fire-and-forget interface
[chromium-blink-merge.git] / components / infobars / core / infobar_delegate.cc
blobde0ae136096213a5f6f28b0751533628a7dfce21
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 return details.is_navigation_to_different_page &&
45 !details.did_replace_entry &&
46 // This next condition ensures a navigation that passes the above
47 // conditions doesn't dismiss infobars added while that navigation was
48 // already in process. We carve out an exception for reloads since we
49 // want reloads to dismiss infobars, but they will have unchanged entry
50 // IDs.
51 ((nav_entry_id_ != details.entry_id) || details.is_reload);
54 void InfoBarDelegate::InfoBarDismissed() {
57 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() {
58 return nullptr;
61 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() {
62 return nullptr;
65 InsecureContentInfoBarDelegate*
66 InfoBarDelegate::AsInsecureContentInfoBarDelegate() {
67 return nullptr;
70 MediaStreamInfoBarDelegate* InfoBarDelegate::AsMediaStreamInfoBarDelegate() {
71 return nullptr;
74 NativeAppInfoBarDelegate* InfoBarDelegate::AsNativeAppInfoBarDelegate() {
75 return nullptr;
78 PermissionInfobarDelegate* InfoBarDelegate::AsPermissionInfobarDelegate() {
79 return nullptr;
82 PopupBlockedInfoBarDelegate* InfoBarDelegate::AsPopupBlockedInfoBarDelegate() {
83 return nullptr;
86 RegisterProtocolHandlerInfoBarDelegate*
87 InfoBarDelegate::AsRegisterProtocolHandlerInfoBarDelegate() {
88 return nullptr;
91 ScreenCaptureInfoBarDelegate*
92 InfoBarDelegate::AsScreenCaptureInfoBarDelegate() {
93 return nullptr;
96 ThemeInstalledInfoBarDelegate*
97 InfoBarDelegate::AsThemePreviewInfobarDelegate() {
98 return nullptr;
101 ThreeDAPIInfoBarDelegate* InfoBarDelegate::AsThreeDAPIInfoBarDelegate() {
102 return nullptr;
105 translate::TranslateInfoBarDelegate*
106 InfoBarDelegate::AsTranslateInfoBarDelegate() {
107 return nullptr;
110 InfoBarDelegate::InfoBarDelegate() : nav_entry_id_(0) {
113 } // namespace infobars