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