OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_API_INFOBARS_INFOBAR_TAB_SERVICE_H_ | |
6 #define CHROME_BROWSER_API_INFOBARS_INFOBAR_TAB_SERVICE_H_ | |
7 | |
8 namespace content { | |
9 class WebContents; | |
10 } | |
11 | |
12 class InfoBarDelegate; | |
13 class TabContents; | |
14 | |
15 // Provides access to creating, removing and enumerating info bars | |
16 // attached to a tab. | |
17 class InfoBarTabService { | |
18 public: | |
19 // Retrieves the InfoBarTabService for a given tab. | |
20 static InfoBarTabService* GetInstance(TabContents* tab_contents); | |
tfarina
2012/08/16 12:14:35
According to crbug.com/68682 static methods should
Jói
2012/08/16 12:23:33
Thanks, putting them at the top like this, at leas
erikwright (departed)
2012/08/16 17:25:38
My comments elsewhere apply here. I don't think th
Jói
2012/08/17 15:51:24
As per discussion summarized in http://codereview.
| |
21 | |
22 virtual ~InfoBarTabService() {} | |
23 | |
24 // Adds an InfoBar for the specified |delegate|. | |
25 // | |
26 // If infobars are disabled for this tab or the tab already has a delegate | |
27 // which returns true for InfoBarDelegate::EqualsDelegate(delegate), | |
28 // |delegate| is closed immediately without being added. | |
29 // | |
30 // Returns whether |delegate| was successfully added. | |
31 virtual bool AddInfoBar(InfoBarDelegate* delegate) = 0; | |
32 | |
33 // Removes the InfoBar for the specified |delegate|. | |
34 // | |
35 // If infobars are disabled for this tab, this will do nothing, on the | |
36 // assumption that the matching AddInfoBar() call will have already closed the | |
37 // delegate (see above). | |
38 virtual void RemoveInfoBar(InfoBarDelegate* delegate) = 0; | |
39 | |
40 // Replaces one infobar with another, without any animation in between. | |
41 // | |
42 // If infobars are disabled for this tab, |new_delegate| is closed immediately | |
43 // without being added, and nothing else happens. | |
44 // | |
45 // Returns whether |new_delegate| was successfully added. | |
46 // | |
47 // NOTE: This does not perform any EqualsDelegate() checks like AddInfoBar(). | |
48 virtual bool ReplaceInfoBar(InfoBarDelegate* old_delegate, | |
49 InfoBarDelegate* new_delegate) = 0; | |
50 | |
51 // Returns the number of infobars for this tab. | |
52 virtual size_t GetInfoBarCount() const = 0; | |
53 | |
54 // Returns the infobar at the given |index|. | |
55 // | |
56 // Warning: Does not sanity check |index|. | |
57 virtual InfoBarDelegate* GetInfoBarDelegateAt(size_t index) = 0; | |
58 | |
59 // Retrieve the WebContents for the tab this service is associated with. | |
60 virtual content::WebContents* GetWebContents() = 0; | |
61 }; | |
62 | |
63 #endif // CHROME_BROWSER_API_INFOBARS_INFOBAR_TAB_SERVICE_H_ | |
OLD | NEW |