Chromium Code Reviews| 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/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
| 8 #include "ash/common/shelf/app_list_button.h" | 8 #include "ash/common/shelf/app_list_button.h" |
| 9 #include "ash/common/shelf/shelf_layout_manager.h" | 9 #include "ash/common/shelf/shelf_layout_manager.h" |
| 10 #include "ash/common/shelf/shelf_widget.h" | 10 #include "ash/common/shelf/shelf_widget.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 // UI layout when AppListView visibility changes. | 92 // UI layout when AppListView visibility changes. |
| 93 ash::Shell::GetPrimaryRootWindowController() | 93 ash::Shell::GetPrimaryRootWindowController() |
| 94 ->GetShelfLayoutManager() | 94 ->GetShelfLayoutManager() |
| 95 ->UpdateAutoHideState(); | 95 ->UpdateAutoHideState(); |
| 96 view_ = view; | 96 view_ = view; |
| 97 WmWindow* wm_root_window = | 97 WmWindow* wm_root_window = |
| 98 WmShell::Get()->GetRootWindowForDisplayId(display_id); | 98 WmShell::Get()->GetRootWindowForDisplayId(display_id); |
| 99 aura::Window* root_window = wm_root_window->aura_window(); | 99 aura::Window* root_window = wm_root_window->aura_window(); |
| 100 aura::Window* container = GetRootWindowController(root_window) | 100 aura::Window* container = GetRootWindowController(root_window) |
| 101 ->GetContainer(kShellWindowId_AppListContainer); | 101 ->GetContainer(kShellWindowId_AppListContainer); |
| 102 view->InitAsBubble(container, current_apps_page); | 102 // fullscreen |
| 103 // The app list is centered over the display. | 103 if (CheckFullscreenAppListEnabled()) { |
|
sky
2017/04/07 03:28:18
IsFullscreenAppListEnabled()? Or perhaps ShouldCre
newcomer
2017/04/10 16:34:53
Done.
| |
| 104 view->SetAnchorPoint(GetCenterOfDisplayForWindow( | 104 view->InitAsFramelessWindow( |
| 105 wm_root_window, GetMinimumBoundsHeightForAppList(view))); | 105 container, current_apps_page, |
| 106 ScreenUtil::GetDisplayWorkAreaBoundsInParent(container)); | |
| 107 } else { | |
| 108 view->InitAsBubble(container, current_apps_page); | |
| 109 // The app list is centered over the display. | |
| 110 view->SetAnchorPoint(GetCenterOfDisplayForWindow( | |
| 111 wm_root_window, GetMinimumBoundsHeightForAppList(view))); | |
| 112 } | |
| 113 | |
| 106 | 114 |
| 107 keyboard::KeyboardController* keyboard_controller = | 115 keyboard::KeyboardController* keyboard_controller = |
| 108 keyboard::KeyboardController::GetInstance(); | 116 keyboard::KeyboardController::GetInstance(); |
| 109 if (keyboard_controller) | 117 if (keyboard_controller) |
| 110 keyboard_controller->AddObserver(this); | 118 keyboard_controller->AddObserver(this); |
| 111 Shell::GetInstance()->AddPreTargetHandler(this); | 119 Shell::GetInstance()->AddPreTargetHandler(this); |
| 112 WmShelf* shelf = WmShelf::ForWindow(wm_root_window); | 120 WmShelf* shelf = WmShelf::ForWindow(wm_root_window); |
| 113 shelf->AddObserver(this); | 121 shelf->AddObserver(this); |
| 114 | 122 |
| 115 // By setting us as DnD recipient, the app list knows that we can | 123 // By setting us as DnD recipient, the app list knows that we can |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 case SHELF_ALIGNMENT_RIGHT: | 178 case SHELF_ALIGNMENT_RIGHT: |
| 171 return gfx::Vector2d(kAnimationOffset, 0); | 179 return gfx::Vector2d(kAnimationOffset, 0); |
| 172 } | 180 } |
| 173 NOTREACHED(); | 181 NOTREACHED(); |
| 174 return gfx::Vector2d(); | 182 return gfx::Vector2d(); |
| 175 } | 183 } |
| 176 | 184 |
| 177 //////////////////////////////////////////////////////////////////////////////// | 185 //////////////////////////////////////////////////////////////////////////////// |
| 178 // AppListPresenterDelegate, private: | 186 // AppListPresenterDelegate, private: |
| 179 | 187 |
| 188 bool AppListPresenterDelegate::CheckFullscreenAppListEnabled() { | |
| 189 return base::CommandLine::ForCurrentProcess()->HasSwitch( | |
|
sky
2017/04/07 03:28:18
This doesn't use any state from AppListPresenterDe
newcomer
2017/04/10 16:34:53
Done.
| |
| 190 switches::kAshEnableFullscreenAppList); | |
| 191 } | |
| 192 | |
| 180 void AppListPresenterDelegate::ProcessLocatedEvent(ui::LocatedEvent* event) { | 193 void AppListPresenterDelegate::ProcessLocatedEvent(ui::LocatedEvent* event) { |
| 181 if (!view_ || !is_visible_) | 194 if (!view_ || !is_visible_) |
| 182 return; | 195 return; |
| 183 | 196 |
| 184 // If the event happened on a menu, then the event should not close the app | 197 // If the event happened on a menu, then the event should not close the app |
| 185 // list. | 198 // list. |
| 186 aura::Window* target = static_cast<aura::Window*>(event->target()); | 199 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 187 if (target) { | 200 if (target) { |
| 188 RootWindowController* root_controller = | 201 RootWindowController* root_controller = |
| 189 GetRootWindowController(target->GetRootWindow()); | 202 GetRootWindowController(target->GetRootWindow()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 } | 251 } |
| 239 | 252 |
| 240 //////////////////////////////////////////////////////////////////////////////// | 253 //////////////////////////////////////////////////////////////////////////////// |
| 241 // AppListPresenterDelegate, WmShelfObserver implementation: | 254 // AppListPresenterDelegate, WmShelfObserver implementation: |
| 242 | 255 |
| 243 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { | 256 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { |
| 244 UpdateBounds(); | 257 UpdateBounds(); |
| 245 } | 258 } |
| 246 | 259 |
| 247 } // namespace ash | 260 } // namespace ash |
| OLD | NEW |