OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TAB_CONTENTS_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "content/browser/tab_contents/navigation_controller.h" | 11 #include "content/browser/tab_contents/navigation_controller.h" |
12 #include "webkit/glue/window_open_disposition.h" | 12 #include "webkit/glue/window_open_disposition.h" |
13 | 13 |
14 class ConfirmInfoBarDelegate; | 14 class ConfirmInfoBarDelegate; |
15 class ExtensionInfoBarDelegate; | 15 class ExtensionInfoBarDelegate; |
16 class InfoBar; | 16 class InfoBar; |
17 class LinkInfoBarDelegate; | 17 class LinkInfoBarDelegate; |
18 class PluginInstallerInfoBarDelegate; | 18 class PluginInstallerInfoBarDelegate; |
| 19 class TabContents; |
19 class ThemeInstalledInfoBarDelegate; | 20 class ThemeInstalledInfoBarDelegate; |
20 class TranslateInfoBarDelegate; | 21 class TranslateInfoBarDelegate; |
21 | 22 |
22 namespace gfx { | 23 namespace gfx { |
23 class Image; | 24 class Image; |
24 } | 25 } |
25 | 26 |
26 // An interface implemented by objects wishing to control an InfoBar. | 27 // An interface implemented by objects wishing to control an InfoBar. |
27 // Implementing this interface is not sufficient to use an InfoBar, since it | 28 // Implementing this interface is not sufficient to use an InfoBar, since it |
28 // does not map to a specific InfoBar type. Instead, you must implement either | 29 // does not map to a specific InfoBar type. Instead, you must implement either |
29 // LinkInfoBarDelegate or ConfirmInfoBarDelegate, or override with your own | 30 // LinkInfoBarDelegate or ConfirmInfoBarDelegate, or override with your own |
30 // delegate for your own InfoBar variety. | 31 // delegate for your own InfoBar variety. |
31 class InfoBarDelegate { | 32 class InfoBarDelegate { |
32 public: | 33 public: |
33 // The type of the infobar. It controls its appearance, such as its background | 34 // The type of the infobar. It controls its appearance, such as its background |
34 // color. | 35 // color. |
35 enum Type { | 36 enum Type { |
36 WARNING_TYPE, | 37 WARNING_TYPE, |
37 PAGE_ACTION_TYPE, | 38 PAGE_ACTION_TYPE, |
38 }; | 39 }; |
39 | 40 |
40 virtual ~InfoBarDelegate(); | 41 virtual ~InfoBarDelegate(); |
41 | 42 |
42 // Called to create the InfoBar. Implementation of this method is | 43 // Called to create the InfoBar. Implementation of this method is |
43 // platform-specific. | 44 // platform-specific. |
44 virtual InfoBar* CreateInfoBar() = 0; | 45 virtual InfoBar* CreateInfoBar(TabContents* owner) = 0; |
45 | 46 |
46 // Returns true if the supplied |delegate| is equal to this one. Equality is | 47 // Returns true if the supplied |delegate| is equal to this one. Equality is |
47 // left to the implementation to define. This function is called by the | 48 // left to the implementation to define. This function is called by the |
48 // TabContents when determining whether or not a delegate should be added | 49 // TabContents when determining whether or not a delegate should be added |
49 // because a matching one already exists. If this function returns true, the | 50 // because a matching one already exists. If this function returns true, the |
50 // TabContents will not add the new delegate because it considers one to | 51 // TabContents will not add the new delegate because it considers one to |
51 // already be present. | 52 // already be present. |
52 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; | 53 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; |
53 | 54 |
54 // Returns true if the InfoBar should be closed automatically after the page | 55 // Returns true if the InfoBar should be closed automatically after the page |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 94 |
94 private: | 95 private: |
95 // The unique id of the active NavigationEntry of the TabContents that we were | 96 // The unique id of the active NavigationEntry of the TabContents that we were |
96 // opened for. Used to help expire on navigations. | 97 // opened for. Used to help expire on navigations. |
97 int contents_unique_id_; | 98 int contents_unique_id_; |
98 | 99 |
99 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); | 100 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); |
100 }; | 101 }; |
101 | 102 |
102 #endif // CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ | 103 #endif // CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ |
OLD | NEW |