diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-03 19:51:20 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-03 19:51:20 +0000 |
commit | 3736a477669ef0b7f2b9ef64e5d9a7b1e65012fa (patch) | |
tree | 4817c61c99f80f7c1acba5492200a82b6717e493 /ash | |
parent | 3f1bc5274bf2f82481d55f808af921d056d5b0eb (diff) | |
download | chromium_src-3736a477669ef0b7f2b9ef64e5d9a7b1e65012fa.zip chromium_src-3736a477669ef0b7f2b9ef64e5d9a7b1e65012fa.tar.gz chromium_src-3736a477669ef0b7f2b9ef64e5d9a7b1e65012fa.tar.bz2 |
cros: Fix missing windows/launcher after resume/screen unlock
When the screen is locked the desktop wallpaper background widget is pulled
"forward" to hide the user's browser windows and the launcher. There is a
race condition between a window animation triggered by wallpaper reloading at
device resume and code in screen unlock that "pushes" the background back
behind the launcher and browsers. There can temporarily be two backgrounds
and we need to move them both to the back. The extra one will be cleaned up
when the animation completes.
See bug for details on the race.
I'm working on unit tests for this, but that will require some refactoring
and I wanted to keep this patch simple for backport to R23.
BUG=149043
TEST=interactive_ui_tests ScreenLocker.*, set option to require password on resume, sleep device (close lid or wait for timeout), resume device, verify you can unlock screen with password
Review URL: https://codereview.chromium.org/11016030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/desktop_background/desktop_background_controller.cc | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc index 4d084df..ae22b55 100644 --- a/ash/desktop_background/desktop_background_controller.cc +++ b/ash/desktop_background/desktop_background_controller.cc @@ -23,6 +23,10 @@ #include "ui/gfx/image/image.h" #include "ui/views/widget/widget.h" +using ash::internal::DesktopBackgroundWidgetController; +using ash::internal::kComponentWrapper; +using ash::internal::kWindowDesktopComponent; + namespace ash { namespace { @@ -345,17 +349,25 @@ bool DesktopBackgroundController::ReparentBackgroundWidgets(int src_container, for (Shell::RootWindowList::iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) { aura::RootWindow* root_window = *iter; - if (root_window->GetProperty(internal::kComponentWrapper)) { - internal::DesktopBackgroundWidgetController* component = root_window-> - GetProperty(internal::kWindowDesktopComponent); - // Wallpaper animation may not finish at this point. Try to get component - // from kComponentWrapper instead. - if (!component) { - component = root_window->GetProperty(internal::kComponentWrapper)-> - GetComponent(false); - } - DCHECK(component); - moved = moved || component->Reparent(root_window, + // In the steady state (no animation playing) the background widget + // controller exists in the kWindowDesktopComponent property. + DesktopBackgroundWidgetController* desktop_component = root_window-> + GetProperty(kWindowDesktopComponent); + if (desktop_component) { + moved |= desktop_component->Reparent(root_window, + src_container, + dst_container); + } + // During desktop show animations the controller lives in kComponentWrapper. + // NOTE: If a wallpaper load happens during a desktop show animation there + // can temporarily be two desktop background widgets. We must reparent + // both of them - one above and one here. + DesktopBackgroundWidgetController* wrapped_component = + root_window->GetProperty(kComponentWrapper) ? + root_window->GetProperty(kComponentWrapper)->GetComponent(false) : + NULL; + if (wrapped_component) { + moved |= wrapped_component->Reparent(root_window, src_container, dst_container); } |