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

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

Issue 2939693004: Added HALF, FULLSCREEN_ALL_APPS, and FULLSCREEN_SEARCH. (Closed)
Patch Set: Addressed comments. Created 3 years, 6 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 #include "ash/app_list/app_list_presenter_delegate.h" 5 #include "ash/app_list/app_list_presenter_delegate.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/public/cpp/shelf_types.h" 8 #include "ash/public/cpp/shelf_types.h"
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 if (keyboard_controller && keyboard_controller->keyboard_visible()) 51 if (keyboard_controller && keyboard_controller->keyboard_visible())
52 bounds.Subtract(keyboard_controller->current_keyboard_bounds()); 52 bounds.Subtract(keyboard_controller->current_keyboard_bounds());
53 53
54 // Apply the |minimum_height|. 54 // Apply the |minimum_height|.
55 if (bounds.height() < minimum_height) 55 if (bounds.height() < minimum_height)
56 bounds.set_height(minimum_height); 56 bounds.set_height(minimum_height);
57 57
58 return bounds.CenterPoint(); 58 return bounds.CenterPoint();
59 } 59 }
60 60
61 // Whether the shelf is oriented on the side, not on the bottom.
62 bool IsSideShelf(aura::Window* root_window) {
63 bool is_side_shelf = false;
64 Shelf* shelf = Shelf::ForWindow(root_window);
65 switch (shelf->alignment()) {
66 case SHELF_ALIGNMENT_BOTTOM:
67 case SHELF_ALIGNMENT_BOTTOM_LOCKED:
68 is_side_shelf = false;
oshima 2017/06/15 17:51:45 nit: just return false, true in swich. no need to
newcomer 2017/06/15 18:20:26 Done.
69 break;
70 case SHELF_ALIGNMENT_LEFT:
71 case SHELF_ALIGNMENT_RIGHT:
72 is_side_shelf = true;
73 break;
74 }
75 return is_side_shelf;
oshima 2017/06/15 17:51:45 then return false;
newcomer 2017/06/15 18:20:26 Moved all return statements into the switch statem
76 }
77
61 } // namespace 78 } // namespace
62 79
63 //////////////////////////////////////////////////////////////////////////////// 80 ////////////////////////////////////////////////////////////////////////////////
64 // AppListPresenterDelegate, public: 81 // AppListPresenterDelegate, public:
65 82
66 AppListPresenterDelegate::AppListPresenterDelegate( 83 AppListPresenterDelegate::AppListPresenterDelegate(
67 app_list::AppListPresenterImpl* presenter, 84 app_list::AppListPresenterImpl* presenter,
68 app_list::AppListViewDelegateFactory* view_delegate_factory) 85 app_list::AppListViewDelegateFactory* view_delegate_factory)
69 : presenter_(presenter), view_delegate_factory_(view_delegate_factory) { 86 : presenter_(presenter), view_delegate_factory_(view_delegate_factory) {
70 Shell::Get()->AddShellObserver(this); 87 Shell::Get()->AddShellObserver(this);
(...skipping 20 matching lines...) Expand all
91 // UI layout when AppListView visibility changes. 108 // UI layout when AppListView visibility changes.
92 Shell::GetPrimaryRootWindowController() 109 Shell::GetPrimaryRootWindowController()
93 ->GetShelfLayoutManager() 110 ->GetShelfLayoutManager()
94 ->UpdateAutoHideState(); 111 ->UpdateAutoHideState();
95 view_ = view; 112 view_ = view;
96 aura::Window* root_window = 113 aura::Window* root_window =
97 ShellPort::Get()->GetRootWindowForDisplayId(display_id); 114 ShellPort::Get()->GetRootWindowForDisplayId(display_id);
98 aura::Window* container = RootWindowController::ForWindow(root_window) 115 aura::Window* container = RootWindowController::ForWindow(root_window)
99 ->GetContainer(kShellWindowId_AppListContainer); 116 ->GetContainer(kShellWindowId_AppListContainer);
100 117
101 view->Initialize(container, current_apps_page); 118 view->Initialize(container, current_apps_page,
119 Shell::Get()
120 ->maximize_mode_controller()
121 ->IsMaximizeModeWindowManagerEnabled(),
122 IsSideShelf(root_window));
102 123
103 if (!app_list::features::IsFullscreenAppListEnabled()) { 124 if (!app_list::features::IsFullscreenAppListEnabled()) {
104 view->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( 125 view->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow(
105 root_window, GetMinimumBoundsHeightForAppList(view))); 126 root_window, GetMinimumBoundsHeightForAppList(view)));
106 } 127 }
107 keyboard::KeyboardController* keyboard_controller = 128 keyboard::KeyboardController* keyboard_controller =
108 keyboard::KeyboardController::GetInstance(); 129 keyboard::KeyboardController::GetInstance();
109 if (keyboard_controller) 130 if (keyboard_controller)
110 keyboard_controller->AddObserver(this); 131 keyboard_controller->AddObserver(this);
111 Shell::Get()->AddPreTargetHandler(this); 132 Shell::Get()->AddPreTargetHandler(this);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 243
223 void AppListPresenterDelegate::OnKeyboardClosed() {} 244 void AppListPresenterDelegate::OnKeyboardClosed() {}
224 245
225 //////////////////////////////////////////////////////////////////////////////// 246 ////////////////////////////////////////////////////////////////////////////////
226 // AppListPresenterDelegate, ShellObserver implementation: 247 // AppListPresenterDelegate, ShellObserver implementation:
227 void AppListPresenterDelegate::OnOverviewModeStarting() { 248 void AppListPresenterDelegate::OnOverviewModeStarting() {
228 if (is_visible_) 249 if (is_visible_)
229 presenter_->Dismiss(); 250 presenter_->Dismiss();
230 } 251 }
231 252
253 void AppListPresenterDelegate::OnMaximizeModeStarted() {
254 if (!app_list::features::IsFullscreenAppListEnabled())
255 return;
256
257 view_->OnMaximizeModeChanged(true);
258 }
259
260 void AppListPresenterDelegate::OnMaximizeModeEnded() {
261 if (!app_list::features::IsFullscreenAppListEnabled())
262 return;
263
264 view_->OnMaximizeModeChanged(false);
265 }
266
232 } // namespace ash 267 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698