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

Side by Side Diff: ui/app_list/shower/app_list_shower_impl.h

Issue 1830293002: AppListController refactoring part 1: AppListShower implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing target names in .isolate. Created 4 years, 8 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 | « ui/app_list/shower/app_list_shower_export.h ('k') | ui/app_list/shower/app_list_shower_impl.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_WM_APP_LIST_CONTROLLER_H_ 5 #ifndef UI_APP_LIST_SHOWER_APP_LIST_SHOWER_IMPL_H_
6 #define ASH_WM_APP_LIST_CONTROLLER_H_ 6 #define UI_APP_LIST_SHOWER_APP_LIST_SHOWER_IMPL_H_
7 7
8 #include "ash/shelf/shelf_icon_observer.h"
9 #include "ash/shell_observer.h"
10 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
11 #include "base/macros.h" 9 #include "base/macros.h"
12 #include "ui/app_list/pagination_model_observer.h" 10 #include "ui/app_list/pagination_model_observer.h"
11 #include "ui/app_list/shower/app_list_shower.h"
12 #include "ui/app_list/shower/app_list_shower_delegate.h"
13 #include "ui/aura/client/focus_change_observer.h" 13 #include "ui/aura/client/focus_change_observer.h"
14 #include "ui/aura/window_observer.h" 14 #include "ui/aura/window_observer.h"
15 #include "ui/compositor/layer_animation_observer.h" 15 #include "ui/compositor/layer_animation_observer.h"
16 #include "ui/events/event_handler.h"
17 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
18 #include "ui/keyboard/keyboard_controller_observer.h"
19 #include "ui/views/widget/widget_observer.h" 17 #include "ui/views/widget/widget_observer.h"
20 18
21 namespace app_list { 19 namespace app_list {
22 class ApplicationDragAndDropHost;
23 class AppListView; 20 class AppListView;
21 class AppListViewDelegate;
22 class AppListShowerDelegateFactory;
23
24 namespace test {
25 class AppListShowerImplTestApi;
24 } 26 }
25 27
26 namespace ui { 28 class AppListShowerImplTest;
27 class LocatedEvent; 29 class AppListViewDelegate;
28 }
29 30
30 namespace ash { 31 // Manages app list UI. Creates AppListView and schedules showing/hiding
31 namespace test { 32 // animation. While the UI is visible, it monitors things such as app list
32 class AppListControllerTestApi; 33 // activation state to auto dismiss the UI. Delegates the responsibility
33 } 34 // for laying out the app list UI to ash::AppListLayoutDelegate.
34 35 class APP_LIST_SHOWER_EXPORT AppListShowerImpl
35 // AppListController is a controller that manages app list UI for shell. 36 : public AppListShower,
36 // It creates AppListView and schedules showing/hiding animation. 37 public aura::client::FocusChangeObserver,
37 // While the UI is visible, it monitors things such as app list widget's 38 public aura::WindowObserver,
38 // activation state and desktop mouse click to auto dismiss the UI. 39 public ui::ImplicitAnimationObserver,
39 class AppListController : public ui::EventHandler, 40 public views::WidgetObserver,
40 public aura::client::FocusChangeObserver, 41 public PaginationModelObserver {
41 public aura::WindowObserver,
42 public ui::ImplicitAnimationObserver,
43 public views::WidgetObserver,
44 public keyboard::KeyboardControllerObserver,
45 public ShellObserver,
46 public ShelfIconObserver,
47 public app_list::PaginationModelObserver {
48 public: 42 public:
49 AppListController(); 43 explicit AppListShowerImpl(AppListShowerDelegateFactory* factory);
50 ~AppListController() override; 44 ~AppListShowerImpl() override;
51
52 // Show/hide app list window. The |window| is used to deterime in
53 // which display (in which the |window| exists) the app list should
54 // be shown.
55 void Show(aura::Window* window);
56 void Dismiss();
57
58 // Whether app list window is visible (shown or being shown).
59 bool IsVisible() const;
60
61 // Returns target visibility. This differs from IsVisible() if an animation
62 // is ongoing.
63 bool GetTargetVisibility() const { return is_visible_; }
64 45
65 // Returns app list window or NULL if it is not visible. 46 // Returns app list window or NULL if it is not visible.
66 aura::Window* GetWindow(); 47 aura::Window* GetWindow();
67 48
68 // Returns app list view if one exists, or NULL otherwise. 49 // Returns app list view if one exists, or NULL otherwise.
69 app_list::AppListView* GetView() { return view_; } 50 AppListView* GetView() { return view_; }
51
52 // AppListShower:
53 void Show(aura::Window* window) override;
54 void Dismiss() override;
55 bool IsVisible() const override;
56 bool GetTargetVisibility() const override;
70 57
71 private: 58 private:
72 friend class test::AppListControllerTestApi; 59 friend class test::AppListShowerImplTestApi;
73
74 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop
75 // operations outside the application list.
76 void SetDragAndDropHostOfCurrentAppList(
77 app_list::ApplicationDragAndDropHost* drag_and_drop_host);
78 60
79 // Sets the app list view and attempts to show it. 61 // Sets the app list view and attempts to show it.
80 void SetView(app_list::AppListView* view); 62 void SetView(AppListView* view);
81 63
82 // Forgets the view. 64 // Forgets the view.
83 void ResetView(); 65 void ResetView();
84 66
85 // Starts show/hide animation. 67 // Starts show/hide animation.
86 void ScheduleAnimation(); 68 void ScheduleAnimation();
87 69
88 void ProcessLocatedEvent(ui::LocatedEvent* event);
89
90 // Makes app list bubble update its bounds.
91 void UpdateBounds();
92
93 // ui::EventHandler overrides:
94 void OnMouseEvent(ui::MouseEvent* event) override;
95 void OnGestureEvent(ui::GestureEvent* event) override;
96
97 // aura::client::FocusChangeObserver overrides: 70 // aura::client::FocusChangeObserver overrides:
98 void OnWindowFocused(aura::Window* gained_focus, 71 void OnWindowFocused(aura::Window* gained_focus,
99 aura::Window* lost_focus) override; 72 aura::Window* lost_focus) override;
100 73
101 // aura::WindowObserver overrides: 74 // aura::WindowObserver overrides:
102 void OnWindowBoundsChanged(aura::Window* root, 75 void OnWindowBoundsChanged(aura::Window* root,
103 const gfx::Rect& old_bounds, 76 const gfx::Rect& old_bounds,
104 const gfx::Rect& new_bounds) override; 77 const gfx::Rect& new_bounds) override;
105 78
106 // ui::ImplicitAnimationObserver overrides: 79 // ui::ImplicitAnimationObserver overrides:
107 void OnImplicitAnimationsCompleted() override; 80 void OnImplicitAnimationsCompleted() override;
108 81
109 // views::WidgetObserver overrides: 82 // views::WidgetObserver overrides:
110 void OnWidgetDestroying(views::Widget* widget) override; 83 void OnWidgetDestroying(views::Widget* widget) override;
111 84
112 // KeyboardControllerObserver overrides: 85 // PaginationModelObserver overrides:
113 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
114
115 // ShellObserver overrides:
116 void OnShelfAlignmentChanged(aura::Window* root_window) override;
117 void OnMaximizeModeStarted() override;
118 void OnMaximizeModeEnded() override;
119
120 // ShelfIconObserver overrides:
121 void OnShelfIconPositionsChanged() override;
122
123 // app_list::PaginationModelObserver overrides:
124 void TotalPagesChanged() override; 86 void TotalPagesChanged() override;
125 void SelectedPageChanged(int old_selected, int new_selected) override; 87 void SelectedPageChanged(int old_selected, int new_selected) override;
126 void TransitionStarted() override; 88 void TransitionStarted() override;
127 void TransitionChanged() override; 89 void TransitionChanged() override;
128 90
91 // Not owned
92 AppListShowerDelegateFactory* const factory_;
93
94 // Responsible for laying out the app list UI.
95 scoped_ptr<AppListShowerDelegate> shower_delegate_;
96
129 // Whether we should show or hide app list widget. 97 // Whether we should show or hide app list widget.
130 bool is_visible_; 98 bool is_visible_ = false;
131
132 // Whether the app list should remain centered.
133 bool is_centered_;
134 99
135 // The AppListView this class manages, owned by its widget. 100 // The AppListView this class manages, owned by its widget.
136 app_list::AppListView* view_; 101 AppListView* view_ = nullptr;
137 102
138 // The current page of the AppsGridView of |view_|. This is stored outside of 103 // The current page of the AppsGridView of |view_|. This is stored outside of
139 // the view's PaginationModel, so that it persists when the view is destroyed. 104 // the view's PaginationModel, so that it persists when the view is destroyed.
140 int current_apps_page_; 105 int current_apps_page_ = -1;
141 106
142 // Cached bounds of |view_| for snapping back animation after over-scroll. 107 // Cached bounds of |view_| for snapping back animation after over-scroll.
143 gfx::Rect view_bounds_; 108 gfx::Rect view_bounds_;
144 109
145 // Whether should schedule snap back animation. 110 // Whether should schedule snap back animation.
146 bool should_snap_back_; 111 bool should_snap_back_ = false;
147 112
148 DISALLOW_COPY_AND_ASSIGN(AppListController); 113 DISALLOW_COPY_AND_ASSIGN(AppListShowerImpl);
149 }; 114 };
150 115
151 } // namespace ash 116 } // namespace app_list
152 117
153 #endif // ASH_WM_APP_LIST_CONTROLLER_H_ 118 #endif // UI_APP_LIST_SHOWER_APP_LIST_SHOWER_IMPL_H_
OLDNEW
« no previous file with comments | « ui/app_list/shower/app_list_shower_export.h ('k') | ui/app_list/shower/app_list_shower_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698