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_H_ | 5 #ifndef COMPONENTS_INFOBARS_CORE_INFOBAR_H_ |
6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_H_ | 6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void SetBarTargetHeight(int height); | 91 void SetBarTargetHeight(int height); |
92 | 92 |
93 const gfx::SlideAnimation& animation() const { return animation_; } | 93 const gfx::SlideAnimation& animation() const { return animation_; } |
94 int arrow_height() const { return arrow_height_; } | 94 int arrow_height() const { return arrow_height_; } |
95 int arrow_target_height() const { return arrow_target_height_; } | 95 int arrow_target_height() const { return arrow_target_height_; } |
96 int arrow_half_width() const { return arrow_half_width_; } | 96 int arrow_half_width() const { return arrow_half_width_; } |
97 int total_height() const { return arrow_height_ + bar_height_; } | 97 int total_height() const { return arrow_height_ + bar_height_; } |
98 | 98 |
99 protected: | 99 protected: |
100 // gfx::AnimationDelegate: | 100 // gfx::AnimationDelegate: |
101 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 101 virtual void AnimationProgressed(const gfx::Animation* animation) override; |
102 | 102 |
103 const InfoBarContainer* container() const { return container_; } | 103 const InfoBarContainer* container() const { return container_; } |
104 InfoBarContainer* container() { return container_; } | 104 InfoBarContainer* container() { return container_; } |
105 gfx::SlideAnimation* animation() { return &animation_; } | 105 gfx::SlideAnimation* animation() { return &animation_; } |
106 int bar_height() const { return bar_height_; } | 106 int bar_height() const { return bar_height_; } |
107 int bar_target_height() const { return bar_target_height_; } | 107 int bar_target_height() const { return bar_target_height_; } |
108 | 108 |
109 // Platforms may optionally override these if they need to do work during | 109 // Platforms may optionally override these if they need to do work during |
110 // processing of the given calls. | 110 // processing of the given calls. |
111 virtual void PlatformSpecificSetOwner() {} | 111 virtual void PlatformSpecificSetOwner() {} |
112 virtual void PlatformSpecificShow(bool animate) {} | 112 virtual void PlatformSpecificShow(bool animate) {} |
113 virtual void PlatformSpecificHide(bool animate) {} | 113 virtual void PlatformSpecificHide(bool animate) {} |
114 virtual void PlatformSpecificOnCloseSoon() {} | 114 virtual void PlatformSpecificOnCloseSoon() {} |
115 virtual void PlatformSpecificOnHeightsRecalculated() {} | 115 virtual void PlatformSpecificOnHeightsRecalculated() {} |
116 | 116 |
117 private: | 117 private: |
118 // gfx::AnimationDelegate: | 118 // gfx::AnimationDelegate: |
119 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 119 virtual void AnimationEnded(const gfx::Animation* animation) override; |
120 | 120 |
121 // Finds the new desired arrow and bar heights, and if they differ from the | 121 // Finds the new desired arrow and bar heights, and if they differ from the |
122 // current ones, calls PlatformSpecificOnHeightRecalculated(). Informs our | 122 // current ones, calls PlatformSpecificOnHeightRecalculated(). Informs our |
123 // container our state has changed if either the heights have changed or | 123 // container our state has changed if either the heights have changed or |
124 // |force_notify| is set. | 124 // |force_notify| is set. |
125 void RecalculateHeights(bool force_notify); | 125 void RecalculateHeights(bool force_notify); |
126 | 126 |
127 // Checks whether the infobar is unowned and done with all animations. If so, | 127 // Checks whether the infobar is unowned and done with all animations. If so, |
128 // notifies the container that it should remove this infobar, and deletes | 128 // notifies the container that it should remove this infobar, and deletes |
129 // itself. | 129 // itself. |
(...skipping 12 matching lines...) Expand all Loading... |
142 int arrow_half_width_; // Includes only fill. | 142 int arrow_half_width_; // Includes only fill. |
143 int bar_height_; // Includes both fill and bottom separator. | 143 int bar_height_; // Includes both fill and bottom separator. |
144 int bar_target_height_; | 144 int bar_target_height_; |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(InfoBar); | 146 DISALLOW_COPY_AND_ASSIGN(InfoBar); |
147 }; | 147 }; |
148 | 148 |
149 } // namespace infobars | 149 } // namespace infobars |
150 | 150 |
151 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_H_ | 151 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_H_ |
OLD | NEW |