Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: ash/common/shelf/app_list_button.h

Issue 2534953006: Fix shelf auto-hide calculation for app-list visibility. (Closed)
Patch Set: Address comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/app_list/app_list_presenter_delegate.cc ('k') | ash/common/shelf/app_list_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_COMMON_SHELF_APP_LIST_BUTTON_H_ 5 #ifndef ASH_COMMON_SHELF_APP_LIST_BUTTON_H_
6 #define ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ 6 #define ASH_COMMON_SHELF_APP_LIST_BUTTON_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/views/controls/button/image_button.h" 10 #include "ui/views/controls/button/image_button.h"
11 11
12 namespace ash { 12 namespace ash {
13 class InkDropButtonListener; 13 class InkDropButtonListener;
14 class ShelfView; 14 class ShelfView;
15 class WmShelf; 15 class WmShelf;
16 16
17 // Button used for the AppList icon on the shelf. 17 // Button used for the AppList icon on the shelf.
18 class ASH_EXPORT AppListButton : public views::ImageButton { 18 class ASH_EXPORT AppListButton : public views::ImageButton {
19 public: 19 public:
20 AppListButton(InkDropButtonListener* listener, 20 AppListButton(InkDropButtonListener* listener,
21 ShelfView* shelf_view, 21 ShelfView* shelf_view,
22 WmShelf* wm_shelf); 22 WmShelf* wm_shelf);
23 ~AppListButton() override; 23 ~AppListButton() override;
24 24
25 void OnAppListShown(); 25 void OnAppListShown();
26 void OnAppListDismissed(); 26 void OnAppListDismissed();
27 27
28 bool draw_background_as_active() { return draw_background_as_active_; } 28 bool is_showing_app_list() const { return is_showing_app_list_; }
29
30 bool draw_background_as_active() const { return draw_background_as_active_; }
29 31
30 // Sets alpha value of the background and schedules a paint. 32 // Sets alpha value of the background and schedules a paint.
31 void SetBackgroundAlpha(int alpha); 33 void SetBackgroundAlpha(int alpha);
32 34
33 protected: 35 protected:
34 // views::ImageButton overrides: 36 // views::ImageButton overrides:
35 bool OnMousePressed(const ui::MouseEvent& event) override; 37 bool OnMousePressed(const ui::MouseEvent& event) override;
36 void OnMouseReleased(const ui::MouseEvent& event) override; 38 void OnMouseReleased(const ui::MouseEvent& event) override;
37 void OnMouseCaptureLost() override; 39 void OnMouseCaptureLost() override;
38 bool OnMouseDragged(const ui::MouseEvent& event) override; 40 bool OnMouseDragged(const ui::MouseEvent& event) override;
(...skipping 17 matching lines...) Expand all
56 void PaintMd(gfx::Canvas* canvas); 58 void PaintMd(gfx::Canvas* canvas);
57 59
58 // Helper function to paint the AppList button in Chrome OS non-MD. 60 // Helper function to paint the AppList button in Chrome OS non-MD.
59 void PaintAppListButton(gfx::Canvas* canvas, 61 void PaintAppListButton(gfx::Canvas* canvas,
60 const gfx::ImageSkia& foreground_image); 62 const gfx::ImageSkia& foreground_image);
61 63
62 // Get the center point of the app list button used to draw its background and 64 // Get the center point of the app list button used to draw its background and
63 // ink drops. 65 // ink drops.
64 gfx::Point GetCenterPoint() const; 66 gfx::Point GetCenterPoint() const;
65 67
68 // True if the app list is currently showing for this display.
69 // This is useful because other IsApplistVisible functions aren't per-display.
70 bool is_showing_app_list_;
71
66 // True if the background should render as active, regardless of the state of 72 // True if the background should render as active, regardless of the state of
67 // the application list. 73 // the application list.
68 bool draw_background_as_active_; 74 bool draw_background_as_active_;
69 75
70 // Alpha value used to paint the background. 76 // Alpha value used to paint the background.
71 int background_alpha_; 77 int background_alpha_;
72 78
73 InkDropButtonListener* listener_; 79 InkDropButtonListener* listener_;
74 ShelfView* shelf_view_; 80 ShelfView* shelf_view_;
75 WmShelf* wm_shelf_; 81 WmShelf* wm_shelf_;
76 82
77 DISALLOW_COPY_AND_ASSIGN(AppListButton); 83 DISALLOW_COPY_AND_ASSIGN(AppListButton);
78 }; 84 };
79 85
80 } // namespace ash 86 } // namespace ash
81 87
82 #endif // ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ 88 #endif // ASH_COMMON_SHELF_APP_LIST_BUTTON_H_
OLDNEW
« no previous file with comments | « ash/app_list/app_list_presenter_delegate.cc ('k') | ash/common/shelf/app_list_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698