OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 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_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ |
| 7 |
| 8 #include "chrome/common/notification_service.h" |
| 9 #include "chrome/views/view.h" |
| 10 |
| 11 class BrowserView; |
| 12 class InfoBarDelegate; |
| 13 class TabContents; |
| 14 |
| 15 // A views::View subclass that contains a collection of InfoBars associated with |
| 16 // a TabContents. |
| 17 class InfoBarContainer : public views::View, |
| 18 public NotificationObserver { |
| 19 public: |
| 20 explicit InfoBarContainer(BrowserView* browser_view); |
| 21 virtual ~InfoBarContainer(); |
| 22 |
| 23 // Changes the TabContents for which this container is showing InfoBars. Can |
| 24 // be NULL. |
| 25 void ChangeTabContents(TabContents* contents); |
| 26 |
| 27 // Called by child InfoBars as they animate. If |completed| is true, the |
| 28 // animation has finished running. |
| 29 void InfoBarAnimated(bool completed); |
| 30 |
| 31 // Remove the specified InfoBarDelegate from the selected TabContents. This |
| 32 // will notify us back and cause us to close the View. This is called from |
| 33 // the InfoBar's close button handler. |
| 34 void RemoveDelegate(InfoBarDelegate* delegate); |
| 35 |
| 36 // Overridden from views::View: |
| 37 virtual gfx::Size GetPreferredSize(); |
| 38 virtual void Layout(); |
| 39 protected: |
| 40 virtual void ViewHierarchyChanged(bool is_add, |
| 41 views::View* parent, |
| 42 views::View* child); |
| 43 |
| 44 private: |
| 45 // Overridden from NotificationObserver: |
| 46 virtual void Observe(NotificationType type, |
| 47 const NotificationSource& source, |
| 48 const NotificationDetails& details); |
| 49 |
| 50 // Constructs the InfoBars needed to reflect the state of the current |
| 51 // TabContents associated with this container. No animations are run during |
| 52 // this process. |
| 53 void UpdateInfoBars(); |
| 54 |
| 55 // Adds an InfoBar for the specified delegate, in response to a notification |
| 56 // from the selected TabContents. The InfoBar's appearance will be animated. |
| 57 void AddInfoBar(InfoBarDelegate* delegate); |
| 58 |
| 59 // Removes an InfoBar for the specified delegate, in response to a |
| 60 // notification from the selected TabContents. The InfoBar's disappearance |
| 61 // will be animated. |
| 62 void RemoveInfoBar(InfoBarDelegate* delegate); |
| 63 |
| 64 // The BrowserView that hosts this InfoBarContainer. |
| 65 BrowserView* browser_view_; |
| 66 |
| 67 // The TabContents for which we are currently showing InfoBars. |
| 68 TabContents* tab_contents_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); |
| 71 }; |
| 72 |
| 73 #endif // #ifndef CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ |
OLD | NEW |