 Chromium Code Reviews
 Chromium Code Reviews Issue 2939693004:
  Added HALF, FULLSCREEN_ALL_APPS, and FULLSCREEN_SEARCH.  (Closed)
    
  
    Issue 2939693004:
  Added HALF, FULLSCREEN_ALL_APPS, and FULLSCREEN_SEARCH.  (Closed) 
  | 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 // UI layout when AppListView visibility changes. | 91 // UI layout when AppListView visibility changes. | 
| 92 Shell::GetPrimaryRootWindowController() | 92 Shell::GetPrimaryRootWindowController() | 
| 93 ->GetShelfLayoutManager() | 93 ->GetShelfLayoutManager() | 
| 94 ->UpdateAutoHideState(); | 94 ->UpdateAutoHideState(); | 
| 95 view_ = view; | 95 view_ = view; | 
| 96 aura::Window* root_window = | 96 aura::Window* root_window = | 
| 97 ShellPort::Get()->GetRootWindowForDisplayId(display_id); | 97 ShellPort::Get()->GetRootWindowForDisplayId(display_id); | 
| 98 aura::Window* container = RootWindowController::ForWindow(root_window) | 98 aura::Window* container = RootWindowController::ForWindow(root_window) | 
| 99 ->GetContainer(kShellWindowId_AppListContainer); | 99 ->GetContainer(kShellWindowId_AppListContainer); | 
| 100 | 100 | 
| 101 view->Initialize(container, current_apps_page); | 101 view->Initialize(container, current_apps_page, IsMaximizeModeActive(), | 
| 102 IsSideShelf()); | |
| 102 | 103 | 
| 103 if (!app_list::features::IsFullscreenAppListEnabled()) { | 104 if (!app_list::features::IsFullscreenAppListEnabled()) { | 
| 104 view->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( | 105 view->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( | 
| 105 root_window, GetMinimumBoundsHeightForAppList(view))); | 106 root_window, GetMinimumBoundsHeightForAppList(view))); | 
| 106 } | 107 } | 
| 107 keyboard::KeyboardController* keyboard_controller = | 108 keyboard::KeyboardController* keyboard_controller = | 
| 108 keyboard::KeyboardController::GetInstance(); | 109 keyboard::KeyboardController::GetInstance(); | 
| 109 if (keyboard_controller) | 110 if (keyboard_controller) | 
| 110 keyboard_controller->AddObserver(this); | 111 keyboard_controller->AddObserver(this); | 
| 111 Shell::Get()->AddPreTargetHandler(this); | 112 Shell::Get()->AddPreTargetHandler(this); | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 return gfx::Vector2d(0, kAnimationOffset); | 160 return gfx::Vector2d(0, kAnimationOffset); | 
| 160 case SHELF_ALIGNMENT_LEFT: | 161 case SHELF_ALIGNMENT_LEFT: | 
| 161 return gfx::Vector2d(-kAnimationOffset, 0); | 162 return gfx::Vector2d(-kAnimationOffset, 0); | 
| 162 case SHELF_ALIGNMENT_RIGHT: | 163 case SHELF_ALIGNMENT_RIGHT: | 
| 163 return gfx::Vector2d(kAnimationOffset, 0); | 164 return gfx::Vector2d(kAnimationOffset, 0); | 
| 164 } | 165 } | 
| 165 NOTREACHED(); | 166 NOTREACHED(); | 
| 166 return gfx::Vector2d(); | 167 return gfx::Vector2d(); | 
| 167 } | 168 } | 
| 168 | 169 | 
| 170 bool AppListPresenterDelegate::IsMaximizeModeActive() const { | |
| 171 MaximizeModeController* maximize_mode_controller = | |
| 172 Shell::Get()->maximize_mode_controller(); | |
| 173 return maximize_mode_controller && | |
| 
oshima
2017/06/13 22:26:04
maximize_mode_controller should never be null.
Th
 
newcomer
2017/06/13 23:00:39
Thanks! Done.
 | |
| 174 maximize_mode_controller->IsMaximizeModeWindowManagerEnabled(); | |
| 175 } | |
| 176 | |
| 177 bool AppListPresenterDelegate::IsSideShelf() const { | |
| 178 aura::Window* root_window = | |
| 179 RootWindowController::ForTargetRootWindow()->GetRootWindow(); | |
| 
xiyuan
2017/06/13 21:38:58
This does not look right for multi-display case. T
 
newcomer
2017/06/13 22:22:47
Done.
 | |
| 180 Shelf* shelf = Shelf::ForWindow(root_window); | |
| 181 switch (shelf->alignment()) { | |
| 182 case SHELF_ALIGNMENT_BOTTOM: | |
| 183 case SHELF_ALIGNMENT_BOTTOM_LOCKED: | |
| 184 return false; | |
| 185 case SHELF_ALIGNMENT_LEFT: | |
| 186 case SHELF_ALIGNMENT_RIGHT: | |
| 187 return true; | |
| 188 } | |
| 
oshima
2017/06/13 22:26:04
don't you need return?
 
newcomer
2017/06/13 23:00:39
The return statements are in the switch. I refacto
 | |
| 189 } | |
| 190 | |
| 169 //////////////////////////////////////////////////////////////////////////////// | 191 //////////////////////////////////////////////////////////////////////////////// | 
| 170 // AppListPresenterDelegate, private: | 192 // AppListPresenterDelegate, private: | 
| 171 | 193 | 
| 172 void AppListPresenterDelegate::ProcessLocatedEvent(ui::LocatedEvent* event) { | 194 void AppListPresenterDelegate::ProcessLocatedEvent(ui::LocatedEvent* event) { | 
| 173 if (!view_ || !is_visible_) | 195 if (!view_ || !is_visible_) | 
| 174 return; | 196 return; | 
| 175 | 197 | 
| 176 // If the event happened on a menu, then the event should not close the app | 198 // If the event happened on a menu, then the event should not close the app | 
| 177 // list. | 199 // list. | 
| 178 aura::Window* target = static_cast<aura::Window*>(event->target()); | 200 aura::Window* target = static_cast<aura::Window*>(event->target()); | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 244 | 
| 223 void AppListPresenterDelegate::OnKeyboardClosed() {} | 245 void AppListPresenterDelegate::OnKeyboardClosed() {} | 
| 224 | 246 | 
| 225 //////////////////////////////////////////////////////////////////////////////// | 247 //////////////////////////////////////////////////////////////////////////////// | 
| 226 // AppListPresenterDelegate, ShellObserver implementation: | 248 // AppListPresenterDelegate, ShellObserver implementation: | 
| 227 void AppListPresenterDelegate::OnOverviewModeStarting() { | 249 void AppListPresenterDelegate::OnOverviewModeStarting() { | 
| 228 if (is_visible_) | 250 if (is_visible_) | 
| 229 presenter_->Dismiss(); | 251 presenter_->Dismiss(); | 
| 230 } | 252 } | 
| 231 | 253 | 
| 254 void AppListPresenterDelegate::OnMaximizeModeStarted() { | |
| 255 if (!app_list::features::IsFullscreenAppListEnabled()) | |
| 256 return; | |
| 257 | |
| 258 view_->OnMaximizeModeChanged(true); | |
| 259 } | |
| 260 | |
| 261 void AppListPresenterDelegate::OnMaximizeModeEnded() { | |
| 262 if (!app_list::features::IsFullscreenAppListEnabled()) | |
| 263 return; | |
| 264 | |
| 265 view_->OnMaximizeModeChanged(false); | |
| 266 } | |
| 267 | |
| 232 } // namespace ash | 268 } // namespace ash | 
| OLD | NEW |