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