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_TAB_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_API_INFOBARS_INFOBAR_SERVICE_H_ |
6 #define CHROME_BROWSER_API_INFOBARS_INFOBAR_TAB_SERVICE_H_ | 6 #define CHROME_BROWSER_API_INFOBARS_INFOBAR_SERVICE_H_ |
7 | 7 |
8 namespace content { | 8 namespace content { |
9 class WebContents; | 9 class WebContents; |
10 } | 10 } |
11 | 11 |
12 class InfoBarDelegate; | 12 class InfoBarDelegate; |
13 class TabContents; | 13 class TabContents; |
14 | 14 |
15 // Provides access to creating, removing and enumerating info bars | 15 // Provides access to creating, removing and enumerating info bars |
16 // attached to a tab. | 16 // attached to a tab. |
17 class InfoBarTabService { | 17 class InfoBarService { |
18 public: | 18 public: |
19 // Retrieves the InfoBarTabService for a given tab. | 19 // Retrieves the InfoBarService for a given tab. |
20 static InfoBarTabService* ForTab(TabContents* tab_contents); | 20 static InfoBarService* ForTab(TabContents* tab_contents); |
21 | 21 |
22 virtual ~InfoBarTabService() {} | 22 virtual ~InfoBarService() {} |
23 | 23 |
24 // Adds an InfoBar for the specified |delegate|. | 24 // Adds an InfoBar for the specified |delegate|. |
25 // | 25 // |
26 // If infobars are disabled for this tab or the tab already has a delegate | 26 // If infobars are disabled for this tab or the tab already has a delegate |
27 // which returns true for InfoBarDelegate::EqualsDelegate(delegate), | 27 // which returns true for InfoBarDelegate::EqualsDelegate(delegate), |
28 // |delegate| is closed immediately without being added. | 28 // |delegate| is closed immediately without being added. |
29 // | 29 // |
30 // Returns whether |delegate| was successfully added. | 30 // Returns whether |delegate| was successfully added. |
31 virtual bool AddInfoBar(InfoBarDelegate* delegate) = 0; | 31 virtual bool AddInfoBar(InfoBarDelegate* delegate) = 0; |
32 | 32 |
(...skipping 20 matching lines...) Expand all Loading... |
53 | 53 |
54 // Returns the infobar at the given |index|. | 54 // Returns the infobar at the given |index|. |
55 // | 55 // |
56 // Warning: Does not sanity check |index|. | 56 // Warning: Does not sanity check |index|. |
57 virtual InfoBarDelegate* GetInfoBarDelegateAt(size_t index) = 0; | 57 virtual InfoBarDelegate* GetInfoBarDelegateAt(size_t index) = 0; |
58 | 58 |
59 // Retrieve the WebContents for the tab this service is associated with. | 59 // Retrieve the WebContents for the tab this service is associated with. |
60 virtual content::WebContents* GetWebContents() = 0; | 60 virtual content::WebContents* GetWebContents() = 0; |
61 }; | 61 }; |
62 | 62 |
63 #endif // CHROME_BROWSER_API_INFOBARS_INFOBAR_TAB_SERVICE_H_ | 63 #endif // CHROME_BROWSER_API_INFOBARS_INFOBAR_SERVICE_H_ |
OLD | NEW |