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/base/resource/resource_bundle.h" | 7 #include "ui/base/resource/resource_bundle.h" |
8 #include "ui/gfx/animation/slide_animation.h" | 8 #include "ui/gfx/animation/slide_animation.h" |
9 #include "ui/gfx/animation/throb_animation.h" | 9 #include "ui/gfx/animation/throb_animation.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 swap_images_animation_->Reset(1); | 87 swap_images_animation_->Reset(1); |
88 } | 88 } |
89 PreferredSizeChanged(); | 89 PreferredSizeChanged(); |
90 SchedulePaint(); | 90 SchedulePaint(); |
91 } | 91 } |
92 | 92 |
93 bool FrameCaptionButton::IsAnimatingImageSwap() const { | 93 bool FrameCaptionButton::IsAnimatingImageSwap() const { |
94 return swap_images_animation_->is_animating(); | 94 return swap_images_animation_->is_animating(); |
95 } | 95 } |
96 | 96 |
97 gfx::Size FrameCaptionButton::GetPreferredSize() { | 97 gfx::Size FrameCaptionButton::GetPreferredSize() const { |
98 return hovered_background_image_.isNull() ? | 98 return hovered_background_image_.isNull() ? |
99 gfx::Size() : hovered_background_image_.size(); | 99 gfx::Size() : hovered_background_image_.size(); |
100 } | 100 } |
101 | 101 |
102 const char* FrameCaptionButton::GetClassName() const { | 102 const char* FrameCaptionButton::GetClassName() const { |
103 return kViewClassName; | 103 return kViewClassName; |
104 } | 104 } |
105 | 105 |
106 void FrameCaptionButton::OnPaint(gfx::Canvas* canvas) { | 106 void FrameCaptionButton::OnPaint(gfx::Canvas* canvas) { |
107 if (hover_animation_->is_animating() || state() == STATE_HOVERED) { | 107 if (hover_animation_->is_animating() || state() == STATE_HOVERED) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 int alpha) { | 168 int alpha) { |
169 SkPaint paint; | 169 SkPaint paint; |
170 paint.setAlpha(alpha); | 170 paint.setAlpha(alpha); |
171 canvas->DrawImageInt(to_center, | 171 canvas->DrawImageInt(to_center, |
172 (width() - to_center.width()) / 2, | 172 (width() - to_center.width()) / 2, |
173 (height() - to_center.height()) / 2, | 173 (height() - to_center.height()) / 2, |
174 paint); | 174 paint); |
175 } | 175 } |
176 | 176 |
177 } // namespace ash | 177 } // namespace ash |
OLD | NEW |