OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_INFOBARS_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" |
11 | 11 |
12 class AutoLoginInfoBarDelegate; | 12 class AutoLoginInfoBarDelegate; |
13 class ConfirmInfoBarDelegate; | 13 class ConfirmInfoBarDelegate; |
14 class ExtensionInfoBarDelegate; | 14 class ExtensionInfoBarDelegate; |
15 class InfoBar; | 15 class InfoBar; |
16 class InsecureContentInfoBarDelegate; | 16 class InsecureContentInfoBarDelegate; |
17 class MediaStreamInfoBarDelegate; | 17 class MediaStreamInfoBarDelegate; |
18 class PopupBlockedInfoBarDelegate; | 18 class PopupBlockedInfoBarDelegate; |
19 class RegisterProtocolHandlerInfoBarDelegate; | 19 class RegisterProtocolHandlerInfoBarDelegate; |
20 class ScreenCaptureInfoBarDelegate; | 20 class ScreenCaptureInfoBarDelegate; |
21 class ThemeInstalledInfoBarDelegate; | 21 class ThemeInstalledInfoBarDelegate; |
22 class ThreeDAPIInfoBarDelegate; | 22 class ThreeDAPIInfoBarDelegate; |
23 class TranslateInfoBarDelegate; | 23 class TranslateInfoBarDelegate; |
24 | 24 |
25 namespace content { | |
26 class WebContents; | |
27 } | |
28 | |
29 namespace gfx { | 25 namespace gfx { |
30 class Image; | 26 class Image; |
31 } | 27 } |
32 | 28 |
33 // An interface implemented by objects wishing to control an InfoBar. | 29 // An interface implemented by objects wishing to control an InfoBar. |
34 // Implementing this interface is not sufficient to use an InfoBar, since it | 30 // Implementing this interface is not sufficient to use an InfoBar, since it |
35 // does not map to a specific InfoBar type. Instead, you must implement | 31 // does not map to a specific InfoBar type. Instead, you must implement |
36 // ConfirmInfoBarDelegate, or override with your own delegate for your own | 32 // ConfirmInfoBarDelegate, or override with your own delegate for your own |
37 // InfoBar variety. | 33 // InfoBar variety. |
38 class InfoBarDelegate { | 34 class InfoBarDelegate { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 114 |
119 // Store the unique id for the active entry in our WebContents, to be used | 115 // Store the unique id for the active entry in our WebContents, to be used |
120 // later upon navigation to determine if this InfoBarDelegate should be | 116 // later upon navigation to determine if this InfoBarDelegate should be |
121 // expired. | 117 // expired. |
122 void StoreActiveEntryUniqueID(); | 118 void StoreActiveEntryUniqueID(); |
123 | 119 |
124 // Return the icon to be shown for this InfoBar. If the returned Image is | 120 // Return the icon to be shown for this InfoBar. If the returned Image is |
125 // empty, no icon is shown. | 121 // empty, no icon is shown. |
126 virtual gfx::Image GetIcon() const; | 122 virtual gfx::Image GetIcon() const; |
127 | 123 |
128 // This trivial getter is defined out-of-line in order to avoid needing to | |
129 // #include infobar.h, which would lead to circular #includes. | |
130 // TODO(droger): Remove this function and have callers use | |
131 // InfoBarService::WebContentsFromInfoBar() instead. | |
132 content::WebContents* web_contents(); | |
133 | |
134 protected: | 124 protected: |
135 InfoBarDelegate(); | 125 InfoBarDelegate(); |
136 | 126 |
137 // Returns true if the navigation is to a new URL or a reload occured. | 127 // Returns true if the navigation is to a new URL or a reload occured. |
138 virtual bool ShouldExpireInternal(const NavigationDetails& details) const; | 128 virtual bool ShouldExpireInternal(const NavigationDetails& details) const; |
139 | 129 |
140 int contents_unique_id() const { return contents_unique_id_; } | 130 int contents_unique_id() const { return contents_unique_id_; } |
141 InfoBar* infobar() { return infobar_; } | 131 InfoBar* infobar() { return infobar_; } |
142 | 132 |
143 private: | 133 private: |
144 // The unique id of the active NavigationEntry of the WebContents that we were | 134 // The unique id of the active NavigationEntry of the WebContents that we were |
145 // opened for. Used to help expire on navigations. | 135 // opened for. Used to help expire on navigations. |
146 int contents_unique_id_; | 136 int contents_unique_id_; |
147 | 137 |
148 // The InfoBar associated with us. | 138 // The InfoBar associated with us. |
149 InfoBar* infobar_; | 139 InfoBar* infobar_; |
150 | 140 |
151 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); | 141 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); |
152 }; | 142 }; |
153 | 143 |
154 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ | 144 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_DELEGATE_H_ |
OLD | NEW |