| 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/common/shelf/shelf_layout_manager.h" | 7 #include "ash/common/shelf/shelf_layout_manager.h" |
| 8 #include "ash/common/shelf/shelf_widget.h" | 8 #include "ash/common/shelf/shelf_widget.h" |
| 9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
| 10 #include "ash/common/wallpaper/wallpaper_delegate.h" | 10 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // The minimal possible animation time for animations which should happen | 35 // The minimal possible animation time for animations which should happen |
| 36 // "instantly". | 36 // "instantly". |
| 37 const int kMinimalAnimationTimeMS = 1; | 37 const int kMinimalAnimationTimeMS = 1; |
| 38 | 38 |
| 39 // logic while the user gets switched. | 39 // logic while the user gets switched. |
| 40 class UserChangeActionDisabler { | 40 class UserChangeActionDisabler { |
| 41 public: | 41 public: |
| 42 UserChangeActionDisabler() { | 42 UserChangeActionDisabler() { |
| 43 ash::WindowPositioner::DisableAutoPositioning(true); | 43 ash::WindowPositioner::DisableAutoPositioning(true); |
| 44 ash::WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(true); | 44 ash::Shell::Get()->mru_window_tracker()->SetIgnoreActivations(true); |
| 45 } | 45 } |
| 46 | 46 |
| 47 ~UserChangeActionDisabler() { | 47 ~UserChangeActionDisabler() { |
| 48 ash::WindowPositioner::DisableAutoPositioning(false); | 48 ash::WindowPositioner::DisableAutoPositioning(false); |
| 49 ash::WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(false); | 49 ash::Shell::Get()->mru_window_tracker()->SetIgnoreActivations(false); |
| 50 } | 50 } |
| 51 private: | 51 private: |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(UserChangeActionDisabler); | 53 DISALLOW_COPY_AND_ASSIGN(UserChangeActionDisabler); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // Defines an animation watcher for the 'hide' animation of the first maximized | 56 // Defines an animation watcher for the 'hide' animation of the first maximized |
| 57 // window we encounter while looping through the old user's windows. This is | 57 // window we encounter while looping through the old user's windows. This is |
| 58 // to observe the end of the animation so that we can destruct the old detached | 58 // to observe the end of the animation so that we can destruct the old detached |
| 59 // layer of the window. | 59 // layer of the window. |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 359 } |
| 360 case ANIMATION_STEP_SHOW_NEW_USER: { | 360 case ANIMATION_STEP_SHOW_NEW_USER: { |
| 361 // 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 |
| 362 // 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 |
| 363 // here. | 363 // here. |
| 364 break; | 364 break; |
| 365 } | 365 } |
| 366 case ANIMATION_STEP_FINALIZE: { | 366 case ANIMATION_STEP_FINALIZE: { |
| 367 // Reactivate the MRU window of the new user. | 367 // Reactivate the MRU window of the new user. |
| 368 aura::Window::Windows mru_list = ash::WmWindow::ToAuraWindows( | 368 aura::Window::Windows mru_list = ash::WmWindow::ToAuraWindows( |
| 369 ash::WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); | 369 ash::Shell::Get()->mru_window_tracker()->BuildMruWindowList()); |
| 370 if (!mru_list.empty()) { | 370 if (!mru_list.empty()) { |
| 371 aura::Window* window = mru_list[0]; | 371 aura::Window* window = mru_list[0]; |
| 372 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); | 372 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
| 373 if (owner_->IsWindowOnDesktopOfUser(window, new_account_id_) && | 373 if (owner_->IsWindowOnDesktopOfUser(window, new_account_id_) && |
| 374 !window_state->IsMinimized()) { | 374 !window_state->IsMinimized()) { |
| 375 // Several unit tests come here without an activation client. | 375 // Several unit tests come here without an activation client. |
| 376 aura::client::ActivationClient* client = | 376 aura::client::ActivationClient* client = |
| 377 aura::client::GetActivationClient(window->GetRootWindow()); | 377 aura::client::GetActivationClient(window->GetRootWindow()); |
| 378 if (client) | 378 if (client) |
| 379 client->ActivateWindow(window); | 379 client->ActivateWindow(window); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 if (itr != window_to_entry_map.end()) { | 435 if (itr != window_to_entry_map.end()) { |
| 436 windows_by_account_id_[itr->second->show_for_user()].push_back( | 436 windows_by_account_id_[itr->second->show_for_user()].push_back( |
| 437 child_window); | 437 child_window); |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace chrome | 444 } // namespace chrome |
| OLD | NEW |