| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 51   // horizontally symmetrical. | 51   // horizontally symmetrical. | 
| 52 } | 52 } | 
| 53 | 53 | 
| 54 FrameCaptionButton::~FrameCaptionButton() { | 54 FrameCaptionButton::~FrameCaptionButton() { | 
| 55 } | 55 } | 
| 56 | 56 | 
| 57 void FrameCaptionButton::SetImage(CaptionButtonIcon icon, | 57 void FrameCaptionButton::SetImage(CaptionButtonIcon icon, | 
| 58                                   Animate animate, | 58                                   Animate animate, | 
| 59                                   gfx::VectorIconId icon_image_id) { | 59                                   gfx::VectorIconId icon_image_id) { | 
| 60   gfx::ImageSkia new_icon_image = gfx::CreateVectorIcon( | 60   gfx::ImageSkia new_icon_image = gfx::CreateVectorIcon( | 
| 61       icon_image_id, 12, | 61       icon_image_id, use_light_images_ ? SK_ColorWHITE : gfx::kChromeIconGrey); | 
| 62       use_light_images_ ? SK_ColorWHITE : gfx::kChromeIconGrey); |  | 
| 63 | 62 | 
| 64   // The early return is dependent on |animate| because callers use SetImage() | 63   // The early return is dependent on |animate| because callers use SetImage() | 
| 65   // with ANIMATE_NO to progress the crossfade animation to the end. | 64   // with ANIMATE_NO to progress the crossfade animation to the end. | 
| 66   if (icon == icon_ && | 65   if (icon == icon_ && | 
| 67       (animate == ANIMATE_YES || !swap_images_animation_->is_animating()) && | 66       (animate == ANIMATE_YES || !swap_images_animation_->is_animating()) && | 
| 68       new_icon_image.BackedBySameObjectAs(icon_image_)) { | 67       new_icon_image.BackedBySameObjectAs(icon_image_)) { | 
| 69     return; | 68     return; | 
| 70   } | 69   } | 
| 71 | 70 | 
| 72   if (animate == ANIMATE_YES) | 71   if (animate == ANIMATE_YES) | 
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 184 | 183 | 
| 185   SkPaint paint; | 184   SkPaint paint; | 
| 186   paint.setAlpha(alpha); | 185   paint.setAlpha(alpha); | 
| 187   canvas->DrawImageInt(to_center, | 186   canvas->DrawImageInt(to_center, | 
| 188                        (width() - to_center.width()) / 2, | 187                        (width() - to_center.width()) / 2, | 
| 189                        (height() - to_center.height()) / 2, | 188                        (height() - to_center.height()) / 2, | 
| 190                        paint); | 189                        paint); | 
| 191 } | 190 } | 
| 192 | 191 | 
| 193 }  // namespace ash | 192 }  // namespace ash | 
| OLD | NEW | 
|---|