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_API_INFOBARS_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_API_INFOBARS_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_API_INFOBARS_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_API_INFOBARS_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "webkit/glue/window_open_disposition.h" | 10 #include "webkit/glue/window_open_disposition.h" |
11 | 11 |
| 12 class AlternateNavInfoBarDelegate; |
12 class AutoLoginInfoBarDelegate; | 13 class AutoLoginInfoBarDelegate; |
13 class ConfirmInfoBarDelegate; | 14 class ConfirmInfoBarDelegate; |
14 class ExtensionInfoBarDelegate; | 15 class ExtensionInfoBarDelegate; |
15 class InfoBar; | 16 class InfoBar; |
16 class InfoBarService; | 17 class InfoBarService; |
17 class InsecureContentInfoBarDelegate; | 18 class InsecureContentInfoBarDelegate; |
18 class LinkInfoBarDelegate; | |
19 class MediaStreamInfoBarDelegate; | 19 class MediaStreamInfoBarDelegate; |
20 class PluginInstallerInfoBarDelegate; | 20 class PluginInstallerInfoBarDelegate; |
21 class RegisterProtocolHandlerInfoBarDelegate; | 21 class RegisterProtocolHandlerInfoBarDelegate; |
22 class SavePasswordInfoBarDelegate; | 22 class SavePasswordInfoBarDelegate; |
23 class ThemeInstalledInfoBarDelegate; | 23 class ThemeInstalledInfoBarDelegate; |
24 class ThreeDAPIInfoBarDelegate; | 24 class ThreeDAPIInfoBarDelegate; |
25 class TranslateInfoBarDelegate; | 25 class TranslateInfoBarDelegate; |
26 | 26 |
27 namespace gfx { | 27 namespace gfx { |
28 class Image; | 28 class Image; |
29 } | 29 } |
30 namespace content { | 30 namespace content { |
31 struct LoadCommittedDetails; | 31 struct LoadCommittedDetails; |
32 } | 32 } |
33 | 33 |
34 // An interface implemented by objects wishing to control an InfoBar. | 34 // An interface implemented by objects wishing to control an InfoBar. |
35 // Implementing this interface is not sufficient to use an InfoBar, since it | 35 // Implementing this interface is not sufficient to use an InfoBar, since it |
36 // does not map to a specific InfoBar type. Instead, you must implement either | 36 // does not map to a specific InfoBar type. Instead, you must implement |
37 // LinkInfoBarDelegate or ConfirmInfoBarDelegate, or override with your own | 37 // ConfirmInfoBarDelegate, or override with your own delegate for your own |
38 // delegate for your own InfoBar variety. | 38 // InfoBar variety. |
39 class InfoBarDelegate { | 39 class InfoBarDelegate { |
40 public: | 40 public: |
41 // The type of the infobar. It controls its appearance, such as its background | 41 // The type of the infobar. It controls its appearance, such as its background |
42 // color. | 42 // color. |
43 enum Type { | 43 enum Type { |
44 WARNING_TYPE, | 44 WARNING_TYPE, |
45 PAGE_ACTION_TYPE, | 45 PAGE_ACTION_TYPE, |
46 }; | 46 }; |
47 | 47 |
48 enum InfoBarAutomationType { | 48 enum InfoBarAutomationType { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // Return the icon to be shown for this InfoBar. If the returned Image is | 91 // Return the icon to be shown for this InfoBar. If the returned Image is |
92 // NULL, no icon is shown. | 92 // NULL, no icon is shown. |
93 virtual gfx::Image* GetIcon() const; | 93 virtual gfx::Image* GetIcon() const; |
94 | 94 |
95 // Returns the type of the infobar. The type determines the appearance (such | 95 // Returns the type of the infobar. The type determines the appearance (such |
96 // as background color) of the infobar. | 96 // as background color) of the infobar. |
97 virtual Type GetInfoBarType() const; | 97 virtual Type GetInfoBarType() const; |
98 | 98 |
99 // Type-checking downcast routines: | 99 // Type-checking downcast routines: |
| 100 virtual AlternateNavInfoBarDelegate* AsAlternateNavInfoBarDelegate(); |
100 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate(); | 101 virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate(); |
101 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate(); | 102 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate(); |
102 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate(); | 103 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate(); |
103 virtual InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate(); | 104 virtual InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate(); |
104 virtual LinkInfoBarDelegate* AsLinkInfoBarDelegate(); | |
105 virtual MediaStreamInfoBarDelegate* AsMediaStreamInfoBarDelegate(); | 105 virtual MediaStreamInfoBarDelegate* AsMediaStreamInfoBarDelegate(); |
106 virtual RegisterProtocolHandlerInfoBarDelegate* | 106 virtual RegisterProtocolHandlerInfoBarDelegate* |
107 AsRegisterProtocolHandlerInfoBarDelegate(); | 107 AsRegisterProtocolHandlerInfoBarDelegate(); |
108 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); | 108 virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); |
109 virtual ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate(); | 109 virtual ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate(); |
110 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate(); | 110 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate(); |
111 | 111 |
112 protected: | 112 protected: |
113 // If |contents| is non-NULL, its active entry's unique ID will be stored | 113 // If |contents| is non-NULL, its active entry's unique ID will be stored |
114 // using StoreActiveEntryUniqueID automatically. | 114 // using StoreActiveEntryUniqueID automatically. |
(...skipping 23 matching lines...) Expand all Loading... |
138 // opened for. Used to help expire on navigations. | 138 // opened for. Used to help expire on navigations. |
139 int contents_unique_id_; | 139 int contents_unique_id_; |
140 | 140 |
141 // TODO(pkasting): Remove. | 141 // TODO(pkasting): Remove. |
142 InfoBarService* owner_; | 142 InfoBarService* owner_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); | 144 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); |
145 }; | 145 }; |
146 | 146 |
147 #endif // CHROME_BROWSER_API_INFOBARS_INFOBAR_DELEGATE_H_ | 147 #endif // CHROME_BROWSER_API_INFOBARS_INFOBAR_DELEGATE_H_ |
OLD | NEW |