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/desktop_background/user_wallpaper_delegate.h" | 7 #include "ash/desktop_background/user_wallpaper_delegate.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (itr != window_list->end()) { | 95 if (itr != window_list->end()) { |
96 window_list->erase(itr); | 96 window_list->erase(itr); |
97 window_list->push_back(active_window); | 97 window_list->push_back(active_window); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 } // namespace | 101 } // namespace |
102 | 102 |
103 UserSwitchAnimatorChromeOS::UserSwitchAnimatorChromeOS( | 103 UserSwitchAnimatorChromeOS::UserSwitchAnimatorChromeOS( |
104 MultiUserWindowManagerChromeOS* owner, | 104 MultiUserWindowManagerChromeOS* owner, |
105 const std::string& new_user_id, | 105 const AccountId& new_account_id, |
106 int animation_speed_ms) | 106 int animation_speed_ms) |
107 : owner_(owner), | 107 : owner_(owner), |
108 new_user_id_(new_user_id), | 108 new_account_id_(new_account_id), |
109 animation_speed_ms_(animation_speed_ms), | 109 animation_speed_ms_(animation_speed_ms), |
110 animation_step_(ANIMATION_STEP_HIDE_OLD_USER), | 110 animation_step_(ANIMATION_STEP_HIDE_OLD_USER), |
111 screen_cover_(GetScreenCover(NULL)), | 111 screen_cover_(GetScreenCover(NULL)), |
112 windows_by_user_id_() { | 112 windows_by_account_id_() { |
113 BuildUserToWindowsListMap(); | 113 BuildUserToWindowsListMap(); |
114 AdvanceUserTransitionAnimation(); | 114 AdvanceUserTransitionAnimation(); |
115 | 115 |
116 if (!animation_speed_ms_) { | 116 if (!animation_speed_ms_) { |
117 FinalizeAnimation(); | 117 FinalizeAnimation(); |
118 } else { | 118 } else { |
119 user_changed_animation_timer_.reset(new base::Timer( | 119 user_changed_animation_timer_.reset(new base::Timer( |
120 FROM_HERE, | 120 FROM_HERE, |
121 base::TimeDelta::FromMilliseconds(animation_speed_ms_), | 121 base::TimeDelta::FromMilliseconds(animation_speed_ms_), |
122 base::Bind( | 122 base::Bind( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 ash::UserWallpaperDelegate* wallpaper_delegate = | 186 ash::UserWallpaperDelegate* wallpaper_delegate = |
187 ash::Shell::GetInstance()->user_wallpaper_delegate(); | 187 ash::Shell::GetInstance()->user_wallpaper_delegate(); |
188 if (animation_step == ANIMATION_STEP_HIDE_OLD_USER) { | 188 if (animation_step == ANIMATION_STEP_HIDE_OLD_USER) { |
189 // Set the wallpaper cross dissolve animation duration to our complete | 189 // Set the wallpaper cross dissolve animation duration to our complete |
190 // animation cycle for a fade in and fade out. | 190 // animation cycle for a fade in and fade out. |
191 int duration = | 191 int duration = |
192 NO_USER_COVERS_SCREEN == screen_cover_ ? (2 * animation_speed_ms_) : 0; | 192 NO_USER_COVERS_SCREEN == screen_cover_ ? (2 * animation_speed_ms_) : 0; |
193 wallpaper_delegate->SetAnimationDurationOverride( | 193 wallpaper_delegate->SetAnimationDurationOverride( |
194 std::max(duration, kMinimalAnimationTimeMS)); | 194 std::max(duration, kMinimalAnimationTimeMS)); |
195 if (screen_cover_ != NEW_USER_COVERS_SCREEN) { | 195 if (screen_cover_ != NEW_USER_COVERS_SCREEN) { |
196 chromeos::WallpaperManager::Get()->SetUserWallpaperNow(new_user_id_); | 196 chromeos::WallpaperManager::Get()->SetUserWallpaperNow( |
197 wallpaper_user_id_ = | 197 new_account_id_.GetUserEmail()); |
| 198 wallpaper_user_id_for_test_ = |
198 (NO_USER_COVERS_SCREEN == screen_cover_ ? "->" : "") + | 199 (NO_USER_COVERS_SCREEN == screen_cover_ ? "->" : "") + |
199 new_user_id_; | 200 new_account_id_.GetUserEmail(); |
200 } | 201 } |
201 } else if (animation_step == ANIMATION_STEP_FINALIZE) { | 202 } else if (animation_step == ANIMATION_STEP_FINALIZE) { |
202 // Revert the wallpaper cross dissolve animation duration back to the | 203 // Revert the wallpaper cross dissolve animation duration back to the |
203 // default. | 204 // default. |
204 if (screen_cover_ == NEW_USER_COVERS_SCREEN) | 205 if (screen_cover_ == NEW_USER_COVERS_SCREEN) |
205 chromeos::WallpaperManager::Get()->SetUserWallpaperNow(new_user_id_); | 206 chromeos::WallpaperManager::Get()->SetUserWallpaperNow( |
| 207 new_account_id_.GetUserEmail()); |
206 | 208 |
207 // Coming here the wallpaper user id is the final result. No matter how we | 209 // Coming here the wallpaper user id is the final result. No matter how we |
208 // got here. | 210 // got here. |
209 wallpaper_user_id_ = new_user_id_; | 211 wallpaper_user_id_for_test_ = new_account_id_.GetUserEmail(); |
210 wallpaper_delegate->SetAnimationDurationOverride(0); | 212 wallpaper_delegate->SetAnimationDurationOverride(0); |
211 } | 213 } |
212 } | 214 } |
213 | 215 |
214 void UserSwitchAnimatorChromeOS::TransitionUserShelf( | 216 void UserSwitchAnimatorChromeOS::TransitionUserShelf( |
215 AnimationStep animation_step) { | 217 AnimationStep animation_step) { |
216 ChromeLauncherController* chrome_launcher_controller = | 218 ChromeLauncherController* chrome_launcher_controller = |
217 ChromeLauncherController::instance(); | 219 ChromeLauncherController::instance(); |
218 // The shelf animation duration override. | 220 // The shelf animation duration override. |
219 int duration_override = animation_speed_ms_; | 221 int duration_override = animation_speed_ms_; |
220 // Handle the shelf order of items. This is done once the old user is hidden. | 222 // Handle the shelf order of items. This is done once the old user is hidden. |
221 if (animation_step == ANIMATION_STEP_SHOW_NEW_USER) { | 223 if (animation_step == ANIMATION_STEP_SHOW_NEW_USER) { |
222 // Some unit tests have no ChromeLauncherController. | 224 // Some unit tests have no ChromeLauncherController. |
223 if (chrome_launcher_controller) | 225 if (chrome_launcher_controller) |
224 chrome_launcher_controller->ActiveUserChanged(new_user_id_); | 226 chrome_launcher_controller->ActiveUserChanged( |
| 227 new_account_id_.GetUserEmail()); |
225 // Hide the black rectangle on top of each shelf again. | 228 // Hide the black rectangle on top of each shelf again. |
226 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 229 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); |
227 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); | 230 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); |
228 iter != root_windows.end(); ++iter) { | 231 iter != root_windows.end(); ++iter) { |
229 ash::ShelfWidget* shelf = | 232 ash::ShelfWidget* shelf = |
230 ash::RootWindowController::ForWindow(*iter)->shelf(); | 233 ash::RootWindowController::ForWindow(*iter)->shelf(); |
231 shelf->HideShelfBehindBlackBar(false, duration_override); | 234 shelf->HideShelfBehindBlackBar(false, duration_override); |
232 } | 235 } |
233 // We kicked off the shelf animation above and the override can be | 236 // We kicked off the shelf animation above and the override can be |
234 // removed. | 237 // removed. |
(...skipping 23 matching lines...) Expand all Loading... |
258 iter != root_windows.end(); ++iter) { | 261 iter != root_windows.end(); ++iter) { |
259 // Hiding the shelf will cause a resize on a maximized window. | 262 // Hiding the shelf will cause a resize on a maximized window. |
260 // 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, |
261 // 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 |
262 // 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 |
263 // 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 |
264 // a black rectangle on top. | 267 // a black rectangle on top. |
265 if (GetScreenCover(*iter) != NO_USER_COVERS_SCREEN && | 268 if (GetScreenCover(*iter) != NO_USER_COVERS_SCREEN && |
266 (!chrome_launcher_controller || | 269 (!chrome_launcher_controller || |
267 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser( | 270 !chrome_launcher_controller->ShelfBoundsChangesProbablyWithUser( |
268 *iter, new_user_id_))) { | 271 *iter, new_account_id_.GetUserEmail()))) { |
269 ash::ShelfWidget* shelf = | 272 ash::ShelfWidget* shelf = |
270 ash::RootWindowController::ForWindow(*iter)->shelf(); | 273 ash::RootWindowController::ForWindow(*iter)->shelf(); |
271 shelf->HideShelfBehindBlackBar(true, duration_override); | 274 shelf->HideShelfBehindBlackBar(true, duration_override); |
272 } else { | 275 } else { |
273 // This shelf change is only part of the animation and will be updated by | 276 // This shelf change is only part of the animation and will be updated by |
274 // ChromeLauncherController::ActiveUserChanged() to the new users value. | 277 // ChromeLauncherController::ActiveUserChanged() to the new users value. |
275 // Note that the user preference will not be changed. | 278 // Note that the user preference will not be changed. |
276 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( | 279 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( |
277 ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN, *iter); | 280 ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN, *iter); |
278 } | 281 } |
279 } | 282 } |
280 } | 283 } |
281 | 284 |
282 void UserSwitchAnimatorChromeOS::TransitionWindows( | 285 void UserSwitchAnimatorChromeOS::TransitionWindows( |
283 AnimationStep animation_step) { | 286 AnimationStep animation_step) { |
284 // Disable the window position manager and the MRU window tracker temporarily. | 287 // Disable the window position manager and the MRU window tracker temporarily. |
285 UserChangeActionDisabler disabler; | 288 UserChangeActionDisabler disabler; |
286 | 289 |
287 // Animation duration. | 290 // Animation duration. |
288 int duration = std::max(kMinimalAnimationTimeMS, 2 * animation_speed_ms_); | 291 int duration = std::max(kMinimalAnimationTimeMS, 2 * animation_speed_ms_); |
289 | 292 |
290 switch (animation_step) { | 293 switch (animation_step) { |
291 case ANIMATION_STEP_HIDE_OLD_USER: { | 294 case ANIMATION_STEP_HIDE_OLD_USER: { |
292 // Hide the old users. | 295 // Hide the old users. |
293 for (auto& user_pair : windows_by_user_id_) { | 296 for (auto& user_pair : windows_by_account_id_) { |
294 auto& show_for_user_id = user_pair.first; | 297 auto& show_for_account_id = user_pair.first; |
295 if (show_for_user_id == new_user_id_) | 298 if (show_for_account_id == new_account_id_) |
296 continue; | 299 continue; |
297 | 300 |
298 bool found_foreground_maximized_window = false; | 301 bool found_foreground_maximized_window = false; |
299 | 302 |
300 // We hide the windows such that the MRU window is the last one to be | 303 // We hide the windows such that the MRU window is the last one to be |
301 // hidden, at which point all other windows have already been hidden, | 304 // hidden, at which point all other windows have already been hidden, |
302 // and hence the FocusController will not be able to find a next | 305 // and hence the FocusController will not be able to find a next |
303 // activateable window to restore focus to, and so we don't change | 306 // activateable window to restore focus to, and so we don't change |
304 // window order (crbug.com/424307). | 307 // window order (crbug.com/424307). |
305 PutMruWindowLast(&(user_pair.second)); | 308 PutMruWindowLast(&(user_pair.second)); |
306 for (auto& window : user_pair.second) { | 309 for (auto& window : user_pair.second) { |
307 auto window_state = ash::wm::GetWindowState(window); | 310 auto window_state = ash::wm::GetWindowState(window); |
308 | 311 |
309 // Minimized visiting windows (minimized windows with an owner | 312 // Minimized visiting windows (minimized windows with an owner |
310 // different than that of the for_show_user_id) should retrun to their | 313 // different than that of the for_show_account_id) should retrun to |
| 314 // their |
311 // original owners' desktops. | 315 // original owners' desktops. |
312 MultiUserWindowManagerChromeOS::WindowToEntryMap::const_iterator itr = | 316 MultiUserWindowManagerChromeOS::WindowToEntryMap::const_iterator itr = |
313 owner_->window_to_entry().find(window); | 317 owner_->window_to_entry().find(window); |
314 DCHECK(itr != owner_->window_to_entry().end()); | 318 DCHECK(itr != owner_->window_to_entry().end()); |
315 if (show_for_user_id != itr->second->owner() && | 319 if (show_for_account_id != itr->second->owner() && |
316 window_state->IsMinimized()) { | 320 window_state->IsMinimized()) { |
317 owner_->ShowWindowForUserIntern(window, itr->second->owner()); | 321 owner_->ShowWindowForUserIntern(window, itr->second->owner()); |
318 window_state->Unminimize(); | 322 window_state->Unminimize(); |
319 continue; | 323 continue; |
320 } | 324 } |
321 | 325 |
322 if (!found_foreground_maximized_window && CoversScreen(window) && | 326 if (!found_foreground_maximized_window && CoversScreen(window) && |
323 screen_cover_ == BOTH_USERS_COVER_SCREEN) { | 327 screen_cover_ == BOTH_USERS_COVER_SCREEN) { |
324 // Maximized windows should be hidden, but visually kept visible | 328 // Maximized windows should be hidden, but visually kept visible |
325 // in order to prevent showing the background while the animation is | 329 // in order to prevent showing the background while the animation is |
326 // in progress. Therefore we detach the old layer and recreate fresh | 330 // in progress. Therefore we detach the old layer and recreate fresh |
327 // ones. The old layers will be destructed at the animation step | 331 // ones. The old layers will be destructed at the animation step |
328 // |ANIMATION_STEP_FINALIZE|. | 332 // |ANIMATION_STEP_FINALIZE|. |
329 // old_layers_.push_back(wm::RecreateLayers(window)); | 333 // old_layers_.push_back(wm::RecreateLayers(window)); |
330 // We only want to do this for the first (foreground) maximized | 334 // We only want to do this for the first (foreground) maximized |
331 // window we encounter. | 335 // window we encounter. |
332 found_foreground_maximized_window = true; | 336 found_foreground_maximized_window = true; |
333 ui::LayerTreeOwner* old_layer = | 337 ui::LayerTreeOwner* old_layer = |
334 wm::RecreateLayers(window).release(); | 338 wm::RecreateLayers(window).release(); |
335 window->layer()->parent()->StackAtBottom(old_layer->root()); | 339 window->layer()->parent()->StackAtBottom(old_layer->root()); |
336 new MaximizedWindowAnimationWatcher(window->layer()->GetAnimator(), | 340 new MaximizedWindowAnimationWatcher(window->layer()->GetAnimator(), |
337 old_layer); | 341 old_layer); |
338 } | 342 } |
339 | 343 |
340 owner_->SetWindowVisibility(window, false, duration); | 344 owner_->SetWindowVisibility(window, false, duration); |
341 } | 345 } |
342 } | 346 } |
343 | 347 |
344 // Show new user. | 348 // Show new user. |
345 auto new_user_itr = windows_by_user_id_.find(new_user_id_); | 349 auto new_user_itr = windows_by_account_id_.find(new_account_id_); |
346 if (new_user_itr == windows_by_user_id_.end()) | 350 if (new_user_itr == windows_by_account_id_.end()) |
347 return; | 351 return; |
348 | 352 |
349 for (auto& window : new_user_itr->second) { | 353 for (auto& window : new_user_itr->second) { |
350 auto entry = owner_->window_to_entry().find(window); | 354 auto entry = owner_->window_to_entry().find(window); |
351 DCHECK(entry != owner_->window_to_entry().end()); | 355 DCHECK(entry != owner_->window_to_entry().end()); |
352 | 356 |
353 if (entry->second->show()) | 357 if (entry->second->show()) |
354 owner_->SetWindowVisibility(window, true, duration); | 358 owner_->SetWindowVisibility(window, true, duration); |
355 } | 359 } |
356 | 360 |
357 break; | 361 break; |
358 } | 362 } |
359 case ANIMATION_STEP_SHOW_NEW_USER: { | 363 case ANIMATION_STEP_SHOW_NEW_USER: { |
360 // In order to make the animation look better, we had to move the code | 364 // In order to make the animation look better, we had to move the code |
361 // that shows the new user to the previous step. Hence, we do nothing | 365 // that shows the new user to the previous step. Hence, we do nothing |
362 // here. | 366 // here. |
363 break; | 367 break; |
364 } | 368 } |
365 case ANIMATION_STEP_FINALIZE: { | 369 case ANIMATION_STEP_FINALIZE: { |
366 // Reactivate the MRU window of the new user. | 370 // Reactivate the MRU window of the new user. |
367 ash::MruWindowTracker::WindowList mru_list = | 371 ash::MruWindowTracker::WindowList mru_list = |
368 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); | 372 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); |
369 if (!mru_list.empty()) { | 373 if (!mru_list.empty()) { |
370 aura::Window* window = mru_list[0]; | 374 aura::Window* window = mru_list[0]; |
371 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); | 375 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
372 if (owner_->IsWindowOnDesktopOfUser(window, new_user_id_) && | 376 if (owner_->IsWindowOnDesktopOfUser(window, new_account_id_) && |
373 !window_state->IsMinimized()) { | 377 !window_state->IsMinimized()) { |
374 // Several unit tests come here without an activation client. | 378 // Several unit tests come here without an activation client. |
375 aura::client::ActivationClient* client = | 379 aura::client::ActivationClient* client = |
376 aura::client::GetActivationClient(window->GetRootWindow()); | 380 aura::client::GetActivationClient(window->GetRootWindow()); |
377 if (client) | 381 if (client) |
378 client->ActivateWindow(window); | 382 client->ActivateWindow(window); |
379 } | 383 } |
380 } else { | 384 } else { |
381 // If the new user has no windows at all in his MRU windows list, we | 385 // If the new user has no windows at all in his MRU windows list, we |
382 // must deactivate any active window (by setting the active window to | 386 // must deactivate any active window (by setting the active window to |
383 // |nullptr|). | 387 // |nullptr|). |
384 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); | 388 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); |
385 aura::client::ActivationClient* client = | 389 aura::client::ActivationClient* client = |
386 aura::client::GetActivationClient(root_window); | 390 aura::client::GetActivationClient(root_window); |
387 if (client) | 391 if (client) |
388 client->ActivateWindow(nullptr); | 392 client->ActivateWindow(nullptr); |
389 } | 393 } |
390 | 394 |
391 owner_->notification_blocker()->ActiveUserChanged(new_user_id_); | 395 owner_->notification_blocker()->ActiveUserChanged(new_account_id_); |
392 break; | 396 break; |
393 } | 397 } |
394 case ANIMATION_STEP_ENDED: | 398 case ANIMATION_STEP_ENDED: |
395 NOTREACHED(); | 399 NOTREACHED(); |
396 break; | 400 break; |
397 } | 401 } |
398 } | 402 } |
399 | 403 |
400 UserSwitchAnimatorChromeOS::TransitioningScreenCover | 404 UserSwitchAnimatorChromeOS::TransitioningScreenCover |
401 UserSwitchAnimatorChromeOS::GetScreenCover(aura::Window* root_window) { | 405 UserSwitchAnimatorChromeOS::GetScreenCover(aura::Window* root_window) { |
402 TransitioningScreenCover cover = NO_USER_COVERS_SCREEN; | 406 TransitioningScreenCover cover = NO_USER_COVERS_SCREEN; |
403 for (MultiUserWindowManagerChromeOS::WindowToEntryMap::const_iterator it_map = | 407 for (MultiUserWindowManagerChromeOS::WindowToEntryMap::const_iterator it_map = |
404 owner_->window_to_entry().begin(); | 408 owner_->window_to_entry().begin(); |
405 it_map != owner_->window_to_entry().end(); | 409 it_map != owner_->window_to_entry().end(); |
406 ++it_map) { | 410 ++it_map) { |
407 aura::Window* window = it_map->first; | 411 aura::Window* window = it_map->first; |
408 if (root_window && window->GetRootWindow() != root_window) | 412 if (root_window && window->GetRootWindow() != root_window) |
409 continue; | 413 continue; |
410 if (window->IsVisible() && CoversScreen(window)) { | 414 if (window->IsVisible() && CoversScreen(window)) { |
411 if (cover == NEW_USER_COVERS_SCREEN) | 415 if (cover == NEW_USER_COVERS_SCREEN) |
412 return BOTH_USERS_COVER_SCREEN; | 416 return BOTH_USERS_COVER_SCREEN; |
413 else | 417 else |
414 cover = OLD_USER_COVERS_SCREEN; | 418 cover = OLD_USER_COVERS_SCREEN; |
415 } else if (owner_->IsWindowOnDesktopOfUser(window, new_user_id_) && | 419 } else if (owner_->IsWindowOnDesktopOfUser(window, new_account_id_) && |
416 CoversScreen(window)) { | 420 CoversScreen(window)) { |
417 if (cover == OLD_USER_COVERS_SCREEN) | 421 if (cover == OLD_USER_COVERS_SCREEN) |
418 return BOTH_USERS_COVER_SCREEN; | 422 return BOTH_USERS_COVER_SCREEN; |
419 else | 423 else |
420 cover = NEW_USER_COVERS_SCREEN; | 424 cover = NEW_USER_COVERS_SCREEN; |
421 } | 425 } |
422 } | 426 } |
423 return cover; | 427 return cover; |
424 } | 428 } |
425 | 429 |
426 void UserSwitchAnimatorChromeOS::BuildUserToWindowsListMap() { | 430 void UserSwitchAnimatorChromeOS::BuildUserToWindowsListMap() { |
427 // This is to be called only at the time this animation is constructed. | 431 // This is to be called only at the time this animation is constructed. |
428 DCHECK(windows_by_user_id_.empty()); | 432 DCHECK(windows_by_account_id_.empty()); |
429 | 433 |
430 // For each unique parent window, we enumerate its children windows, and | 434 // For each unique parent window, we enumerate its children windows, and |
431 // for each child if it's in the |window_to_entry()| map, we add it to the | 435 // for each child if it's in the |window_to_entry()| map, we add it to the |
432 // |windows_by_user_id_| map. | 436 // |windows_by_account_id_| map. |
433 // This gives us a list of windows per each user that is in the same order | 437 // This gives us a list of windows per each user that is in the same order |
434 // they were created in their parent windows. | 438 // they were created in their parent windows. |
435 std::set<aura::Window*> parent_windows; | 439 std::set<aura::Window*> parent_windows; |
436 auto& window_to_entry_map = owner_->window_to_entry(); | 440 auto& window_to_entry_map = owner_->window_to_entry(); |
437 for (auto& window_entry_pair : window_to_entry_map) { | 441 for (auto& window_entry_pair : window_to_entry_map) { |
438 aura::Window* parent_window = window_entry_pair.first->parent(); | 442 aura::Window* parent_window = window_entry_pair.first->parent(); |
439 if (parent_windows.find(parent_window) == parent_windows.end()) { | 443 if (parent_windows.find(parent_window) == parent_windows.end()) { |
440 parent_windows.insert(parent_window); | 444 parent_windows.insert(parent_window); |
441 for (auto& child_window : parent_window->children()) { | 445 for (auto& child_window : parent_window->children()) { |
442 auto itr = window_to_entry_map.find(child_window); | 446 auto itr = window_to_entry_map.find(child_window); |
443 if (itr != window_to_entry_map.end()) { | 447 if (itr != window_to_entry_map.end()) { |
444 windows_by_user_id_[itr->second->show_for_user()].push_back( | 448 windows_by_account_id_[itr->second->show_for_user()].push_back( |
445 child_window); | 449 child_window); |
446 } | 450 } |
447 } | 451 } |
448 } | 452 } |
449 } | 453 } |
450 } | 454 } |
451 | 455 |
452 } // namespace chrome | 456 } // namespace chrome |
OLD | NEW |