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_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_INFOBARS_INFOBAR_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_TAB_HELPER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/browser/api/infobars/infobar_tab_service.h" | 9 #include "chrome/browser/api/infobars/infobar_service.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
13 | 13 |
14 class InfoBarDelegate; | 14 class InfoBarDelegate; |
15 | 15 |
16 // Per-tab info bar manager. | 16 // Per-tab info bar manager. |
17 class InfoBarTabHelper : public InfoBarTabService, | 17 class InfoBarTabHelper : public InfoBarService, |
18 public content::WebContentsObserver, | 18 public content::WebContentsObserver, |
19 public content::NotificationObserver { | 19 public content::NotificationObserver { |
20 public: | 20 public: |
21 explicit InfoBarTabHelper(content::WebContents* web_contents); | 21 explicit InfoBarTabHelper(content::WebContents* web_contents); |
22 virtual ~InfoBarTabHelper(); | 22 virtual ~InfoBarTabHelper(); |
23 | 23 |
24 // InfoBarTabService implementation. | 24 // InfoBarService implementation. |
25 virtual bool AddInfoBar(InfoBarDelegate* delegate) OVERRIDE; | 25 virtual bool AddInfoBar(InfoBarDelegate* delegate) OVERRIDE; |
26 virtual void RemoveInfoBar(InfoBarDelegate* delegate) OVERRIDE; | 26 virtual void RemoveInfoBar(InfoBarDelegate* delegate) OVERRIDE; |
27 virtual bool ReplaceInfoBar(InfoBarDelegate* old_delegate, | 27 virtual bool ReplaceInfoBar(InfoBarDelegate* old_delegate, |
28 InfoBarDelegate* new_delegate) OVERRIDE; | 28 InfoBarDelegate* new_delegate) OVERRIDE; |
29 virtual size_t GetInfoBarCount() const OVERRIDE; | 29 virtual size_t GetInfoBarCount() const OVERRIDE; |
30 virtual InfoBarDelegate* GetInfoBarDelegateAt(size_t index) OVERRIDE; | 30 virtual InfoBarDelegate* GetInfoBarDelegateAt(size_t index) OVERRIDE; |
31 virtual content::WebContents* GetWebContents() OVERRIDE; | 31 virtual content::WebContents* GetWebContents() OVERRIDE; |
32 | 32 |
33 // Enables or disables infobars for the given tab. | 33 // Enables or disables infobars for the given tab. |
34 void set_infobars_enabled(bool value) { infobars_enabled_ = value; } | 34 void set_infobars_enabled(bool value) { infobars_enabled_ = value; } |
(...skipping 20 matching lines...) Expand all Loading... |
55 // Delegates for InfoBars associated with this InfoBarTabHelper. | 55 // Delegates for InfoBars associated with this InfoBarTabHelper. |
56 InfoBars infobars_; | 56 InfoBars infobars_; |
57 bool infobars_enabled_; | 57 bool infobars_enabled_; |
58 | 58 |
59 content::NotificationRegistrar registrar_; | 59 content::NotificationRegistrar registrar_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(InfoBarTabHelper); | 61 DISALLOW_COPY_AND_ASSIGN(InfoBarTabHelper); |
62 }; | 62 }; |
63 | 63 |
64 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_TAB_HELPER_H_ | 64 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_TAB_HELPER_H_ |
OLD | NEW |