| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 public: | 30 public: |
| 31 virtual void InfoBarContainerSizeChanged(bool is_animating) = 0; | 31 virtual void InfoBarContainerSizeChanged(bool is_animating) = 0; |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 virtual ~Delegate(); | 34 virtual ~Delegate(); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 explicit InfoBarContainer(Delegate* delegate); | 37 explicit InfoBarContainer(Delegate* delegate); |
| 38 virtual ~InfoBarContainer(); | 38 virtual ~InfoBarContainer(); |
| 39 | 39 |
| 40 // Overlap the previous view by this amount, vertically, so that the |
| 41 // first InfoBarView in this InfoBarContainer may draw its tab on |
| 42 // top. |
| 43 int VerticalOverlap(); |
| 44 |
| 40 // Changes the TabContents for which this container is showing infobars. This | 45 // Changes the TabContents for which this container is showing infobars. This |
| 41 // will remove all current infobars from the container, add the infobars from | 46 // will remove all current infobars from the container, add the infobars from |
| 42 // |contents|, and show them all. |contents| may be NULL. | 47 // |contents|, and show them all. |contents| may be NULL. |
| 43 void ChangeTabContents(TabContents* contents); | 48 void ChangeTabContents(TabContents* contents); |
| 44 | 49 |
| 45 // Called when a contained infobar has animated. The container is expected to | 50 // Called when a contained infobar has animated. The container is expected to |
| 46 // do anything necessary to respond to the infobar's possible size change, | 51 // do anything necessary to respond to the infobar's possible size change, |
| 47 // e.g. re-layout. | 52 // e.g. re-layout. |
| 48 void OnInfoBarAnimated(bool done); | 53 void OnInfoBarAnimated(bool done); |
| 49 | 54 |
| 50 // Remove the specified InfoBarDelegate from the selected TabContents. This | 55 // Remove the specified InfoBarDelegate from the selected TabContents. This |
| 51 // will notify us back and cause us to close the InfoBar. This is called from | 56 // will notify us back and cause us to close the InfoBar. This is called from |
| 52 // the InfoBar's close button handler. | 57 // the InfoBar's close button handler. |
| 53 void RemoveDelegate(InfoBarDelegate* delegate); | 58 void RemoveDelegate(InfoBarDelegate* delegate); |
| 54 | 59 |
| 55 // Called by |infobar| to request that it be removed from the container, as it | 60 // Called by |infobar| to request that it be removed from the container, as it |
| 56 // is about to delete itself. At this point, |infobar| should already be | 61 // is about to delete itself. At this point, |infobar| should already be |
| 57 // hidden. | 62 // hidden. |
| 58 void RemoveInfoBar(InfoBarView* infobar); | 63 void RemoveInfoBar(InfoBarView* infobar); |
| 59 | 64 |
| 60 // Paint the InfoBar arrows on |canvas|. |arrow_center_x| indicates | |
| 61 // the desired location of the center of the arrow in the | |
| 62 // |outer_view| coordinate system. | |
| 63 void PaintInfoBarArrows(gfx::Canvas* canvas, | |
| 64 View* outer_view, | |
| 65 int arrow_center_x); | |
| 66 | |
| 67 private: | 65 private: |
| 68 typedef std::set<InfoBarView*> InfoBars; | 66 typedef std::set<InfoBarView*> InfoBars; |
| 69 | 67 |
| 70 // AccessiblePaneView: | 68 // AccessiblePaneView: |
| 71 virtual gfx::Size GetPreferredSize(); | 69 virtual gfx::Size GetPreferredSize(); |
| 72 virtual void Layout(); | 70 virtual void Layout(); |
| 73 virtual AccessibilityTypes::Role GetAccessibleRole(); | 71 virtual AccessibilityTypes::Role GetAccessibleRole(); |
| 74 | 72 |
| 75 // NotificationObserver: | 73 // NotificationObserver: |
| 76 virtual void Observe(NotificationType type, | 74 virtual void Observe(NotificationType type, |
| 77 const NotificationSource& source, | 75 const NotificationSource& source, |
| 78 const NotificationDetails& details); | 76 const NotificationDetails& details); |
| 79 | 77 |
| 78 // Return the maximum vertical overlap of the InfoBarContainer's children, |
| 79 // and, when |total_height| is non-NULL, set the |*total_height| of the |
| 80 // InfoBarContainer. |
| 81 int GetVerticalOverlap(int* total_height); |
| 82 |
| 80 // Removes an InfoBar for the specified delegate, in response to a | 83 // Removes an InfoBar for the specified delegate, in response to a |
| 81 // notification from the selected TabContents. The InfoBar's disappearance | 84 // notification from the selected TabContents. The InfoBar's disappearance |
| 82 // will be animated if |use_animation| is true. | 85 // will be animated if |use_animation| is true. |
| 83 void RemoveInfoBar(InfoBarDelegate* delegate, bool use_animation); | 86 void RemoveInfoBar(InfoBarDelegate* delegate, bool use_animation); |
| 84 | 87 |
| 85 // Adds |infobar| to this container and calls Show() on it. |animate| is | 88 // Adds |infobar| to this container and calls Show() on it. |animate| is |
| 86 // passed along to infobar->Show(). Depending on the value of | 89 // passed along to infobar->Show(). Depending on the value of |
| 87 // |callback_status|, this calls infobar->set_container(this) either before or | 90 // |callback_status|, this calls infobar->set_container(this) either before or |
| 88 // after the call to Show() so that OnInfoBarAnimated() either will or won't | 91 // after the call to Show() so that OnInfoBarAnimated() either will or won't |
| 89 // be called as a result. | 92 // be called as a result. |
| 90 enum CallbackStatus { NO_CALLBACK, WANT_CALLBACK }; | 93 enum CallbackStatus { NO_CALLBACK, WANT_CALLBACK }; |
| 91 void AddInfoBar(InfoBar* infobar, | 94 void AddInfoBar(InfoBar* infobar, |
| 92 bool animate, | 95 bool animate, |
| 93 CallbackStatus callback_status); | 96 CallbackStatus callback_status); |
| 94 | 97 |
| 95 NotificationRegistrar registrar_; | 98 NotificationRegistrar registrar_; |
| 96 Delegate* delegate_; | 99 Delegate* delegate_; |
| 97 TabContents* tab_contents_; | 100 TabContents* tab_contents_; |
| 98 InfoBars infobars_; | 101 InfoBars infobars_; |
| 99 | 102 |
| 100 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); | 103 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); |
| 101 }; | 104 }; |
| 102 | 105 |
| 103 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ | 106 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ |
| OLD | NEW |