OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.h" | 5 #include "chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/shelf/shelf.h" | |
9 #include "ash/common/shelf/shelf_layout_manager.h" | 8 #include "ash/common/shelf/shelf_layout_manager.h" |
10 #include "ash/common/shelf/shelf_widget.h" | 9 #include "ash/common/shelf/shelf_widget.h" |
11 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
12 #include "ash/common/wallpaper/wallpaper_delegate.h" | 11 #include "ash/common/wallpaper/wallpaper_delegate.h" |
13 #include "ash/common/wm/mru_window_tracker.h" | 12 #include "ash/common/wm/mru_window_tracker.h" |
14 #include "ash/common/wm/window_positioner.h" | 13 #include "ash/common/wm/window_positioner.h" |
15 #include "ash/common/wm/window_state.h" | 14 #include "ash/common/wm/window_state.h" |
16 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
17 #include "ash/common/wm_window.h" | 16 #include "ash/common/wm_window.h" |
18 #include "ash/root_window_controller.h" | 17 #include "ash/root_window_controller.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // The shelf animation duration override. | 226 // The shelf animation duration override. |
228 int duration_override = animation_speed_ms_; | 227 int duration_override = animation_speed_ms_; |
229 // Handle the shelf order of items. This is done once the old user is hidden. | 228 // Handle the shelf order of items. This is done once the old user is hidden. |
230 if (animation_step == ANIMATION_STEP_SHOW_NEW_USER) { | 229 if (animation_step == ANIMATION_STEP_SHOW_NEW_USER) { |
231 // Some unit tests have no ChromeLauncherController. | 230 // Some unit tests have no ChromeLauncherController. |
232 if (chrome_launcher_controller) | 231 if (chrome_launcher_controller) |
233 chrome_launcher_controller->ActiveUserChanged( | 232 chrome_launcher_controller->ActiveUserChanged( |
234 new_account_id_.GetUserEmail()); | 233 new_account_id_.GetUserEmail()); |
235 // Hide the black rectangle on top of each shelf again. | 234 // Hide the black rectangle on top of each shelf again. |
236 for (ash::WmWindow* window : ash::WmShell::Get()->GetAllRootWindows()) { | 235 for (ash::WmWindow* window : ash::WmShell::Get()->GetAllRootWindows()) { |
237 ash::ShelfWidget* shelf = ash::Shelf::ForWindow(window)->shelf_widget(); | 236 ash::ShelfWidget* shelf = ash::WmShelf::ForWindow(window)->shelf_widget(); |
238 shelf->HideShelfBehindBlackBar(false, duration_override); | 237 shelf->HideShelfBehindBlackBar(false, duration_override); |
239 } | 238 } |
240 // We kicked off the shelf animation above and the override can be | 239 // We kicked off the shelf animation above and the override can be |
241 // removed. | 240 // removed. |
242 duration_override = 0; | 241 duration_override = 0; |
243 } | 242 } |
244 | 243 |
245 if (!animation_speed_ms_ || animation_step == ANIMATION_STEP_FINALIZE) | 244 if (!animation_speed_ms_ || animation_step == ANIMATION_STEP_FINALIZE) |
246 return; | 245 return; |
247 | 246 |
(...skipping 11 matching lines...) Expand all Loading... |
259 return; | 258 return; |
260 | 259 |
261 // For each root window hide the shelf. | 260 // For each root window hide the shelf. |
262 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { | 261 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { |
263 // Hiding the shelf will cause a resize on a maximized window. | 262 // Hiding the shelf will cause a resize on a maximized window. |
264 // If the shelf is then shown for the following user in the same location, | 263 // If the shelf is then shown for the following user in the same location, |
265 // the window gets resized again. Since each resize can cause a considerable | 264 // the window gets resized again. Since each resize can cause a considerable |
266 // CPU usage and therefore effect jank, we should avoid hiding the shelf if | 265 // CPU usage and therefore effect jank, we should avoid hiding the shelf if |
267 // the start and end location are the same and cover the shelf instead with | 266 // the start and end location are the same and cover the shelf instead with |
268 // a black rectangle on top. | 267 // a black rectangle on top. |
269 ash::Shelf* shelf = ash::Shelf::ForWindow(ash::WmWindowAura::Get(window)); | 268 ash::WmShelf* shelf = |
| 269 ash::WmShelf::ForWindow(ash::WmWindowAura::Get(window)); |
270 if (GetScreenCover(window) != NO_USER_COVERS_SCREEN && | 270 if (GetScreenCover(window) != NO_USER_COVERS_SCREEN && |
271 (!chrome_launcher_controller || | 271 (!chrome_launcher_controller || |
272 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser( | 272 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser( |
273 shelf, new_account_id_))) { | 273 shelf, new_account_id_))) { |
274 shelf->shelf_widget()->HideShelfBehindBlackBar(true, duration_override); | 274 shelf->shelf_widget()->HideShelfBehindBlackBar(true, duration_override); |
275 } else { | 275 } else { |
276 // This shelf change is only part of the animation and will be updated by | 276 // This shelf change is only part of the animation and will be updated by |
277 // ChromeLauncherController::ActiveUserChanged() to the new users value. | 277 // ChromeLauncherController::ActiveUserChanged() to the new users value. |
278 // Note that the user preference will not be changed. | 278 // Note that the user preference will not be changed. |
279 shelf->wm_shelf()->SetAutoHideBehavior( | 279 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN); |
280 ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN); | |
281 } | 280 } |
282 } | 281 } |
283 } | 282 } |
284 | 283 |
285 void UserSwitchAnimatorChromeOS::TransitionWindows( | 284 void UserSwitchAnimatorChromeOS::TransitionWindows( |
286 AnimationStep animation_step) { | 285 AnimationStep animation_step) { |
287 // Disable the window position manager and the MRU window tracker temporarily. | 286 // Disable the window position manager and the MRU window tracker temporarily. |
288 UserChangeActionDisabler disabler; | 287 UserChangeActionDisabler disabler; |
289 | 288 |
290 // Animation duration. | 289 // Animation duration. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 if (itr != window_to_entry_map.end()) { | 437 if (itr != window_to_entry_map.end()) { |
439 windows_by_account_id_[itr->second->show_for_user()].push_back( | 438 windows_by_account_id_[itr->second->show_for_user()].push_back( |
440 child_window); | 439 child_window); |
441 } | 440 } |
442 } | 441 } |
443 } | 442 } |
444 } | 443 } |
445 } | 444 } |
446 | 445 |
447 } // namespace chrome | 446 } // namespace chrome |
OLD | NEW |