OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ash/frame/caption_buttons/frame_caption_button.h" | 5 #include "ash/frame/caption_buttons/frame_caption_button.h" |
6 | 6 |
7 #include "ui/gfx/animation/slide_animation.h" | 7 #include "ui/gfx/animation/slide_animation.h" |
8 #include "ui/gfx/animation/throb_animation.h" | 8 #include "ui/gfx/animation/throb_animation.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/color_palette.h" | 10 #include "ui/gfx/color_palette.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return swap_images_animation_->is_animating(); | 90 return swap_images_animation_->is_animating(); |
91 } | 91 } |
92 | 92 |
93 void FrameCaptionButton::SetAlpha(int alpha) { | 93 void FrameCaptionButton::SetAlpha(int alpha) { |
94 if (alpha_ != alpha) { | 94 if (alpha_ != alpha) { |
95 alpha_ = alpha; | 95 alpha_ = alpha; |
96 SchedulePaint(); | 96 SchedulePaint(); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 gfx::Size FrameCaptionButton::GetPreferredSize() const { | |
101 return size_; | |
102 } | |
103 | |
104 const char* FrameCaptionButton::GetClassName() const { | 100 const char* FrameCaptionButton::GetClassName() const { |
105 return kViewClassName; | 101 return kViewClassName; |
106 } | 102 } |
107 | 103 |
108 void FrameCaptionButton::OnPaint(gfx::Canvas* canvas) { | 104 void FrameCaptionButton::OnPaint(gfx::Canvas* canvas) { |
109 SkAlpha bg_alpha = SK_AlphaTRANSPARENT; | 105 SkAlpha bg_alpha = SK_AlphaTRANSPARENT; |
110 if (hover_animation().is_animating()) | 106 if (hover_animation().is_animating()) |
111 bg_alpha = hover_animation().CurrentValueBetween(0, kHoveredAlpha); | 107 bg_alpha = hover_animation().CurrentValueBetween(0, kHoveredAlpha); |
112 else if (state() == STATE_HOVERED) | 108 else if (state() == STATE_HOVERED) |
113 bg_alpha = kHoveredAlpha; | 109 bg_alpha = kHoveredAlpha; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if (hover_animation().is_animating()) { | 177 if (hover_animation().is_animating()) { |
182 inactive_alpha = | 178 inactive_alpha = |
183 hover_animation().CurrentValueBetween(inactive_alpha, 1.0f); | 179 hover_animation().CurrentValueBetween(inactive_alpha, 1.0f); |
184 } else if (state() == STATE_PRESSED || state() == STATE_HOVERED) { | 180 } else if (state() == STATE_PRESSED || state() == STATE_HOVERED) { |
185 inactive_alpha = 1.0f; | 181 inactive_alpha = 1.0f; |
186 } | 182 } |
187 return base_alpha * inactive_alpha; | 183 return base_alpha * inactive_alpha; |
188 } | 184 } |
189 | 185 |
190 } // namespace ash | 186 } // namespace ash |
OLD | NEW |