summaryrefslogtreecommitdiffstats
path: root/ash/desktop_background
diff options
context:
space:
mode:
authorsimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-14 00:18:56 +0000
committersimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-14 00:18:56 +0000
commite0b6eeec50950ac6b51f519f126d6ed680b75946 (patch)
tree726d3b4fc99bada84d95ac26aaa87374c4e8d184 /ash/desktop_background
parentb0d85bf7c4233f69ee1620a80b225125ef8bc6e0 (diff)
downloadchromium_src-e0b6eeec50950ac6b51f519f126d6ed680b75946.zip
chromium_src-e0b6eeec50950ac6b51f519f126d6ed680b75946.tar.gz
chromium_src-e0b6eeec50950ac6b51f519f126d6ed680b75946.tar.bz2
Revert 151393 - Fix white flash when user signs out and fix wallpaper animation regression
When user signs out and transit to the login screen, the wallpaper fade in from a white screen. Described in 141563, this Cl fixed it. Also, after user login, or switch users at login screen. when wallpaper change, the new wallpaper should fade in nicely. There is a regression in recent builds. This fix fixed the regression as well. BUG=141563, 141676, 142042 Review URL: https://chromiumcodereview.appspot.com/10827284 TBR=bshe@chromium.org Review URL: https://chromiumcodereview.appspot.com/10854136 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151398 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/desktop_background')
-rw-r--r--ash/desktop_background/desktop_background_controller.cc44
-rw-r--r--ash/desktop_background/desktop_background_view.cc24
-rw-r--r--ash/desktop_background/desktop_background_widget_controller.cc7
-rw-r--r--ash/desktop_background/desktop_background_widget_controller.h25
4 files changed, 41 insertions, 59 deletions
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc
index 09b05aa..2d49b4d 100644
--- a/ash/desktop_background/desktop_background_controller.cc
+++ b/ash/desktop_background/desktop_background_controller.cc
@@ -106,6 +106,7 @@ DesktopBackgroundController::DesktopBackgroundController()
desktop_background_mode_(BACKGROUND_SOLID_COLOR),
background_color_(kTransparentColor),
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ InstallComponentForAllWindows();
}
DesktopBackgroundController::~DesktopBackgroundController() {
@@ -212,9 +213,22 @@ void DesktopBackgroundController::CancelPendingWallpaperOperation() {
void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode(
SkColor color) {
background_color_ = color;
- desktop_background_mode_ = BACKGROUND_SOLID_COLOR;
+ if (desktop_background_mode_ != BACKGROUND_SOLID_COLOR) {
+ desktop_background_mode_ = BACKGROUND_SOLID_COLOR;
+ InstallComponentForAllWindows();
+ return;
+ }
- InstallComponentForAllWindows();
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+ for (Shell::RootWindowList::iterator iter = root_windows.begin();
+ iter != root_windows.end(); ++iter) {
+ aura::RootWindow* root_window = *iter;
+ internal::DesktopBackgroundWidgetController* component = root_window->
+ GetProperty(internal::kWindowDesktopComponent);
+ DCHECK(component);
+ DCHECK(component->layer());
+ component->layer()->SetColor(background_color_ );
+ }
}
void DesktopBackgroundController::CreateEmptyWallpaper() {
@@ -241,13 +255,28 @@ void DesktopBackgroundController::MoveDesktopToUnlockedContainer() {
void DesktopBackgroundController::OnWindowDestroying(aura::Window* window) {
window->SetProperty(internal::kWindowDesktopComponent,
static_cast<internal::DesktopBackgroundWidgetController*>(NULL));
- window->SetProperty(internal::kComponentWrapper,
- static_cast<internal::ComponentWrapper*>(NULL));
}
void DesktopBackgroundController::SetDesktopBackgroundImageMode() {
- desktop_background_mode_ = BACKGROUND_IMAGE;
- InstallComponentForAllWindows();
+ if (desktop_background_mode_ != BACKGROUND_IMAGE) {
+ desktop_background_mode_ = BACKGROUND_IMAGE;
+ InstallComponentForAllWindows();
+ return;
+ }
+
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+ for (Shell::RootWindowList::iterator iter = root_windows.begin();
+ iter != root_windows.end(); ++iter) {
+ aura::RootWindow* root_window = *iter;
+ internal::DesktopBackgroundWidgetController* component = root_window->
+ GetProperty(internal::kWindowDesktopComponent);
+ DCHECK(component);
+ DCHECK(component->widget());
+ aura::Window* window = component->widget()->GetNativeView();
+ gfx::Rect bounds = window->bounds();
+ window->SchedulePaintInRect(gfx::Rect(0, 0,
+ bounds.width(), bounds.height()));
+ }
}
void DesktopBackgroundController::OnWallpaperLoadCompleted(
@@ -299,8 +328,7 @@ void DesktopBackgroundController::InstallComponent(
// First time for this root window
root_window->AddObserver(this);
}
- root_window->SetProperty(internal::kComponentWrapper,
- new internal::ComponentWrapper(component));
+ root_window->SetProperty(internal::kWindowDesktopComponent, component);
}
void DesktopBackgroundController::InstallComponentForAllWindows() {
diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc
index f0f9a5e..28a7a0c 100644
--- a/ash/desktop_background/desktop_background_view.cc
+++ b/ash/desktop_background/desktop_background_view.cc
@@ -8,7 +8,6 @@
#include "ash/ash_export.h"
#include "ash/desktop_background/desktop_background_controller.h"
-#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/window_animations.h"
@@ -44,14 +43,8 @@ class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver {
private:
// Overridden from ui::ImplicitAnimationObserver:
virtual void OnImplicitAnimationsCompleted() OVERRIDE {
- ash::Shell* shell = ash::Shell::GetInstance();
- shell->user_wallpaper_delegate()->OnWallpaperAnimationFinished();
- // Only removes old component when wallpaper animation finished. If we
- // remove the old one too early, there will be a white flash during
- // animation.
- internal::DesktopBackgroundWidgetController* component =
- root_window_->GetProperty(kComponentWrapper)->component();
- root_window_->SetProperty(kWindowDesktopComponent, component);
+ ash::Shell::GetInstance()->
+ user_wallpaper_delegate()->OnWallpaperAnimationFinished();
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
@@ -160,17 +153,8 @@ views::Widget* CreateDesktopBackground(aura::RootWindow* root_window,
ash::Shell::GetInstance()->user_wallpaper_delegate()->GetAnimationType();
ash::SetWindowVisibilityAnimationType(desktop_widget->GetNativeView(),
animation_type);
- // Disable animation when creating the first widget. Otherwise, wallpaper
- // will animate from a white screen. Note that boot animation is different.
- // It animates from a white background.
- if (animation_type == ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE &&
- NULL == root_window->GetProperty(internal::kWindowDesktopComponent)) {
- ash::SetWindowVisibilityAnimationTransition(desktop_widget->GetNativeView(),
- ash::ANIMATE_NONE);
- } else {
- ash::SetWindowVisibilityAnimationTransition(desktop_widget->GetNativeView(),
- ash::ANIMATE_SHOW);
- }
+ ash::SetWindowVisibilityAnimationTransition(desktop_widget->GetNativeView(),
+ ash::ANIMATE_SHOW);
desktop_widget->SetBounds(params.parent->bounds());
ui::ScopedLayerAnimationSettings settings(
desktop_widget->GetNativeView()->layer()->GetAnimator());
diff --git a/ash/desktop_background/desktop_background_widget_controller.cc b/ash/desktop_background/desktop_background_widget_controller.cc
index 1d0f5fa..6e6d799 100644
--- a/ash/desktop_background/desktop_background_widget_controller.cc
+++ b/ash/desktop_background/desktop_background_widget_controller.cc
@@ -8,14 +8,12 @@
#include "ui/views/widget/widget.h"
DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::DesktopBackgroundWidgetController*);
-DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::ComponentWrapper*);
namespace ash {
namespace internal {
DEFINE_OWNED_WINDOW_PROPERTY_KEY(DesktopBackgroundWidgetController,
kWindowDesktopComponent, NULL);
-DEFINE_OWNED_WINDOW_PROPERTY_KEY(ComponentWrapper, kComponentWrapper, NULL);
DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
views::Widget* widget) : widget_(widget) {
@@ -41,6 +39,7 @@ void DesktopBackgroundWidgetController::SetBounds(gfx::Rect bounds) {
layer_->SetBounds(bounds);
}
+
void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
int src_container,
int dest_container) {
@@ -54,9 +53,5 @@ void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
}
}
-ComponentWrapper::ComponentWrapper(
- DesktopBackgroundWidgetController* component) : component_(component) {
-}
-
} // namespace internal
} // namespace ash
diff --git a/ash/desktop_background/desktop_background_widget_controller.h b/ash/desktop_background/desktop_background_widget_controller.h
index c50c4fa..fe07ef3 100644
--- a/ash/desktop_background/desktop_background_widget_controller.h
+++ b/ash/desktop_background/desktop_background_widget_controller.h
@@ -15,11 +15,6 @@ namespace internal {
// This class hides difference between two possible background implementations:
// effective Layer-based for solid color, and Widget-based for images.
-// DesktopBackgroundWidgetController is installed as an owned property on the
-// RootWindow. To avoid a white flash during wallpaper changes the old
-// DesktopBackgroundWidgetController is moved to a secondary property
-// (kComponentWrapper). When the animation completes the old
-// DesktopBackgroundWidgetController is destroyed.
class DesktopBackgroundWidgetController {
public:
// Create
@@ -48,31 +43,11 @@ class DesktopBackgroundWidgetController {
DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundWidgetController);
};
-// This class wraps a DesktopBackgroundWidgetController pointer. It is installed
-// as an owned property on the RootWindow. DesktopBackgroundWidgetController is
-// moved to this property before animation completes. After animation completes,
-// the kWindowDesktopComponent property on RootWindow is set to the
-// DesktopBackgroundWidgetController in this class.
-class ComponentWrapper {
- public:
- explicit ComponentWrapper(
- DesktopBackgroundWidgetController* component);
- ~ComponentWrapper() {}
- DesktopBackgroundWidgetController* component() { return component_; }
-
- private:
- DesktopBackgroundWidgetController* component_;
-
- DISALLOW_COPY_AND_ASSIGN(ComponentWrapper);
-};
-
// Window property key, that binds instance of DesktopBackgroundWidgetController
// to root windows.
extern const aura::WindowProperty<DesktopBackgroundWidgetController*>* const
kWindowDesktopComponent;
-extern const aura::WindowProperty<ComponentWrapper*>* const kComponentWrapper;
-
} // namespace internal
} // namespace ash