| 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_INFOBARS_INFOBAR_TAB_HELPER_H_ | |
| 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_TAB_HELPER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "chrome/browser/infobars/infobar_service.h" | |
| 12 #include "content/public/browser/notification_observer.h" | |
| 13 #include "content/public/browser/notification_registrar.h" | |
| 14 #include "content/public/browser/web_contents_observer.h" | |
| 15 #include "content/public/browser/web_contents_user_data.h" | |
| 16 | |
| 17 class InfoBarDelegate; | |
| 18 | |
| 19 // Per-tab info bar manager. | |
| 20 class InfoBarTabHelper : public InfoBarService, | |
| 21 public content::WebContentsObserver, | |
| 22 public content::NotificationObserver, | |
| 23 public content::WebContentsUserData<InfoBarTabHelper> { | |
| 24 private: | |
| 25 friend class content::WebContentsUserData<InfoBarTabHelper>; | |
| 26 | |
| 27 typedef std::vector<InfoBarDelegate*> InfoBars; | |
| 28 | |
| 29 explicit InfoBarTabHelper(content::WebContents* web_contents); | |
| 30 virtual ~InfoBarTabHelper(); | |
| 31 | |
| 32 // InfoBarService: | |
| 33 virtual void SetInfoBarsEnabled(bool enabled) OVERRIDE; | |
| 34 virtual InfoBarDelegate* AddInfoBar( | |
| 35 scoped_ptr<InfoBarDelegate> delegate) OVERRIDE; | |
| 36 virtual void RemoveInfoBar(InfoBarDelegate* delegate) OVERRIDE; | |
| 37 virtual InfoBarDelegate* ReplaceInfoBar( | |
| 38 InfoBarDelegate* old_delegate, | |
| 39 scoped_ptr<InfoBarDelegate> new_delegate) OVERRIDE; | |
| 40 virtual size_t GetInfoBarCount() const OVERRIDE; | |
| 41 virtual InfoBarDelegate* GetInfoBarDelegateAt(size_t index) OVERRIDE; | |
| 42 virtual content::WebContents* GetWebContents() OVERRIDE; | |
| 43 | |
| 44 // content::WebContentsObserver: | |
| 45 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | |
| 46 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 47 | |
| 48 // content::NotificationObserver: | |
| 49 virtual void Observe(int type, | |
| 50 const content::NotificationSource& source, | |
| 51 const content::NotificationDetails& details) OVERRIDE; | |
| 52 | |
| 53 void RemoveInfoBarInternal(InfoBarDelegate* delegate, bool animate); | |
| 54 void RemoveAllInfoBars(bool animate); | |
| 55 | |
| 56 // Message handlers. | |
| 57 void OnDidBlockDisplayingInsecureContent(); | |
| 58 void OnDidBlockRunningInsecureContent(); | |
| 59 | |
| 60 // Delegates for InfoBars associated with this InfoBarTabHelper. | |
| 61 InfoBars infobars_; | |
| 62 bool infobars_enabled_; | |
| 63 | |
| 64 content::NotificationRegistrar registrar_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(InfoBarTabHelper); | |
| 67 }; | |
| 68 | |
| 69 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_TAB_HELPER_H_ | |
| OLD | NEW |