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 void OnInfoBarAdded(InfoBar* infobar) override; |
106 virtual void OnInfoBarRemoved(InfoBar* infobar, bool animate) override; | 106 void OnInfoBarRemoved(InfoBar* infobar, bool animate) override; |
107 virtual void OnInfoBarReplaced(InfoBar* old_infobar, | 107 void OnInfoBarReplaced(InfoBar* old_infobar, InfoBar* new_infobar) override; |
108 InfoBar* new_infobar) override; | 108 void OnManagerShuttingDown(InfoBarManager* manager) override; |
109 virtual void OnManagerShuttingDown(InfoBarManager* manager) override; | |
110 | 109 |
111 // Adds |infobar| to this container before the existing infobar at position | 110 // Adds |infobar| to this container before the existing infobar at position |
112 // |position| and calls Show() on it. |animate| is passed along to | 111 // |position| and calls Show() on it. |animate| is passed along to |
113 // infobar->Show(). Depending on the value of |callback_status|, this calls | 112 // 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 | 113 // 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. | 114 // that OnInfoBarStateChanged() either will or won't be called as a result. |
116 enum CallbackStatus { NO_CALLBACK, WANT_CALLBACK }; | 115 enum CallbackStatus { NO_CALLBACK, WANT_CALLBACK }; |
117 void AddInfoBar(InfoBar* infobar, | 116 void AddInfoBar(InfoBar* infobar, |
118 size_t position, | 117 size_t position, |
119 bool animate, | 118 bool animate, |
120 CallbackStatus callback_status); | 119 CallbackStatus callback_status); |
121 | 120 |
122 void UpdateInfoBarArrowTargetHeights(); | 121 void UpdateInfoBarArrowTargetHeights(); |
123 int ArrowTargetHeightForInfoBar(size_t infobar_index) const; | 122 int ArrowTargetHeightForInfoBar(size_t infobar_index) const; |
124 | 123 |
125 Delegate* delegate_; | 124 Delegate* delegate_; |
126 InfoBarManager* infobar_manager_; | 125 InfoBarManager* infobar_manager_; |
127 InfoBars infobars_; | 126 InfoBars infobars_; |
128 | 127 |
129 // Calculated in SetMaxTopArrowHeight(). | 128 // Calculated in SetMaxTopArrowHeight(). |
130 int top_arrow_target_height_; | 129 int top_arrow_target_height_; |
131 | 130 |
132 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); | 131 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); |
133 }; | 132 }; |
134 | 133 |
135 } // namespace infobars | 134 } // namespace infobars |
136 | 135 |
137 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_CONTAINER_H_ | 136 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_CONTAINER_H_ |
OLD | NEW |