| 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/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
| 10 #include "ash/shelf/wm_shelf.h" | |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_port.h" | 12 #include "ash/shell_port.h" |
| 13 #include "ash/wallpaper/wallpaper_delegate.h" | 13 #include "ash/wallpaper/wallpaper_delegate.h" |
| 14 #include "ash/wm/mru_window_tracker.h" | 14 #include "ash/wm/mru_window_tracker.h" |
| 15 #include "ash/wm/window_positioner.h" | 15 #include "ash/wm/window_positioner.h" |
| 16 #include "ash/wm/window_state.h" | 16 #include "ash/wm/window_state.h" |
| 17 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
| 18 #include "ash/wm_window.h" | 18 #include "ash/wm_window.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 20 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // The shelf animation duration override. | 224 // The shelf animation duration override. |
| 225 int duration_override = animation_speed_ms_; | 225 int duration_override = animation_speed_ms_; |
| 226 // Handle the shelf order of items. This is done once the old user is hidden. | 226 // Handle the shelf order of items. This is done once the old user is hidden. |
| 227 if (animation_step == ANIMATION_STEP_SHOW_NEW_USER) { | 227 if (animation_step == ANIMATION_STEP_SHOW_NEW_USER) { |
| 228 // Some unit tests have no ChromeLauncherController. | 228 // Some unit tests have no ChromeLauncherController. |
| 229 if (chrome_launcher_controller) | 229 if (chrome_launcher_controller) |
| 230 chrome_launcher_controller->ActiveUserChanged( | 230 chrome_launcher_controller->ActiveUserChanged( |
| 231 new_account_id_.GetUserEmail()); | 231 new_account_id_.GetUserEmail()); |
| 232 // Hide the black rectangle on top of each shelf again. | 232 // Hide the black rectangle on top of each shelf again. |
| 233 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { | 233 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { |
| 234 ash::ShelfWidget* shelf = ash::WmShelf::ForWindow(window)->shelf_widget(); | 234 ash::ShelfWidget* shelf = ash::Shelf::ForWindow(window)->shelf_widget(); |
| 235 shelf->HideShelfBehindBlackBar(false, duration_override); | 235 shelf->HideShelfBehindBlackBar(false, duration_override); |
| 236 } | 236 } |
| 237 // We kicked off the shelf animation above and the override can be | 237 // We kicked off the shelf animation above and the override can be |
| 238 // removed. | 238 // removed. |
| 239 duration_override = 0; | 239 duration_override = 0; |
| 240 } | 240 } |
| 241 | 241 |
| 242 if (!animation_speed_ms_ || animation_step == ANIMATION_STEP_FINALIZE) | 242 if (!animation_speed_ms_ || animation_step == ANIMATION_STEP_FINALIZE) |
| 243 return; | 243 return; |
| 244 | 244 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 256 return; | 256 return; |
| 257 | 257 |
| 258 // For each root window hide the shelf. | 258 // For each root window hide the shelf. |
| 259 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { | 259 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { |
| 260 // Hiding the shelf will cause a resize on a maximized window. | 260 // Hiding the shelf will cause a resize on a maximized window. |
| 261 // If the shelf is then shown for the following user in the same location, | 261 // If the shelf is then shown for the following user in the same location, |
| 262 // the window gets resized again. Since each resize can cause a considerable | 262 // the window gets resized again. Since each resize can cause a considerable |
| 263 // CPU usage and therefore effect jank, we should avoid hiding the shelf if | 263 // CPU usage and therefore effect jank, we should avoid hiding the shelf if |
| 264 // the start and end location are the same and cover the shelf instead with | 264 // the start and end location are the same and cover the shelf instead with |
| 265 // a black rectangle on top. | 265 // a black rectangle on top. |
| 266 ash::WmShelf* shelf = ash::WmShelf::ForWindow(window); | 266 ash::Shelf* shelf = ash::Shelf::ForWindow(window); |
| 267 if (GetScreenCover(window) != NO_USER_COVERS_SCREEN && | 267 if (GetScreenCover(window) != NO_USER_COVERS_SCREEN && |
| 268 (!chrome_launcher_controller || | 268 (!chrome_launcher_controller || |
| 269 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser( | 269 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser( |
| 270 shelf, new_account_id_))) { | 270 shelf, new_account_id_))) { |
| 271 shelf->shelf_widget()->HideShelfBehindBlackBar(true, duration_override); | 271 shelf->shelf_widget()->HideShelfBehindBlackBar(true, duration_override); |
| 272 } else { | 272 } else { |
| 273 // This shelf change is only part of the animation and will be updated by | 273 // This shelf change is only part of the animation and will be updated by |
| 274 // ChromeLauncherController::ActiveUserChanged() to the new users value. | 274 // ChromeLauncherController::ActiveUserChanged() to the new users value. |
| 275 // Note that the user preference will not be changed. | 275 // Note that the user preference will not be changed. |
| 276 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN); | 276 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 if (itr != window_to_entry_map.end()) { | 434 if (itr != window_to_entry_map.end()) { |
| 435 windows_by_account_id_[itr->second->show_for_user()].push_back( | 435 windows_by_account_id_[itr->second->show_for_user()].push_back( |
| 436 child_window); | 436 child_window); |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 | 442 |
| 443 } // namespace chrome | 443 } // namespace chrome |
| OLD | NEW |