| 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/common/frame/caption_buttons/frame_caption_button.h" | 5 #include "ash/common/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 26 matching lines...) Expand all Loading... |
| 37 const char FrameCaptionButton::kViewClassName[] = "FrameCaptionButton"; | 37 const char FrameCaptionButton::kViewClassName[] = "FrameCaptionButton"; |
| 38 | 38 |
| 39 FrameCaptionButton::FrameCaptionButton(views::ButtonListener* listener, | 39 FrameCaptionButton::FrameCaptionButton(views::ButtonListener* listener, |
| 40 CaptionButtonIcon icon) | 40 CaptionButtonIcon icon) |
| 41 : CustomButton(listener), | 41 : CustomButton(listener), |
| 42 icon_(icon), | 42 icon_(icon), |
| 43 paint_as_active_(false), | 43 paint_as_active_(false), |
| 44 use_light_images_(false), | 44 use_light_images_(false), |
| 45 alpha_(255), | 45 alpha_(255), |
| 46 swap_images_animation_(new gfx::SlideAnimation(this)) { | 46 swap_images_animation_(new gfx::SlideAnimation(this)) { |
| 47 set_animate_on_state_change(true); |
| 47 swap_images_animation_->Reset(1); | 48 swap_images_animation_->Reset(1); |
| 48 | 49 |
| 49 // Do not flip the gfx::Canvas passed to the OnPaint() method. The snap left | 50 // Do not flip the gfx::Canvas passed to the OnPaint() method. The snap left |
| 50 // and snap right button icons should not be flipped. The other icons are | 51 // and snap right button icons should not be flipped. The other icons are |
| 51 // horizontally symmetrical. | 52 // horizontally symmetrical. |
| 52 } | 53 } |
| 53 | 54 |
| 54 FrameCaptionButton::~FrameCaptionButton() {} | 55 FrameCaptionButton::~FrameCaptionButton() {} |
| 55 | 56 |
| 56 void FrameCaptionButton::SetImage(CaptionButtonIcon icon, | 57 void FrameCaptionButton::SetImage(CaptionButtonIcon icon, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 alpha *= inactive_alpha; | 181 alpha *= inactive_alpha; |
| 181 } | 182 } |
| 182 | 183 |
| 183 SkPaint paint; | 184 SkPaint paint; |
| 184 paint.setAlpha(alpha); | 185 paint.setAlpha(alpha); |
| 185 canvas->DrawImageInt(to_center, (width() - to_center.width()) / 2, | 186 canvas->DrawImageInt(to_center, (width() - to_center.width()) / 2, |
| 186 (height() - to_center.height()) / 2, paint); | 187 (height() - to_center.height()) / 2, paint); |
| 187 } | 188 } |
| 188 | 189 |
| 189 } // namespace ash | 190 } // namespace ash |
| OLD | NEW |