OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_INFOBARS_CORE_INFOBAR_CONTAINER_H_ | 5 #ifndef COMPONENTS_INFOBARS_CORE_INFOBAR_CONTAINER_H_ |
6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_CONTAINER_H_ | 6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_CONTAINER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // GTK does. | 95 // GTK does. |
96 virtual void PlatformSpecificReplaceInfoBar(InfoBar* old_infobar, | 96 virtual void PlatformSpecificReplaceInfoBar(InfoBar* old_infobar, |
97 InfoBar* new_infobar) {} | 97 InfoBar* new_infobar) {} |
98 virtual void PlatformSpecificRemoveInfoBar(InfoBar* infobar) = 0; | 98 virtual void PlatformSpecificRemoveInfoBar(InfoBar* infobar) = 0; |
99 virtual void PlatformSpecificInfoBarStateChanged(bool is_animating) {} | 99 virtual void PlatformSpecificInfoBarStateChanged(bool is_animating) {} |
100 | 100 |
101 private: | 101 private: |
102 typedef std::vector<InfoBar*> InfoBars; | 102 typedef std::vector<InfoBar*> InfoBars; |
103 | 103 |
104 // InfoBarManager::Observer: | 104 // InfoBarManager::Observer: |
105 virtual void OnInfoBarAdded(InfoBar* infobar) OVERRIDE; | 105 virtual void OnInfoBarAdded(InfoBar* infobar) override; |
106 virtual void OnInfoBarRemoved(InfoBar* infobar, bool animate) OVERRIDE; | 106 virtual void OnInfoBarRemoved(InfoBar* infobar, bool animate) override; |
107 virtual void OnInfoBarReplaced(InfoBar* old_infobar, | 107 virtual void OnInfoBarReplaced(InfoBar* old_infobar, |
108 InfoBar* new_infobar) OVERRIDE; | 108 InfoBar* new_infobar) override; |
109 virtual void OnManagerShuttingDown(InfoBarManager* manager) OVERRIDE; | 109 virtual void OnManagerShuttingDown(InfoBarManager* manager) override; |
110 | 110 |
111 // Adds |infobar| to this container before the existing infobar at position | 111 // Adds |infobar| to this container before the existing infobar at position |
112 // |position| and calls Show() on it. |animate| is passed along to | 112 // |position| and calls Show() on it. |animate| is passed along to |
113 // infobar->Show(). Depending on the value of |callback_status|, this calls | 113 // infobar->Show(). Depending on the value of |callback_status|, this calls |
114 // infobar->set_container(this) either before or after the call to Show() so | 114 // infobar->set_container(this) either before or after the call to Show() so |
115 // that OnInfoBarStateChanged() either will or won't be called as a result. | 115 // that OnInfoBarStateChanged() either will or won't be called as a result. |
116 enum CallbackStatus { NO_CALLBACK, WANT_CALLBACK }; | 116 enum CallbackStatus { NO_CALLBACK, WANT_CALLBACK }; |
117 void AddInfoBar(InfoBar* infobar, | 117 void AddInfoBar(InfoBar* infobar, |
118 size_t position, | 118 size_t position, |
119 bool animate, | 119 bool animate, |
120 CallbackStatus callback_status); | 120 CallbackStatus callback_status); |
121 | 121 |
122 void UpdateInfoBarArrowTargetHeights(); | 122 void UpdateInfoBarArrowTargetHeights(); |
123 int ArrowTargetHeightForInfoBar(size_t infobar_index) const; | 123 int ArrowTargetHeightForInfoBar(size_t infobar_index) const; |
124 | 124 |
125 Delegate* delegate_; | 125 Delegate* delegate_; |
126 InfoBarManager* infobar_manager_; | 126 InfoBarManager* infobar_manager_; |
127 InfoBars infobars_; | 127 InfoBars infobars_; |
128 | 128 |
129 // Calculated in SetMaxTopArrowHeight(). | 129 // Calculated in SetMaxTopArrowHeight(). |
130 int top_arrow_target_height_; | 130 int top_arrow_target_height_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); | 132 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); |
133 }; | 133 }; |
134 | 134 |
135 } // namespace infobars | 135 } // namespace infobars |
136 | 136 |
137 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_CONTAINER_H_ | 137 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_CONTAINER_H_ |
OLD | NEW |