| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_APP_LIST_BUTTON_H_ | 5 #ifndef ASH_SHELF_APP_LIST_BUTTON_H_ |
| 6 #define ASH_SHELF_APP_LIST_BUTTON_H_ | 6 #define ASH_SHELF_APP_LIST_BUTTON_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/shell_observer.h" | |
| 12 #include "base/macros.h" | 11 #include "base/macros.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "ui/views/controls/button/image_button.h" | 13 #include "ui/views/controls/button/image_button.h" |
| 15 | 14 |
| 16 namespace ash { | 15 namespace ash { |
| 17 class InkDropButtonListener; | 16 class InkDropButtonListener; |
| 18 class Shelf; | 17 class Shelf; |
| 19 class ShelfView; | 18 class ShelfView; |
| 20 | 19 |
| 21 // Button used for the AppList icon on the shelf. | 20 // Button used for the AppList icon on the shelf. |
| 22 class ASH_EXPORT AppListButton : public views::ImageButton, | 21 class ASH_EXPORT AppListButton : public views::ImageButton { |
| 23 public ShellObserver { | |
| 24 public: | 22 public: |
| 25 AppListButton(InkDropButtonListener* listener, | 23 AppListButton(InkDropButtonListener* listener, |
| 26 ShelfView* shelf_view, | 24 ShelfView* shelf_view, |
| 27 Shelf* shelf); | 25 Shelf* shelf); |
| 28 ~AppListButton() override; | 26 ~AppListButton() override; |
| 29 | 27 |
| 30 void OnAppListShown(); | 28 void OnAppListShown(); |
| 31 void OnAppListDismissed(); | 29 void OnAppListDismissed(); |
| 32 | 30 |
| 33 bool is_showing_app_list() const { return is_showing_app_list_; } | 31 bool is_showing_app_list() const { return is_showing_app_list_; } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 50 bool ShouldEnterPushedState(const ui::Event& event) override; | 48 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 51 std::unique_ptr<views::InkDrop> CreateInkDrop() override; | 49 std::unique_ptr<views::InkDrop> CreateInkDrop() override; |
| 52 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; | 50 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; |
| 53 void PaintButtonContents(gfx::Canvas* canvas) override; | 51 void PaintButtonContents(gfx::Canvas* canvas) override; |
| 54 | 52 |
| 55 private: | 53 private: |
| 56 // Get the center point of the app list button used to draw its background and | 54 // Get the center point of the app list button used to draw its background and |
| 57 // ink drops. | 55 // ink drops. |
| 58 gfx::Point GetCenterPoint() const; | 56 gfx::Point GetCenterPoint() const; |
| 59 | 57 |
| 60 // ShellObserver overrides: | |
| 61 void OnAppListVisibilityChanged(bool shown, | |
| 62 aura::Window* root_window) override; | |
| 63 | |
| 64 // True if the app list is currently showing for this display. | 58 // True if the app list is currently showing for this display. |
| 65 // This is useful because other IsApplistVisible functions aren't per-display. | 59 // This is useful because other IsApplistVisible functions aren't per-display. |
| 66 bool is_showing_app_list_; | 60 bool is_showing_app_list_; |
| 67 | 61 |
| 68 // Color used to paint the background. | 62 // Color used to paint the background. |
| 69 SkColor background_color_; | 63 SkColor background_color_; |
| 70 | 64 |
| 71 InkDropButtonListener* listener_; | 65 InkDropButtonListener* listener_; |
| 72 ShelfView* shelf_view_; | 66 ShelfView* shelf_view_; |
| 73 Shelf* shelf_; | 67 Shelf* shelf_; |
| 74 | 68 |
| 75 DISALLOW_COPY_AND_ASSIGN(AppListButton); | 69 DISALLOW_COPY_AND_ASSIGN(AppListButton); |
| 76 }; | 70 }; |
| 77 | 71 |
| 78 } // namespace ash | 72 } // namespace ash |
| 79 | 73 |
| 80 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ | 74 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ |
| OLD | NEW |