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

Side by Side Diff: ash/app_list/app_list_presenter_delegate.cc

Issue 2713603002: Remove fullscreen applist (Closed)
Patch Set: . Created 3 years, 10 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 | « ash/app_list/app_list_presenter_delegate.h ('k') | ash/common/ash_switches.h » ('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 (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 #include "ash/app_list/app_list_presenter_delegate.h" 5 #include "ash/app_list/app_list_presenter_delegate.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/shelf/app_list_button.h" 8 #include "ash/common/shelf/app_list_button.h"
9 #include "ash/common/shelf/shelf_layout_manager.h" 9 #include "ash/common/shelf/shelf_layout_manager.h"
10 #include "ash/common/shelf/shelf_widget.h" 10 #include "ash/common/shelf/shelf_widget.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 if (keyboard_controller && keyboard_controller->keyboard_visible()) 52 if (keyboard_controller && keyboard_controller->keyboard_visible())
53 bounds.Subtract(keyboard_controller->current_keyboard_bounds()); 53 bounds.Subtract(keyboard_controller->current_keyboard_bounds());
54 54
55 // Apply the |minimum_height|. 55 // Apply the |minimum_height|.
56 if (bounds.height() < minimum_height) 56 if (bounds.height() < minimum_height)
57 bounds.set_height(minimum_height); 57 bounds.set_height(minimum_height);
58 58
59 return bounds.CenterPoint(); 59 return bounds.CenterPoint();
60 } 60 }
61 61
62 bool IsFullscreenAppListEnabled() {
63 return base::CommandLine::ForCurrentProcess()->HasSwitch(
64 switches::kAshEnableFullscreenAppList);
65 }
66
67 } // namespace 62 } // namespace
68 63
69 //////////////////////////////////////////////////////////////////////////////// 64 ////////////////////////////////////////////////////////////////////////////////
70 // AppListPresenterDelegate, public: 65 // AppListPresenterDelegate, public:
71 66
72 AppListPresenterDelegate::AppListPresenterDelegate( 67 AppListPresenterDelegate::AppListPresenterDelegate(
73 app_list::AppListPresenterImpl* presenter, 68 app_list::AppListPresenterImpl* presenter,
74 app_list::AppListViewDelegateFactory* view_delegate_factory) 69 app_list::AppListViewDelegateFactory* view_delegate_factory)
75 : presenter_(presenter), view_delegate_factory_(view_delegate_factory) { 70 : presenter_(presenter), view_delegate_factory_(view_delegate_factory) {
76 WmShell::Get()->AddShellObserver(this); 71 WmShell::Get()->AddShellObserver(this);
(...skipping 23 matching lines...) Expand all
100 ash::Shell::GetPrimaryRootWindowController() 95 ash::Shell::GetPrimaryRootWindowController()
101 ->GetShelfLayoutManager() 96 ->GetShelfLayoutManager()
102 ->UpdateAutoHideState(); 97 ->UpdateAutoHideState();
103 view_ = view; 98 view_ = view;
104 aura::Window* root_window = Shell::GetInstance() 99 aura::Window* root_window = Shell::GetInstance()
105 ->window_tree_host_manager() 100 ->window_tree_host_manager()
106 ->GetRootWindowForDisplayId(display_id); 101 ->GetRootWindowForDisplayId(display_id);
107 WmWindow* wm_root_window = WmWindow::Get(root_window); 102 WmWindow* wm_root_window = WmWindow::Get(root_window);
108 aura::Window* container = GetRootWindowController(root_window) 103 aura::Window* container = GetRootWindowController(root_window)
109 ->GetContainer(kShellWindowId_AppListContainer); 104 ->GetContainer(kShellWindowId_AppListContainer);
110 bool is_fullscreen = IsFullscreenAppListEnabled() && 105 view->InitAsBubble(container, current_apps_page);
111 WmShell::Get() 106 // The app list is centered over the display.
112 ->maximize_mode_controller() 107 view->SetAnchorPoint(GetCenterOfDisplayForWindow(
113 ->IsMaximizeModeWindowManagerEnabled(); 108 wm_root_window, GetMinimumBoundsHeightForAppList(view)));
114 if (is_fullscreen) {
115 view->InitAsFramelessWindow(
116 container, current_apps_page,
117 ScreenUtil::GetDisplayWorkAreaBoundsInParent(container));
118 } else {
119 view->InitAsBubble(container, current_apps_page);
120 // The app list is centered over the display.
121 view->SetAnchorPoint(GetCenterOfDisplayForWindow(
122 wm_root_window, GetMinimumBoundsHeightForAppList(view)));
123 }
124 109
125 keyboard::KeyboardController* keyboard_controller = 110 keyboard::KeyboardController* keyboard_controller =
126 keyboard::KeyboardController::GetInstance(); 111 keyboard::KeyboardController::GetInstance();
127 if (keyboard_controller) 112 if (keyboard_controller)
128 keyboard_controller->AddObserver(this); 113 keyboard_controller->AddObserver(this);
129 Shell::GetInstance()->AddPreTargetHandler(this); 114 Shell::GetInstance()->AddPreTargetHandler(this);
130 WmShelf* shelf = WmShelf::ForWindow(wm_root_window); 115 WmShelf* shelf = WmShelf::ForWindow(wm_root_window);
131 shelf->AddObserver(this); 116 shelf->AddObserver(this);
132 117
133 // By setting us as DnD recipient, the app list knows that we can 118 // By setting us as DnD recipient, the app list knows that we can
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 233
249 void AppListPresenterDelegate::OnKeyboardClosed() {} 234 void AppListPresenterDelegate::OnKeyboardClosed() {}
250 235
251 //////////////////////////////////////////////////////////////////////////////// 236 ////////////////////////////////////////////////////////////////////////////////
252 // AppListPresenterDelegate, ShellObserver implementation: 237 // AppListPresenterDelegate, ShellObserver implementation:
253 void AppListPresenterDelegate::OnOverviewModeStarting() { 238 void AppListPresenterDelegate::OnOverviewModeStarting() {
254 if (is_visible_) 239 if (is_visible_)
255 presenter_->Dismiss(); 240 presenter_->Dismiss();
256 } 241 }
257 242
258 void AppListPresenterDelegate::OnMaximizeModeStarted() {
259 // The "fullscreen" app-list is initialized as in a different type of window,
260 // therefore we can't switch between the fullscreen status and the normal
261 // app-list bubble. App-list should be dismissed for the transition between
262 // maximize mode (touch-view mode) and non-maximize mode, otherwise the app
263 // list tries to behave as a bubble which leads to a crash. crbug.com/510062
264 if (IsFullscreenAppListEnabled() && is_visible_)
265 presenter_->Dismiss();
266 }
267
268 void AppListPresenterDelegate::OnMaximizeModeEnded() {
269 // See the comments of OnMaximizeModeStarted().
270 if (IsFullscreenAppListEnabled() && is_visible_)
271 presenter_->Dismiss();
272 }
273
274 //////////////////////////////////////////////////////////////////////////////// 243 ////////////////////////////////////////////////////////////////////////////////
275 // AppListPresenterDelegate, WmShelfObserver implementation: 244 // AppListPresenterDelegate, WmShelfObserver implementation:
276 245
277 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { 246 void AppListPresenterDelegate::OnShelfIconPositionsChanged() {
278 UpdateBounds(); 247 UpdateBounds();
279 } 248 }
280 249
281 } // namespace ash 250 } // namespace ash
OLDNEW
« no previous file with comments | « ash/app_list/app_list_presenter_delegate.h ('k') | ash/common/ash_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698