| 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_SHELF_OVERFLOW_BUTTON_H_ | 5 #ifndef ASH_COMMON_SHELF_OVERFLOW_BUTTON_H_ |
| 6 #define ASH_COMMON_SHELF_OVERFLOW_BUTTON_H_ | 6 #define ASH_COMMON_SHELF_OVERFLOW_BUTTON_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/gfx/geometry/rect.h" |
| 9 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
| 10 #include "ui/views/controls/button/custom_button.h" | 11 #include "ui/views/controls/button/custom_button.h" |
| 11 | 12 |
| 12 namespace ash { | 13 namespace ash { |
| 13 class ShelfView; | 14 class ShelfView; |
| 14 class WmShelf; | 15 class WmShelf; |
| 15 | 16 |
| 16 // Shelf overflow chevron button. | 17 // Shelf overflow chevron button. |
| 17 class OverflowButton : public views::CustomButton { | 18 class OverflowButton : public views::CustomButton { |
| 18 public: | 19 public: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | 35 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
| 35 bool ShouldEnterPushedState(const ui::Event& event) override; | 36 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 36 void NotifyClick(const ui::Event& event) override; | 37 void NotifyClick(const ui::Event& event) override; |
| 37 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; | 38 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; |
| 38 | 39 |
| 39 // Helper functions to paint the background and foreground of the button | 40 // Helper functions to paint the background and foreground of the button |
| 40 // at |bounds|. | 41 // at |bounds|. |
| 41 void PaintBackground(gfx::Canvas* canvas, const gfx::Rect& bounds); | 42 void PaintBackground(gfx::Canvas* canvas, const gfx::Rect& bounds); |
| 42 void PaintForeground(gfx::Canvas* canvas, const gfx::Rect& bounds); | 43 void PaintForeground(gfx::Canvas* canvas, const gfx::Rect& bounds); |
| 43 | 44 |
| 44 // Returns the id of the asset to use for the button backgound based on the | |
| 45 // current shelf state. | |
| 46 // TODO(tdanderson): Remove this once the material design shelf is enabled | |
| 47 // by default. See crbug.com/614453. | |
| 48 int NonMaterialBackgroundImageId() const; | |
| 49 | |
| 50 // Calculates the bounds of the overflow button based on the shelf alignment. | 45 // Calculates the bounds of the overflow button based on the shelf alignment. |
| 51 gfx::Rect CalculateButtonBounds() const; | 46 gfx::Rect CalculateButtonBounds() const; |
| 52 | 47 |
| 53 // Used for bottom shelf alignment. |bottom_image_| points to | 48 // Used for bottom shelf alignment. |
| 54 // |bottom_image_md_| for material design, otherwise it is points to a | 49 gfx::ImageSkia bottom_image_; |
| 55 // resource owned by the ResourceBundle. | |
| 56 // TODO(tdanderson): Remove the non-md code once the material design shelf is | |
| 57 // enabled by default. See crbug.com/614453. | |
| 58 const gfx::ImageSkia* bottom_image_; | |
| 59 gfx::ImageSkia bottom_image_md_; | |
| 60 | 50 |
| 61 // Cached rotations of |bottom_image_| used for left and right shelf | 51 // Cached rotations of |bottom_image_| used for left and right shelf |
| 62 // alignments. | 52 // alignments. |
| 63 gfx::ImageSkia left_image_; | 53 gfx::ImageSkia left_image_; |
| 64 gfx::ImageSkia right_image_; | 54 gfx::ImageSkia right_image_; |
| 65 | 55 |
| 66 ShelfView* shelf_view_; | 56 ShelfView* shelf_view_; |
| 67 WmShelf* wm_shelf_; | 57 WmShelf* wm_shelf_; |
| 68 | 58 |
| 69 // Color used to paint the background. | 59 // Color used to paint the background. |
| 70 SkColor background_color_; | 60 SkColor background_color_; |
| 71 | 61 |
| 72 DISALLOW_COPY_AND_ASSIGN(OverflowButton); | 62 DISALLOW_COPY_AND_ASSIGN(OverflowButton); |
| 73 }; | 63 }; |
| 74 | 64 |
| 75 } // namespace ash | 65 } // namespace ash |
| 76 | 66 |
| 77 #endif // ASH_COMMON_SHELF_OVERFLOW_BUTTON_H_ | 67 #endif // ASH_COMMON_SHELF_OVERFLOW_BUTTON_H_ |
| OLD | NEW |