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

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

Issue 1688343002: Fix the mis-showing of the panel window during profile switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/multi_user_window_manager_chromeos.h" 5 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/multi_profile_uma.h" 8 #include "ash/multi_profile_uma.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/session/session_state_delegate.h" 10 #include "ash/session/session_state_delegate.h"
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 SetWindowVisibility(window, false, kTeleportAnimationTimeMS); 620 SetWindowVisibility(window, false, kTeleportAnimationTimeMS);
621 } 621 }
622 622
623 // Notify entry change. 623 // Notify entry change.
624 FOR_EACH_OBSERVER(Observer, observers_, OnOwnerEntryChanged(window)); 624 FOR_EACH_OBSERVER(Observer, observers_, OnOwnerEntryChanged(window));
625 return true; 625 return true;
626 } 626 }
627 627
628 void MultiUserWindowManagerChromeOS::SetWindowVisibility( 628 void MultiUserWindowManagerChromeOS::SetWindowVisibility(
629 aura::Window* window, bool visible, int animation_time_in_ms) { 629 aura::Window* window, bool visible, int animation_time_in_ms) {
630 if (window->IsVisible() == visible) 630 // For a panel window, it's possible that this panel window is in the middle
631 // of relayout animation because of hiding/reshowing shelf during profile
632 // switch. Thus the window's visibility might not be its real visibility. See
633 // crbug.com/564725 for more info.
634 if (window->IsVisible() == visible && window->layer()->IsDrawn())
oshima 2016/02/11 23:31:56 I dug a bit more and I think the following is the
631 return; 635 return;
632 636
633 // Hiding a system modal dialog should not be allowed. Instead we switch to 637 // Hiding a system modal dialog should not be allowed. Instead we switch to
634 // the user which is showing the system modal window. 638 // the user which is showing the system modal window.
635 // Note that in some cases (e.g. unit test) windows might not have a root 639 // Note that in some cases (e.g. unit test) windows might not have a root
636 // window. 640 // window.
637 if (!visible && window->GetRootWindow()) { 641 if (!visible && window->GetRootWindow()) {
638 // Get the system modal container for the window's root window. 642 // Get the system modal container for the window's root window.
639 aura::Window* system_modal_container = 643 aura::Window* system_modal_container =
640 window->GetRootWindow()->GetChildById( 644 window->GetRootWindow()->GetChildById(
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 ash::Shell::GetInstance()->maximize_mode_controller()->AddWindow(window); 775 ash::Shell::GetInstance()->maximize_mode_controller()->AddWindow(window);
772 776
773 AnimationSetter animation_setter( 777 AnimationSetter animation_setter(
774 window, 778 window,
775 GetAdjustedAnimationTimeInMS(animation_time_in_ms)); 779 GetAdjustedAnimationTimeInMS(animation_time_in_ms));
776 780
777 if (visible) 781 if (visible)
778 window->Show(); 782 window->Show();
779 else 783 else
780 window->Hide(); 784 window->Hide();
781
782 // Make sure that animations have no influence on the window state after the
783 // call.
784 DCHECK_EQ(visible, window->IsVisible());
785 } 785 }
786 786
787 int MultiUserWindowManagerChromeOS::GetAdjustedAnimationTimeInMS( 787 int MultiUserWindowManagerChromeOS::GetAdjustedAnimationTimeInMS(
788 int default_time_in_ms) const { 788 int default_time_in_ms) const {
789 return animation_speed_ == ANIMATION_SPEED_NORMAL ? default_time_in_ms : 789 return animation_speed_ == ANIMATION_SPEED_NORMAL ? default_time_in_ms :
790 (animation_speed_ == ANIMATION_SPEED_FAST ? 10 : 0); 790 (animation_speed_ == ANIMATION_SPEED_FAST ? 10 : 0);
791 } 791 }
792 792
793 void MultiUserWindowManagerChromeOS::RemoveUser(const AccountId& account_id, 793 void MultiUserWindowManagerChromeOS::RemoveUser(const AccountId& account_id,
794 Profile* profile) { 794 Profile* profile) {
795 AccountIdToAppWindowObserver::iterator app_observer_iterator = 795 AccountIdToAppWindowObserver::iterator app_observer_iterator =
796 account_id_to_app_observer_.find(account_id); 796 account_id_to_app_observer_.find(account_id);
797 DCHECK(app_observer_iterator != account_id_to_app_observer_.end()) 797 DCHECK(app_observer_iterator != account_id_to_app_observer_.end())
798 << "User id '" << account_id.GetUserEmail() << "', profile=" << profile 798 << "User id '" << account_id.GetUserEmail() << "', profile=" << profile
799 << " was not found."; 799 << " was not found.";
800 if (app_observer_iterator == account_id_to_app_observer_.end()) 800 if (app_observer_iterator == account_id_to_app_observer_.end())
801 return; 801 return;
802 802
803 extensions::AppWindowRegistry::Get(profile) 803 extensions::AppWindowRegistry::Get(profile)
804 ->RemoveObserver(app_observer_iterator->second); 804 ->RemoveObserver(app_observer_iterator->second);
805 delete app_observer_iterator->second; 805 delete app_observer_iterator->second;
806 account_id_to_app_observer_.erase(app_observer_iterator); 806 account_id_to_app_observer_.erase(app_observer_iterator);
807 } 807 }
808 808
809 } // namespace chrome 809 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698