Chromium Code Reviews| 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_SHELF_OVERFLOW_BUTTON_H_ | 5 #ifndef ASH_SHELF_OVERFLOW_BUTTON_H_ |
| 6 #define ASH_SHELF_OVERFLOW_BUTTON_H_ | 6 #define ASH_SHELF_OVERFLOW_BUTTON_H_ |
| 7 | 7 |
| 8 #include "ash/common/shelf/shelf_types.h" | 8 #include "ash/common/shelf/shelf_types.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
| 12 #include "ui/views/controls/button/custom_button.h" | 12 #include "ui/views/controls/button/custom_button.h" |
| 13 | 13 |
| 14 namespace ash { | 14 namespace ash { |
| 15 | 15 |
| 16 class Shelf; | 16 class ShelfView; |
| 17 | 17 |
| 18 // Shelf overflow chevron button. | 18 // Shelf overflow chevron button. |
| 19 class OverflowButton : public views::CustomButton { | 19 class OverflowButton : public views::CustomButton { |
| 20 public: | 20 public: |
| 21 OverflowButton(views::ButtonListener* listener, Shelf* shelf); | 21 explicit OverflowButton(ShelfView* shelf_view); |
| 22 ~OverflowButton() override; | 22 ~OverflowButton() override; |
| 23 | 23 |
| 24 void OnShelfAlignmentChanged(); | 24 void OnShelfAlignmentChanged(); |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 // views::View: | 27 // views::View: |
| 28 void OnPaint(gfx::Canvas* canvas) override; | 28 void OnPaint(gfx::Canvas* canvas) override; |
| 29 | 29 |
| 30 // views::CustomButton: | |
| 31 void NotifyClick(const ui::Event& event) override; | |
| 32 | |
| 30 // Helper functions to paint the background and foreground of the button | 33 // Helper functions to paint the background and foreground of the button |
| 31 // at |bounds|. | 34 // at |bounds|. |
| 32 void PaintBackground(gfx::Canvas* canvas, const gfx::Rect& bounds); | 35 void PaintBackground(gfx::Canvas* canvas, const gfx::Rect& bounds); |
| 33 void PaintForeground(gfx::Canvas* canvas, const gfx::Rect& bounds); | 36 void PaintForeground(gfx::Canvas* canvas, const gfx::Rect& bounds); |
| 34 | 37 |
| 35 // Returns the id of the asset to use for the button backgound based on the | 38 // Returns the id of the asset to use for the button backgound based on the |
| 36 // current shelf state. | 39 // current shelf state. |
| 37 // TODO(tdanderson): Remove this once the material design shelf is enabled | 40 // TODO(tdanderson): Remove this once the material design shelf is enabled |
| 38 // by default. See crbug.com/614453. | 41 // by default. See crbug.com/614453. |
| 39 int NonMaterialBackgroundImageId(); | 42 int NonMaterialBackgroundImageId(); |
| 40 | 43 |
| 41 // Calculates the bounds of the overflow button based on the shelf alignment. | 44 // Calculates the bounds of the overflow button based on the shelf alignment. |
| 42 // TODO(tdanderson): The button size and bounds need to be adjusted to | 45 // TODO(tdanderson): The button size and bounds need to be adjusted to |
| 43 // conform to the material design spec. See crbug.com/617295. | 46 // conform to the material design spec. See crbug.com/617295. |
| 44 gfx::Rect CalculateButtonBounds(); | 47 gfx::Rect CalculateButtonBounds(); |
| 45 | 48 |
| 46 // Left and right images are rotations of bottom_image and are | 49 // Left and right images are rotations of bottom_image and are |
| 47 // owned by the overflow button. | 50 // owned by the overflow button. |
| 48 gfx::ImageSkia left_image_; | 51 gfx::ImageSkia left_image_; |
| 49 gfx::ImageSkia right_image_; | 52 gfx::ImageSkia right_image_; |
| 50 // Bottom image is owned by the resource bundle. | 53 // Bottom image is owned by the resource bundle. |
| 51 const gfx::ImageSkia* bottom_image_; | 54 const gfx::ImageSkia* bottom_image_; |
| 52 Shelf* shelf_; | 55 ShelfView* shelf_view_; |
|
James Cook
2016/06/13 19:55:35
Aside: This is fine for this CL, but in the medium
mohsen
2016/06/14 06:24:38
I guess this should have been addressed by introdu
| |
| 53 | 56 |
| 54 DISALLOW_COPY_AND_ASSIGN(OverflowButton); | 57 DISALLOW_COPY_AND_ASSIGN(OverflowButton); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace ash | 60 } // namespace ash |
| 58 | 61 |
| 59 #endif // ASH_SHELF_OVERFLOW_BUTTON_H_ | 62 #endif // ASH_SHELF_OVERFLOW_BUTTON_H_ |
| OLD | NEW |