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

Side by Side Diff: ui/app_list/views/app_list_view.h

Issue 2898743002: Draggable peeking/fullscreen launcher with transparent background. (Closed)
Patch Set: Migrated from wm_shelf to shelf and addressed comments! Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_
6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ 6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/scoped_observer.h"
12 #include "build/build_config.h" 13 #include "build/build_config.h"
13 #include "ui/app_list/app_list_export.h" 14 #include "ui/app_list/app_list_export.h"
14 #include "ui/app_list/speech_ui_model_observer.h" 15 #include "ui/app_list/speech_ui_model_observer.h"
16 #include "ui/display/display_observer.h"
17 #include "ui/display/screen.h"
15 #include "ui/views/bubble/bubble_dialog_delegate.h" 18 #include "ui/views/bubble/bubble_dialog_delegate.h"
16 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
17 20
18 namespace app_list { 21 namespace app_list {
19 class ApplicationDragAndDropHost; 22 class ApplicationDragAndDropHost;
20 class AppListMainView; 23 class AppListMainView;
21 class AppListModel; 24 class AppListModel;
22 class AppListViewDelegate; 25 class AppListViewDelegate;
23 class HideViewAnimationObserver; 26 class HideViewAnimationObserver;
24 class PaginationModel; 27 class PaginationModel;
25 class SearchBoxView; 28 class SearchBoxView;
26 class SpeechView; 29 class SpeechView;
27 30
28 namespace test { 31 namespace test {
29 class AppListViewTestApi; 32 class AppListViewTestApi;
30 } 33 }
31 34
32 // AppListView is the top-level view and controller of app list UI. It creates 35 // AppListView is the top-level view and controller of app list UI. It creates
33 // and hosts a AppsGridView and passes AppListModel to it for display. 36 // and hosts a AppsGridView and passes AppListModel to it for display.
34 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, 37 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
35 public SpeechUIModelObserver { 38 public SpeechUIModelObserver,
39 public display::DisplayObserver {
36 public: 40 public:
37 // Does not take ownership of |delegate|. 41 // Does not take ownership of |delegate|.
38 explicit AppListView(AppListViewDelegate* delegate); 42 explicit AppListView(AppListViewDelegate* delegate);
39 ~AppListView() override; 43 ~AppListView() override;
40 44
41 // Initializes the widget as a bubble or fullscreen view depending on the 45 // Initializes the widget as a bubble or fullscreen view depending on the
42 // presence of a cmd line switch. parent and initial_apps_page are used for 46 // presence of a cmd line switch. parent and initial_apps_page are used for
43 // both the bubble and fullscreen initialization. 47 // both the bubble and fullscreen initialization.
44 void Initialize(gfx::NativeView parent, int initial_apps_page); 48 void Initialize(gfx::NativeView parent, int initial_apps_page);
45 49
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 AppListMainView* app_list_main_view() { return app_list_main_view_; } 86 AppListMainView* app_list_main_view() { return app_list_main_view_; }
83 87
84 // Gets the PaginationModel owned by this view's apps grid. 88 // Gets the PaginationModel owned by this view's apps grid.
85 PaginationModel* GetAppsPaginationModel(); 89 PaginationModel* GetAppsPaginationModel();
86 90
87 // Overridden from views::View: 91 // Overridden from views::View:
88 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; 92 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
89 void Layout() override; 93 void Layout() override;
90 void SchedulePaintInRect(const gfx::Rect& rect) override; 94 void SchedulePaintInRect(const gfx::Rect& rect) override;
91 95
96 void UpdateDimensions();
vadimt 2017/05/26 01:27:57 Group with the rest non-overrides; sort same way i
newcomer 2017/05/26 17:11:28 Done.
97
98 // Changes the view to the peeking state or to the fullscreen state.
99 void ToFullscreen();
100 void ToPeeking();
101
102 bool IsFullscreen() const;
103
92 private: 104 private:
93 friend class test::AppListViewTestApi; 105 friend class test::AppListViewTestApi;
94 106
95 void InitContents(gfx::NativeView parent, int initial_apps_page); 107 void InitContents(gfx::NativeView parent, int initial_apps_page);
96 108
97 void InitChildWidgets(); 109 void InitChildWidgets();
98 110
99 // Initializes the widget for fullscreen mode. 111 // Initializes the widget for fullscreen mode.
100 void InitializeFullscreen(gfx::NativeView parent, int initial_apps_page); 112 void InitializeFullscreen(gfx::NativeView parent, int initial_apps_page);
101 113
102 // Initializes the widget as a bubble. 114 // Initializes the widget as a bubble.
103 void InitializeBubble(gfx::NativeView parent, int initial_apps_page); 115 void InitializeBubble(gfx::NativeView parent, int initial_apps_page);
104 116
117 // Handles all drag logic for the app list view. Touch and Click events are
118 // filtered through OnMouseEvent and OnGestureEvent before being passed to
119 // HandleDrag.
120 void HandleDrag(gfx::Point location, ui::EventType type);
121
105 // Overridden from views::BubbleDialogDelegateView: 122 // Overridden from views::BubbleDialogDelegateView:
106 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, 123 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
107 views::Widget* widget) const override; 124 views::Widget* widget) const override;
108 int GetDialogButtons() const override; 125 int GetDialogButtons() const override;
109 126
110 // Overridden from views::WidgetDelegateView: 127 // Overridden from views::WidgetDelegateView:
111 views::View* GetInitiallyFocusedView() override; 128 views::View* GetInitiallyFocusedView() override;
112 bool WidgetHasHitTestMask() const override; 129 bool WidgetHasHitTestMask() const override;
113 void GetWidgetHitTestMask(gfx::Path* mask) const override; 130 void GetWidgetHitTestMask(gfx::Path* mask) const override;
114 131
132 // Overridden from ui::EventHandler
133 void OnMouseEvent(ui::MouseEvent* event) override;
134 void OnGestureEvent(ui::GestureEvent* event) override;
135
115 // Overridden from views::WidgetObserver: 136 // Overridden from views::WidgetObserver:
116 void OnWidgetDestroying(views::Widget* widget) override; 137 void OnWidgetDestroying(views::Widget* widget) override;
117 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; 138 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override;
118 139
119 // Overridden from SpeechUIModelObserver: 140 // Overridden from SpeechUIModelObserver:
120 void OnSpeechRecognitionStateChanged( 141 void OnSpeechRecognitionStateChanged(
121 SpeechRecognitionState new_state) override; 142 SpeechRecognitionState new_state) override;
122 143
144 // Overridden from DisplayObserver:
145 void OnDisplayMetricsChanged(const display::Display& display,
146 uint32_t changed_metrics) override;
147
123 AppListViewDelegate* delegate_; // Weak. Owned by AppListService. 148 AppListViewDelegate* delegate_; // Weak. Owned by AppListService.
124 149
125 AppListMainView* app_list_main_view_; 150 AppListMainView* app_list_main_view_;
126 SpeechView* speech_view_; 151 SpeechView* speech_view_;
152 views::Widget* fullscreen_widget_;
vadimt 2017/05/26 01:27:57 Unowned? And a comment. = nullptr
newcomer 2017/05/26 17:11:28 Done.
127 153
128 views::View* search_box_focus_host_; // Owned by the views hierarchy. 154 views::View* search_box_focus_host_; // Owned by the views hierarchy.
129 views::Widget* search_box_widget_; // Owned by the app list's widget. 155 views::Widget* search_box_widget_; // Owned by the app list's widget.
130 SearchBoxView* search_box_view_; // Owned by |search_box_widget_|. 156 SearchBoxView* search_box_view_; // Owned by |search_box_widget_|.
157 // Owned by the app list's widget.
158 views::View* launcher_background_shield_ = nullptr;
159 // The gap between the initial gesture event and the top of the window.
160 int initial_drag_separation_ = 0;
161 // The velocity of the gesture event.
162 float last_fling_velocity_ = 0;
163 // The height of the peeking launcher, which changes based on screen
164 // orientation.
165 int default_peeking_launcher_y_ = 0;
166 // The DIP delta that must be exceeded for the launcher to snap to the next
167 // state.
168 int launcher_threshold_;
vadimt 2017/05/26 01:27:57 Initialize.
newcomer 2017/05/26 17:11:28 Done.
169 bool is_fullscreen_launcher_ = false;
170 // The desktop area, not including the shelf.
171 gfx::Rect display_work_area_bounds_;
172 // The bounds of the launcher. The size should never change, only the
173 // position.
174 gfx::Rect fullscreen_widget_bounds_;
175
176 ScopedObserver<display::Screen, display::DisplayObserver> display_observer_;
131 177
132 // A semi-transparent white overlay that covers the app list while dialogs are 178 // A semi-transparent white overlay that covers the app list while dialogs are
133 // open. 179 // open.
134 views::View* overlay_view_; 180 views::View* overlay_view_;
135 181
136 std::unique_ptr<HideViewAnimationObserver> animation_observer_; 182 std::unique_ptr<HideViewAnimationObserver> animation_observer_;
137 183
138 // For UMA and testing. If non-null, triggered when the app list is painted. 184 // For UMA and testing. If non-null, triggered when the app list is painted.
139 base::Closure next_paint_callback_; 185 base::Closure next_paint_callback_;
140 186
141 DISALLOW_COPY_AND_ASSIGN(AppListView); 187 DISALLOW_COPY_AND_ASSIGN(AppListView);
142 }; 188 };
143 189
144 } // namespace app_list 190 } // namespace app_list
145 191
146 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ 192 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698