Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc

Issue 2237903003: mash: Migrate Shelf aura::Window uses to WmWindow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move shelf notify functions to WmShell. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/wm_shell.h"
12 #include "ash/common/wm_window.h"
12 #include "ash/desktop_background/user_wallpaper_delegate.h" 13 #include "ash/desktop_background/user_wallpaper_delegate.h"
13 #include "ash/root_window_controller.h" 14 #include "ash/root_window_controller.h"
14 #include "ash/shelf/shelf.h" 15 #include "ash/shelf/shelf.h"
15 #include "ash/shelf/shelf_layout_manager.h" 16 #include "ash/shelf/shelf_layout_manager.h"
16 #include "ash/shelf/shelf_widget.h" 17 #include "ash/shelf/shelf_widget.h"
17 #include "ash/shell.h" 18 #include "ash/shell.h"
18 #include "ash/wm/window_state_aura.h" 19 #include "ash/wm/window_state_aura.h"
19 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
20 #include "base/macros.h" 21 #include "base/macros.h"
21 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 22 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 ChromeLauncherController::instance(); 225 ChromeLauncherController::instance();
225 // The shelf animation duration override. 226 // The shelf animation duration override.
226 int duration_override = animation_speed_ms_; 227 int duration_override = animation_speed_ms_;
227 // 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.
228 if (animation_step == ANIMATION_STEP_SHOW_NEW_USER) { 229 if (animation_step == ANIMATION_STEP_SHOW_NEW_USER) {
229 // Some unit tests have no ChromeLauncherController. 230 // Some unit tests have no ChromeLauncherController.
230 if (chrome_launcher_controller) 231 if (chrome_launcher_controller)
231 chrome_launcher_controller->ActiveUserChanged( 232 chrome_launcher_controller->ActiveUserChanged(
232 new_account_id_.GetUserEmail()); 233 new_account_id_.GetUserEmail());
233 // Hide the black rectangle on top of each shelf again. 234 // Hide the black rectangle on top of each shelf again.
234 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { 235 for (ash::WmWindow* window : ash::WmShell::Get()->GetAllRootWindows()) {
235 ash::ShelfWidget* shelf = ash::Shelf::ForWindow(window)->shelf_widget(); 236 ash::ShelfWidget* shelf = ash::Shelf::ForWindow(window)->shelf_widget();
236 shelf->HideShelfBehindBlackBar(false, duration_override); 237 shelf->HideShelfBehindBlackBar(false, duration_override);
237 } 238 }
238 // 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
239 // removed. 240 // removed.
240 duration_override = 0; 241 duration_override = 0;
241 } 242 }
242 243
243 if (!animation_speed_ms_ || animation_step == ANIMATION_STEP_FINALIZE) 244 if (!animation_speed_ms_ || animation_step == ANIMATION_STEP_FINALIZE)
244 return; 245 return;
(...skipping 12 matching lines...) Expand all
257 return; 258 return;
258 259
259 // For each root window hide the shelf. 260 // For each root window hide the shelf.
260 for (aura::Window* window : ash::Shell::GetAllRootWindows()) { 261 for (aura::Window* window : ash::Shell::GetAllRootWindows()) {
261 // Hiding the shelf will cause a resize on a maximized window. 262 // Hiding the shelf will cause a resize on a maximized window.
262 // 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,
263 // 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
264 // 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
265 // 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
266 // a black rectangle on top. 267 // a black rectangle on top.
267 ash::Shelf* shelf = ash::Shelf::ForWindow(window); 268 ash::Shelf* shelf = ash::Shelf::ForWindow(ash::WmWindowAura::Get(window));
268 if (GetScreenCover(window) != NO_USER_COVERS_SCREEN && 269 if (GetScreenCover(window) != NO_USER_COVERS_SCREEN &&
269 (!chrome_launcher_controller || 270 (!chrome_launcher_controller ||
270 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser( 271 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser(
271 shelf, new_account_id_))) { 272 shelf, new_account_id_))) {
272 shelf->shelf_widget()->HideShelfBehindBlackBar(true, duration_override); 273 shelf->shelf_widget()->HideShelfBehindBlackBar(true, duration_override);
273 } else { 274 } else {
274 // This shelf change is only part of the animation and will be updated by 275 // This shelf change is only part of the animation and will be updated by
275 // ChromeLauncherController::ActiveUserChanged() to the new users value. 276 // ChromeLauncherController::ActiveUserChanged() to the new users value.
276 // Note that the user preference will not be changed. 277 // Note that the user preference will not be changed.
277 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN); 278 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 if (itr != window_to_entry_map.end()) { 436 if (itr != window_to_entry_map.end()) {
436 windows_by_account_id_[itr->second->show_for_user()].push_back( 437 windows_by_account_id_[itr->second->show_for_user()].push_back(
437 child_window); 438 child_window);
438 } 439 }
439 } 440 }
440 } 441 }
441 } 442 }
442 } 443 }
443 444
444 } // namespace chrome 445 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698