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

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) {
newcomer 2017/06/13 23:00:39 I'm passing root_window here because calling GetNa
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;
69 case SHELF_ALIGNMENT_LEFT:
70 case SHELF_ALIGNMENT_RIGHT:
71 is_side_shelf = true;
72 }
73 return is_side_shelf;
74 }
75
61 } // namespace 76 } // namespace
62 77
63 //////////////////////////////////////////////////////////////////////////////// 78 ////////////////////////////////////////////////////////////////////////////////
64 // AppListPresenterDelegate, public: 79 // AppListPresenterDelegate, public:
65 80
66 AppListPresenterDelegate::AppListPresenterDelegate( 81 AppListPresenterDelegate::AppListPresenterDelegate(
67 app_list::AppListPresenterImpl* presenter, 82 app_list::AppListPresenterImpl* presenter,
68 app_list::AppListViewDelegateFactory* view_delegate_factory) 83 app_list::AppListViewDelegateFactory* view_delegate_factory)
69 : presenter_(presenter), view_delegate_factory_(view_delegate_factory) { 84 : presenter_(presenter), view_delegate_factory_(view_delegate_factory) {
70 Shell::Get()->AddShellObserver(this); 85 Shell::Get()->AddShellObserver(this);
(...skipping 20 matching lines...) Expand all
91 // UI layout when AppListView visibility changes. 106 // UI layout when AppListView visibility changes.
92 Shell::GetPrimaryRootWindowController() 107 Shell::GetPrimaryRootWindowController()
93 ->GetShelfLayoutManager() 108 ->GetShelfLayoutManager()
94 ->UpdateAutoHideState(); 109 ->UpdateAutoHideState();
95 view_ = view; 110 view_ = view;
96 aura::Window* root_window = 111 aura::Window* root_window =
97 ShellPort::Get()->GetRootWindowForDisplayId(display_id); 112 ShellPort::Get()->GetRootWindowForDisplayId(display_id);
98 aura::Window* container = RootWindowController::ForWindow(root_window) 113 aura::Window* container = RootWindowController::ForWindow(root_window)
99 ->GetContainer(kShellWindowId_AppListContainer); 114 ->GetContainer(kShellWindowId_AppListContainer);
100 115
101 view->Initialize(container, current_apps_page); 116 view->Initialize(container, current_apps_page,
117 Shell::Get()
118 ->maximize_mode_controller()
119 ->IsMaximizeModeWindowManagerEnabled(),
120 IsSideShelf(root_window));
102 121
103 if (!app_list::features::IsFullscreenAppListEnabled()) { 122 if (!app_list::features::IsFullscreenAppListEnabled()) {
104 view->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( 123 view->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow(
105 root_window, GetMinimumBoundsHeightForAppList(view))); 124 root_window, GetMinimumBoundsHeightForAppList(view)));
106 } 125 }
107 keyboard::KeyboardController* keyboard_controller = 126 keyboard::KeyboardController* keyboard_controller =
108 keyboard::KeyboardController::GetInstance(); 127 keyboard::KeyboardController::GetInstance();
109 if (keyboard_controller) 128 if (keyboard_controller)
110 keyboard_controller->AddObserver(this); 129 keyboard_controller->AddObserver(this);
111 Shell::Get()->AddPreTargetHandler(this); 130 Shell::Get()->AddPreTargetHandler(this);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 241
223 void AppListPresenterDelegate::OnKeyboardClosed() {} 242 void AppListPresenterDelegate::OnKeyboardClosed() {}
224 243
225 //////////////////////////////////////////////////////////////////////////////// 244 ////////////////////////////////////////////////////////////////////////////////
226 // AppListPresenterDelegate, ShellObserver implementation: 245 // AppListPresenterDelegate, ShellObserver implementation:
227 void AppListPresenterDelegate::OnOverviewModeStarting() { 246 void AppListPresenterDelegate::OnOverviewModeStarting() {
228 if (is_visible_) 247 if (is_visible_)
229 presenter_->Dismiss(); 248 presenter_->Dismiss();
230 } 249 }
231 250
251 void AppListPresenterDelegate::OnMaximizeModeStarted() {
252 if (!app_list::features::IsFullscreenAppListEnabled())
253 return;
254
255 view_->OnMaximizeModeChanged(true);
256 }
257
258 void AppListPresenterDelegate::OnMaximizeModeEnded() {
259 if (!app_list::features::IsFullscreenAppListEnabled())
260 return;
261
262 view_->OnMaximizeModeChanged(false);
263 }
264
232 } // namespace ash 265 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698