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

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

Issue 2710053005: Remove non-MD code from AppListButton (Closed)
Patch Set: Rebased Created 3 years, 9 months 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 | « no previous file | 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 "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 10 matching lines...) Expand all
21 AppListButton(InkDropButtonListener* listener, 21 AppListButton(InkDropButtonListener* listener,
22 ShelfView* shelf_view, 22 ShelfView* shelf_view,
23 WmShelf* wm_shelf); 23 WmShelf* wm_shelf);
24 ~AppListButton() override; 24 ~AppListButton() override;
25 25
26 void OnAppListShown(); 26 void OnAppListShown();
27 void OnAppListDismissed(); 27 void OnAppListDismissed();
28 28
29 bool is_showing_app_list() const { return is_showing_app_list_; } 29 bool is_showing_app_list() const { return is_showing_app_list_; }
30 30
31 bool draw_background_as_active() const { return draw_background_as_active_; }
32
33 // Updates background and schedules a paint. 31 // Updates background and schedules a paint.
34 void UpdateShelfItemBackground(SkColor color); 32 void UpdateShelfItemBackground(SkColor color);
35 33
36 protected: 34 protected:
37 // views::ImageButton overrides: 35 // views::ImageButton overrides:
38 bool OnMousePressed(const ui::MouseEvent& event) override; 36 bool OnMousePressed(const ui::MouseEvent& event) override;
39 void OnMouseReleased(const ui::MouseEvent& event) override; 37 void OnMouseReleased(const ui::MouseEvent& event) override;
40 void OnMouseCaptureLost() override; 38 void OnMouseCaptureLost() override;
41 bool OnMouseDragged(const ui::MouseEvent& event) override; 39 bool OnMouseDragged(const ui::MouseEvent& event) override;
42 void OnPaint(gfx::Canvas* canvas) override; 40 void OnPaint(gfx::Canvas* canvas) override;
43 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; 41 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
44 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; 42 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
45 void NotifyClick(const ui::Event& event) override; 43 void NotifyClick(const ui::Event& event) override;
46 bool ShouldEnterPushedState(const ui::Event& event) override; 44 bool ShouldEnterPushedState(const ui::Event& event) override;
47 std::unique_ptr<views::InkDrop> CreateInkDrop() override; 45 std::unique_ptr<views::InkDrop> CreateInkDrop() override;
48 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; 46 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override;
49 47
50 // ui::EventHandler overrides: 48 // ui::EventHandler overrides:
51 void OnGestureEvent(ui::GestureEvent* event) override; 49 void OnGestureEvent(ui::GestureEvent* event) override;
52 50
53 private: 51 private:
54 // Toggles the active state for painting the background and schedules a paint.
55 void SetDrawBackgroundAsActive(bool draw_background_as_active);
56
57 // Helper function to paint the background and foreground of the AppList
58 // button in Chrome OS MD.
59 void PaintMd(gfx::Canvas* canvas);
60
61 // Helper function to paint the AppList button in Chrome OS non-MD.
62 void PaintAppListButton(gfx::Canvas* canvas,
63 const gfx::ImageSkia& foreground_image);
64
65 // Get the center point of the app list button used to draw its background and 52 // Get the center point of the app list button used to draw its background and
66 // ink drops. 53 // ink drops.
67 gfx::Point GetCenterPoint() const; 54 gfx::Point GetCenterPoint() const;
68 55
69 // True if the app list is currently showing for this display. 56 // True if the app list is currently showing for this display.
70 // This is useful because other IsApplistVisible functions aren't per-display. 57 // This is useful because other IsApplistVisible functions aren't per-display.
71 bool is_showing_app_list_; 58 bool is_showing_app_list_;
72 59
73 // True if the background should render as active, regardless of the state of
74 // the application list.
75 bool draw_background_as_active_;
76
77 // Color used to paint the background. 60 // Color used to paint the background.
78 SkColor background_color_; 61 SkColor background_color_;
79 62
80 InkDropButtonListener* listener_; 63 InkDropButtonListener* listener_;
81 ShelfView* shelf_view_; 64 ShelfView* shelf_view_;
82 WmShelf* wm_shelf_; 65 WmShelf* wm_shelf_;
83 66
84 DISALLOW_COPY_AND_ASSIGN(AppListButton); 67 DISALLOW_COPY_AND_ASSIGN(AppListButton);
85 }; 68 };
86 69
87 } // namespace ash 70 } // namespace ash
88 71
89 #endif // ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ 72 #endif // ASH_COMMON_SHELF_APP_LIST_BUTTON_H_
OLDNEW
« no previous file with comments | « no previous file | ash/common/shelf/app_list_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698