| 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" | |
| 8 #include "ash/common/shelf/shelf_layout_manager.h" | 7 #include "ash/common/shelf/shelf_layout_manager.h" |
| 9 #include "ash/common/shelf/shelf_widget.h" | 8 #include "ash/common/shelf/shelf_widget.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/wallpaper/wallpaper_delegate.h" | 10 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 12 #include "ash/common/wm/mru_window_tracker.h" | 11 #include "ash/common/wm/mru_window_tracker.h" |
| 13 #include "ash/common/wm/window_positioner.h" | 12 #include "ash/common/wm/window_positioner.h" |
| 14 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
| 15 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 16 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.h" |
| 17 #include "ash/root_window_controller.h" | 16 #include "ash/root_window_controller.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 return; | 257 return; |
| 259 | 258 |
| 260 // For each root window hide the shelf. | 259 // For each root window hide the shelf. |
| 261 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { | 260 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { |
| 262 // Hiding the shelf will cause a resize on a maximized window. | 261 // Hiding the shelf will cause a resize on a maximized window. |
| 263 // If the shelf is then shown for the following user in the same location, | 262 // If the shelf is then shown for the following user in the same location, |
| 264 // the window gets resized again. Since each resize can cause a considerable | 263 // the window gets resized again. Since each resize can cause a considerable |
| 265 // CPU usage and therefore effect jank, we should avoid hiding the shelf if | 264 // CPU usage and therefore effect jank, we should avoid hiding the shelf if |
| 266 // the start and end location are the same and cover the shelf instead with | 265 // the start and end location are the same and cover the shelf instead with |
| 267 // a black rectangle on top. | 266 // a black rectangle on top. |
| 268 ash::WmShelf* shelf = | 267 ash::WmShelf* shelf = ash::WmShelf::ForWindow(ash::WmWindow::Get(window)); |
| 269 ash::WmShelf::ForWindow(ash::WmWindowAura::Get(window)); | |
| 270 if (GetScreenCover(window) != NO_USER_COVERS_SCREEN && | 268 if (GetScreenCover(window) != NO_USER_COVERS_SCREEN && |
| 271 (!chrome_launcher_controller || | 269 (!chrome_launcher_controller || |
| 272 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser( | 270 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser( |
| 273 shelf, new_account_id_))) { | 271 shelf, new_account_id_))) { |
| 274 shelf->shelf_widget()->HideShelfBehindBlackBar(true, duration_override); | 272 shelf->shelf_widget()->HideShelfBehindBlackBar(true, duration_override); |
| 275 } else { | 273 } else { |
| 276 // This shelf change is only part of the animation and will be updated by | 274 // This shelf change is only part of the animation and will be updated by |
| 277 // ChromeLauncherController::ActiveUserChanged() to the new users value. | 275 // ChromeLauncherController::ActiveUserChanged() to the new users value. |
| 278 // Note that the user preference will not be changed. | 276 // Note that the user preference will not be changed. |
| 279 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN); | 277 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 break; | 358 break; |
| 361 } | 359 } |
| 362 case ANIMATION_STEP_SHOW_NEW_USER: { | 360 case ANIMATION_STEP_SHOW_NEW_USER: { |
| 363 // In order to make the animation look better, we had to move the code | 361 // In order to make the animation look better, we had to move the code |
| 364 // that shows the new user to the previous step. Hence, we do nothing | 362 // that shows the new user to the previous step. Hence, we do nothing |
| 365 // here. | 363 // here. |
| 366 break; | 364 break; |
| 367 } | 365 } |
| 368 case ANIMATION_STEP_FINALIZE: { | 366 case ANIMATION_STEP_FINALIZE: { |
| 369 // Reactivate the MRU window of the new user. | 367 // Reactivate the MRU window of the new user. |
| 370 aura::Window::Windows mru_list = ash::WmWindowAura::ToAuraWindows( | 368 aura::Window::Windows mru_list = ash::WmWindow::ToAuraWindows( |
| 371 ash::WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); | 369 ash::WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); |
| 372 if (!mru_list.empty()) { | 370 if (!mru_list.empty()) { |
| 373 aura::Window* window = mru_list[0]; | 371 aura::Window* window = mru_list[0]; |
| 374 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); | 372 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
| 375 if (owner_->IsWindowOnDesktopOfUser(window, new_account_id_) && | 373 if (owner_->IsWindowOnDesktopOfUser(window, new_account_id_) && |
| 376 !window_state->IsMinimized()) { | 374 !window_state->IsMinimized()) { |
| 377 // Several unit tests come here without an activation client. | 375 // Several unit tests come here without an activation client. |
| 378 aura::client::ActivationClient* client = | 376 aura::client::ActivationClient* client = |
| 379 aura::client::GetActivationClient(window->GetRootWindow()); | 377 aura::client::GetActivationClient(window->GetRootWindow()); |
| 380 if (client) | 378 if (client) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 if (itr != window_to_entry_map.end()) { | 435 if (itr != window_to_entry_map.end()) { |
| 438 windows_by_account_id_[itr->second->show_for_user()].push_back( | 436 windows_by_account_id_[itr->second->show_for_user()].push_back( |
| 439 child_window); | 437 child_window); |
| 440 } | 438 } |
| 441 } | 439 } |
| 442 } | 440 } |
| 443 } | 441 } |
| 444 } | 442 } |
| 445 | 443 |
| 446 } // namespace chrome | 444 } // namespace chrome |
| OLD | NEW |