summaryrefslogtreecommitdiffstats
path: root/ash/desktop_background
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-02 03:25:31 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-02 03:25:31 +0000
commitd1df0ec609238107435fabff3e2c9f846098be4c (patch)
treebbfaef947557b2c2a5f206be10fe5b75cfd940b1 /ash/desktop_background
parent19870f66f47ada26b83d008925899b1957d428e7 (diff)
downloadchromium_src-d1df0ec609238107435fabff3e2c9f846098be4c.zip
chromium_src-d1df0ec609238107435fabff3e2c9f846098be4c.tar.gz
chromium_src-d1df0ec609238107435fabff3e2c9f846098be4c.tar.bz2
Reland - cros: Add CHECK for screen unlock problem
On some devices when you unlock the screen after suspend the launcher and desktop windows do not appear. I suspect the background widget is not being reparented properly but I cannot reproduce the problem internally. Since the user can't recover from this state without rebooting, add some CHECKs to try to track down the source. Also initialize empty wallpaper if we're running tests, as we previously skipped it which would cause my CHECKs to be hit. BUG=149043 TEST=ScreenLockerTest and manual, lock screen with Ctrl-Shift-L, unlock by entering password Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=158846 Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=159154 Review URL: https://chromiumcodereview.appspot.com/10982035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159636 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/desktop_background')
-rw-r--r--ash/desktop_background/desktop_background_controller.cc26
-rw-r--r--ash/desktop_background/desktop_background_controller.h12
-rw-r--r--ash/desktop_background/desktop_background_widget_controller.cc9
-rw-r--r--ash/desktop_background/desktop_background_widget_controller.h4
4 files changed, 30 insertions, 21 deletions
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc
index b1ca185..6f4d11b 100644
--- a/ash/desktop_background/desktop_background_controller.cc
+++ b/ash/desktop_background/desktop_background_controller.cc
@@ -237,20 +237,20 @@ WallpaperResolution DesktopBackgroundController::GetAppropriateResolution() {
return resolution;
}
-void DesktopBackgroundController::MoveDesktopToLockedContainer() {
+bool DesktopBackgroundController::MoveDesktopToLockedContainer() {
if (locked_)
- return;
+ return false;
locked_ = true;
- ReparentBackgroundWidgets(GetBackgroundContainerId(false),
- GetBackgroundContainerId(true));
+ return ReparentBackgroundWidgets(GetBackgroundContainerId(false),
+ GetBackgroundContainerId(true));
}
-void DesktopBackgroundController::MoveDesktopToUnlockedContainer() {
+bool DesktopBackgroundController::MoveDesktopToUnlockedContainer() {
if (!locked_)
- return;
+ return false;
locked_ = false;
- ReparentBackgroundWidgets(GetBackgroundContainerId(true),
- GetBackgroundContainerId(false));
+ return ReparentBackgroundWidgets(GetBackgroundContainerId(true),
+ GetBackgroundContainerId(false));
}
void DesktopBackgroundController::OnWindowDestroying(aura::Window* window) {
@@ -336,8 +336,9 @@ void DesktopBackgroundController::InstallComponentForAllWindows() {
}
}
-void DesktopBackgroundController::ReparentBackgroundWidgets(int src_container,
+bool DesktopBackgroundController::ReparentBackgroundWidgets(int src_container,
int dst_container) {
+ bool moved = false;
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
for (Shell::RootWindowList::iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
@@ -352,11 +353,12 @@ void DesktopBackgroundController::ReparentBackgroundWidgets(int src_container,
GetComponent(false);
}
DCHECK(component);
- component->Reparent(root_window,
- src_container,
- dst_container);
+ moved = moved || component->Reparent(root_window,
+ src_container,
+ dst_container);
}
}
+ return moved;
}
int DesktopBackgroundController::GetBackgroundContainerId(bool locked) {
diff --git a/ash/desktop_background/desktop_background_controller.h b/ash/desktop_background/desktop_background_controller.h
index 0251c1c..8976a31 100644
--- a/ash/desktop_background/desktop_background_controller.h
+++ b/ash/desktop_background/desktop_background_controller.h
@@ -120,10 +120,12 @@ class ASH_EXPORT DesktopBackgroundController : public aura::WindowObserver {
WallpaperResolution GetAppropriateResolution();
// Move all desktop widgets to locked container.
- void MoveDesktopToLockedContainer();
+ // Returns true if the desktop moved.
+ bool MoveDesktopToLockedContainer();
// Move all desktop widgets to unlocked container.
- void MoveDesktopToUnlockedContainer();
+ // Returns true if the desktop moved.
+ bool MoveDesktopToUnlockedContainer();
// WindowObserver implementation.
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
@@ -155,9 +157,9 @@ class ASH_EXPORT DesktopBackgroundController : public aura::WindowObserver {
// all root windows.
void InstallComponentForAllWindows();
- // Moves all descktop components from one container to other across all root
- // windows.
- void ReparentBackgroundWidgets(int src_container, int dst_container);
+ // Moves all desktop components from one container to other across all root
+ // windows. Returns true if a desktop moved.
+ bool ReparentBackgroundWidgets(int src_container, int dst_container);
// Returns id for background container for unlocked and locked states.
int GetBackgroundContainerId(bool locked);
diff --git a/ash/desktop_background/desktop_background_widget_controller.cc b/ash/desktop_background/desktop_background_widget_controller.cc
index 9ad1f95..6b796d0 100644
--- a/ash/desktop_background/desktop_background_widget_controller.cc
+++ b/ash/desktop_background/desktop_background_widget_controller.cc
@@ -49,17 +49,22 @@ void DesktopBackgroundWidgetController::SetBounds(gfx::Rect bounds) {
layer_->SetBounds(bounds);
}
-void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
+bool DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
int src_container,
int dest_container) {
if (widget_) {
views::Widget::ReparentNativeView(widget_->GetNativeView(),
root_window->GetChildById(dest_container));
- } else if (layer_.get()) {
+ return true;
+ }
+ if (layer_.get()) {
ui::Layer* layer = layer_.get();
root_window->GetChildById(src_container)->layer()->Remove(layer);
root_window->GetChildById(dest_container)->layer()->Add(layer);
+ return true;
}
+ // Nothing to reparent.
+ return false;
}
ComponentWrapper::ComponentWrapper(
diff --git a/ash/desktop_background/desktop_background_widget_controller.h b/ash/desktop_background/desktop_background_widget_controller.h
index d565332..7017eb0 100644
--- a/ash/desktop_background/desktop_background_widget_controller.h
+++ b/ash/desktop_background/desktop_background_widget_controller.h
@@ -37,8 +37,8 @@ class DesktopBackgroundWidgetController : public views::WidgetObserver {
// Move component from |src_container| in |root_window| to |dest_container|.
// It is required for lock screen, when we need to move background so that
- // it hides user's windows.
- void Reparent(aura::RootWindow* root_window,
+ // it hides user's windows. Returns true if there was something to reparent.
+ bool Reparent(aura::RootWindow* root_window,
int src_container,
int dest_container);