Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Side by Side Diff: components/infobars/core/infobar_delegate.h

Issue 922953002: Minor infobar cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_ 5 #ifndef COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_
6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_ 6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "ui/base/window_open_disposition.h" 10 #include "ui/base/window_open_disposition.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // Returns true if the InfoBar should be closed automatically after the page 89 // Returns true if the InfoBar should be closed automatically after the page
90 // is navigated. By default this returns true if the navigation is to a new 90 // is navigated. By default this returns true if the navigation is to a new
91 // page (not including reloads). Subclasses wishing to change this behavior 91 // page (not including reloads). Subclasses wishing to change this behavior
92 // can override either this function or ShouldExpireInternal(), depending on 92 // can override either this function or ShouldExpireInternal(), depending on
93 // what level of control they need. 93 // what level of control they need.
94 virtual bool ShouldExpire(const NavigationDetails& details) const; 94 virtual bool ShouldExpire(const NavigationDetails& details) const;
95 95
96 // Called when the user clicks on the close button to dismiss the infobar. 96 // Called when the user clicks on the close button to dismiss the infobar.
97 virtual void InfoBarDismissed(); 97 virtual void InfoBarDismissed();
98 98
99 // Return the resource ID of the icon to be shown for this InfoBar. If the
100 // value is equal to |kNoIconID|, no icon is shown.
101 virtual int GetIconID() const;
102
103 // Returns the type of the infobar. The type determines the appearance (such 99 // Returns the type of the infobar. The type determines the appearance (such
104 // as background color) of the infobar. 100 // as background color) of the infobar.
105 virtual Type GetInfoBarType() const; 101 virtual Type GetInfoBarType() const;
106 102
107 // Type-checking downcast routines: 103 // Type-checking downcast routines:
108 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate(); 104 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate();
109 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate(); 105 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate();
110 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate(); 106 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate();
111 virtual InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate(); 107 virtual InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate();
112 virtual MediaStreamInfoBarDelegate* AsMediaStreamInfoBarDelegate(); 108 virtual MediaStreamInfoBarDelegate* AsMediaStreamInfoBarDelegate();
113 virtual NativeAppInfoBarDelegate* AsNativeAppInfoBarDelegate(); 109 virtual NativeAppInfoBarDelegate* AsNativeAppInfoBarDelegate();
114 virtual PopupBlockedInfoBarDelegate* AsPopupBlockedInfoBarDelegate(); 110 virtual PopupBlockedInfoBarDelegate* AsPopupBlockedInfoBarDelegate();
115 virtual RegisterProtocolHandlerInfoBarDelegate* 111 virtual RegisterProtocolHandlerInfoBarDelegate*
116 AsRegisterProtocolHandlerInfoBarDelegate(); 112 AsRegisterProtocolHandlerInfoBarDelegate();
117 virtual ScreenCaptureInfoBarDelegate* AsScreenCaptureInfoBarDelegate(); 113 virtual ScreenCaptureInfoBarDelegate* AsScreenCaptureInfoBarDelegate();
118 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); 114 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate();
115 virtual ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate();
119 virtual translate::TranslateInfoBarDelegate* AsTranslateInfoBarDelegate(); 116 virtual translate::TranslateInfoBarDelegate* AsTranslateInfoBarDelegate();
120 117
121 void set_infobar(InfoBar* infobar) { infobar_ = infobar; } 118 void set_infobar(InfoBar* infobar) { infobar_ = infobar; }
122 119
123 // Store the unique id for the active entry, to be used later upon navigation 120 // Store the unique id for the active entry, to be used later upon navigation
124 // to determine if this InfoBarDelegate should be expired. 121 // to determine if this InfoBarDelegate should be expired.
125 void StoreActiveEntryUniqueID(); 122 void StoreActiveEntryUniqueID();
126 123
127 // Return the icon to be shown for this InfoBar. If the returned Image is 124 // Return the icon to be shown for this InfoBar. If the returned Image is
128 // empty, no icon is shown. 125 // empty, no icon is shown.
129 virtual gfx::Image GetIcon() const; 126 gfx::Image GetIcon() const;
130 127
131 protected: 128 protected:
132 InfoBarDelegate(); 129 InfoBarDelegate();
133 130
134 // Returns true if the navigation is to a new URL or a reload occured. 131 // Returns true if the navigation is to a new URL or a reload occured.
135 virtual bool ShouldExpireInternal(const NavigationDetails& details) const; 132 virtual bool ShouldExpireInternal(const NavigationDetails& details) const;
136 133
137 int contents_unique_id() const { return contents_unique_id_; } 134 int contents_unique_id() const { return contents_unique_id_; }
138 InfoBar* infobar() { return infobar_; } 135 InfoBar* infobar() { return infobar_; }
139 136
140 private: 137 private:
138 // Return the resource ID of the icon to be shown for this InfoBar. If the
139 // value is equal to |kNoIconID|, no icon is shown.
140 virtual int GetIconID() const;
141
141 // The unique id of the active NavigationEntry of the WebContents that we were 142 // The unique id of the active NavigationEntry of the WebContents that we were
142 // opened for. Used to help expire on navigations. 143 // opened for. Used to help expire on navigations.
143 int contents_unique_id_; 144 int contents_unique_id_;
144 145
145 // The InfoBar associated with us. 146 // The InfoBar associated with us.
146 InfoBar* infobar_; 147 InfoBar* infobar_;
147 148
148 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); 149 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate);
149 }; 150 };
150 151
151 } // namespace infobars 152 } // namespace infobars
152 153
153 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_ 154 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698