| 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 #ifndef ASH_COMMON_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ | 5 #ifndef ASH_COMMON_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
| 6 #define ASH_COMMON_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ | 6 #define ASH_COMMON_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 CaptionButtonIcon icon() const { return icon_; } | 60 CaptionButtonIcon icon() const { return icon_; } |
| 61 | 61 |
| 62 void set_size(const gfx::Size& size) { size_ = size; } | 62 void set_size(const gfx::Size& size) { size_ = size; } |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 // views::CustomButton override: | 65 // views::CustomButton override: |
| 66 void OnGestureEvent(ui::GestureEvent* event) override; | 66 void OnGestureEvent(ui::GestureEvent* event) override; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // Paints |to_center| centered within the button with |alpha|. | 69 // Determines what alpha to use for the icon based on animation and |
| 70 void PaintCentered(gfx::Canvas* canvas, | 70 // active state. |
| 71 const gfx::ImageSkia& to_center, | 71 int GetAlphaForIcon(int base_alpha) const; |
| 72 int alpha); | |
| 73 | 72 |
| 74 // The button's current icon. | 73 // The button's current icon. |
| 75 CaptionButtonIcon icon_; | 74 CaptionButtonIcon icon_; |
| 76 | 75 |
| 77 // The size of the button. | 76 // The size of the button. |
| 78 gfx::Size size_; | 77 gfx::Size size_; |
| 79 | 78 |
| 80 // Whether the button should be painted as active. | 79 // Whether the button should be painted as active. |
| 81 bool paint_as_active_; | 80 bool paint_as_active_; |
| 82 | 81 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 97 // Crossfade animation started when the button's images are changed by | 96 // Crossfade animation started when the button's images are changed by |
| 98 // SetImage(). | 97 // SetImage(). |
| 99 std::unique_ptr<gfx::SlideAnimation> swap_images_animation_; | 98 std::unique_ptr<gfx::SlideAnimation> swap_images_animation_; |
| 100 | 99 |
| 101 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton); | 100 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton); |
| 102 }; | 101 }; |
| 103 | 102 |
| 104 } // namespace ash | 103 } // namespace ash |
| 105 | 104 |
| 106 #endif // ASH_COMMON_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ | 105 #endif // ASH_COMMON_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
| OLD | NEW |