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/wm/mru_window_tracker.h" | 8 #include "ash/common/wm/mru_window_tracker.h" |
9 #include "ash/common/wm/window_positioner.h" | 9 #include "ash/common/wm/window_positioner.h" |
10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| 11 #include "ash/common/wm_shell.h" |
11 #include "ash/desktop_background/user_wallpaper_delegate.h" | 12 #include "ash/desktop_background/user_wallpaper_delegate.h" |
12 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
13 #include "ash/shelf/shelf_layout_manager.h" | 14 #include "ash/shelf/shelf_layout_manager.h" |
14 #include "ash/shelf/shelf_widget.h" | 15 #include "ash/shelf/shelf_widget.h" |
15 #include "ash/shell.h" | 16 #include "ash/shell.h" |
16 #include "ash/wm/window_state_aura.h" | 17 #include "ash/wm/window_state_aura.h" |
17 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
18 #include "base/macros.h" | 19 #include "base/macros.h" |
19 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 20 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
(...skipping 10 matching lines...) Expand all Loading... |
31 | 32 |
32 // The minimal possible animation time for animations which should happen | 33 // The minimal possible animation time for animations which should happen |
33 // "instantly". | 34 // "instantly". |
34 const int kMinimalAnimationTimeMS = 1; | 35 const int kMinimalAnimationTimeMS = 1; |
35 | 36 |
36 // logic while the user gets switched. | 37 // logic while the user gets switched. |
37 class UserChangeActionDisabler { | 38 class UserChangeActionDisabler { |
38 public: | 39 public: |
39 UserChangeActionDisabler() { | 40 UserChangeActionDisabler() { |
40 ash::WindowPositioner::DisableAutoPositioning(true); | 41 ash::WindowPositioner::DisableAutoPositioning(true); |
41 ash::Shell::GetInstance()->mru_window_tracker()->SetIgnoreActivations(true); | 42 ash::WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(true); |
42 } | 43 } |
43 | 44 |
44 ~UserChangeActionDisabler() { | 45 ~UserChangeActionDisabler() { |
45 ash::WindowPositioner::DisableAutoPositioning(false); | 46 ash::WindowPositioner::DisableAutoPositioning(false); |
46 ash::Shell::GetInstance()->mru_window_tracker()->SetIgnoreActivations( | 47 ash::WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(false); |
47 false); | |
48 } | 48 } |
49 private: | 49 private: |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(UserChangeActionDisabler); | 51 DISALLOW_COPY_AND_ASSIGN(UserChangeActionDisabler); |
52 }; | 52 }; |
53 | 53 |
54 // Defines an animation watcher for the 'hide' animation of the first maximized | 54 // Defines an animation watcher for the 'hide' animation of the first maximized |
55 // window we encounter while looping through the old user's windows. This is | 55 // window we encounter while looping through the old user's windows. This is |
56 // to observe the end of the animation so that we can destruct the old detached | 56 // to observe the end of the animation so that we can destruct the old detached |
57 // layer of the window. | 57 // layer of the window. |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 break; | 356 break; |
357 } | 357 } |
358 case ANIMATION_STEP_SHOW_NEW_USER: { | 358 case ANIMATION_STEP_SHOW_NEW_USER: { |
359 // In order to make the animation look better, we had to move the code | 359 // In order to make the animation look better, we had to move the code |
360 // that shows the new user to the previous step. Hence, we do nothing | 360 // that shows the new user to the previous step. Hence, we do nothing |
361 // here. | 361 // here. |
362 break; | 362 break; |
363 } | 363 } |
364 case ANIMATION_STEP_FINALIZE: { | 364 case ANIMATION_STEP_FINALIZE: { |
365 // Reactivate the MRU window of the new user. | 365 // Reactivate the MRU window of the new user. |
366 aura::Window::Windows mru_list = | 366 aura::Window::Windows mru_list = ash::WmWindowAura::ToAuraWindows( |
367 ash::WmWindowAura::ToAuraWindows(ash::Shell::GetInstance() | 367 ash::WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); |
368 ->mru_window_tracker() | |
369 ->BuildMruWindowList()); | |
370 if (!mru_list.empty()) { | 368 if (!mru_list.empty()) { |
371 aura::Window* window = mru_list[0]; | 369 aura::Window* window = mru_list[0]; |
372 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); | 370 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
373 if (owner_->IsWindowOnDesktopOfUser(window, new_account_id_) && | 371 if (owner_->IsWindowOnDesktopOfUser(window, new_account_id_) && |
374 !window_state->IsMinimized()) { | 372 !window_state->IsMinimized()) { |
375 // Several unit tests come here without an activation client. | 373 // Several unit tests come here without an activation client. |
376 aura::client::ActivationClient* client = | 374 aura::client::ActivationClient* client = |
377 aura::client::GetActivationClient(window->GetRootWindow()); | 375 aura::client::GetActivationClient(window->GetRootWindow()); |
378 if (client) | 376 if (client) |
379 client->ActivateWindow(window); | 377 client->ActivateWindow(window); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 if (itr != window_to_entry_map.end()) { | 433 if (itr != window_to_entry_map.end()) { |
436 windows_by_account_id_[itr->second->show_for_user()].push_back( | 434 windows_by_account_id_[itr->second->show_for_user()].push_back( |
437 child_window); | 435 child_window); |
438 } | 436 } |
439 } | 437 } |
440 } | 438 } |
441 } | 439 } |
442 } | 440 } |
443 | 441 |
444 } // namespace chrome | 442 } // namespace chrome |
OLD | NEW |