diff options
author | bshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 20:43:50 +0000 |
---|---|---|
committer | bshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 20:43:50 +0000 |
commit | d873fad259599c1790045fab39410116c782db5c (patch) | |
tree | e535d6f5ad2ec0ed8c7b259a63697b8f89b89ac0 /ash | |
parent | 08c426a4ac0d42ed71844d5abe7d3ed6ed1cd081 (diff) | |
download | chromium_src-d873fad259599c1790045fab39410116c782db5c.zip chromium_src-d873fad259599c1790045fab39410116c782db5c.tar.gz chromium_src-d873fad259599c1790045fab39410116c782db5c.tar.bz2 |
Add fade in animation on background change and fix color mode change bug.
This CL add a fade in animation on aura desktop background change. It doesn't
handle situations where user quickly switch between serveral wallpapers through.
It also fixed a bug which prevent user from switch background color mode back and
force.
BUG=117244, 118651
TEST=Navigate to settings page, click "Set wallpaper..." button, select different
wallpapers, verify if there is a fade in animation on wallpaper switching.
Review URL: http://codereview.chromium.org/9716025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 2 | ||||
-rw-r--r-- | ash/desktop_background/desktop_background_controller.cc | 20 | ||||
-rw-r--r-- | ash/desktop_background/desktop_background_controller.h | 9 | ||||
-rw-r--r-- | ash/desktop_background/desktop_background_view.cc | 13 | ||||
-rw-r--r-- | ash/desktop_background/desktop_background_view.h | 5 | ||||
-rw-r--r-- | ash/shell.cc | 14 |
6 files changed, 20 insertions, 43 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index afaaf9a..6299b95 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -184,7 +184,7 @@ bool HandleToggleDesktopBackgroundMode() { ash::DesktopBackgroundController::BACKGROUND_IMAGE) desktop_background_controller->SetDesktopBackgroundSolidColorMode(); else - desktop_background_controller->OnDesktopBackgroundChanged(); + desktop_background_controller->SetDesktopBackgroundImageMode(); return true; } diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc index c6698cc..711128d 100644 --- a/ash/desktop_background/desktop_background_controller.cc +++ b/ash/desktop_background/desktop_background_controller.cc @@ -26,27 +26,17 @@ DesktopBackgroundController::DesktopBackgroundController() : DesktopBackgroundController::~DesktopBackgroundController() { } -void DesktopBackgroundController::OnDesktopBackgroundChanged() { +void DesktopBackgroundController::SetDesktopBackgroundImageMode() { internal::RootWindowLayoutManager* root_window_layout = Shell::GetInstance()->root_window_layout(); - if (desktop_background_mode_ == BACKGROUND_SOLID_COLOR) - return; - + if (root_window_layout->background_widget()) + root_window_layout->background_widget()->Hide(); int index = Shell::GetInstance()->user_wallpaper_delegate()-> GetUserWallpaperIndex(); - DCHECK(root_window_layout->background_widget()->widget_delegate()); - static_cast<internal::DesktopBackgroundView*>( - root_window_layout->background_widget()->widget_delegate())-> - SetWallpaper(GetWallpaper(index), GetWallpaperInfo(index).layout); -} - -void DesktopBackgroundController::SetDesktopBackgroundImageMode( - const SkBitmap& wallpaper, ImageLayout layout) { - internal::RootWindowLayoutManager* root_window_layout = - Shell::GetInstance()->root_window_layout(); root_window_layout->SetBackgroundLayer(NULL); root_window_layout->SetBackgroundWidget( - internal::CreateDesktopBackground(wallpaper, layout)); + internal::CreateDesktopBackground(GetWallpaper(index), + GetWallpaperInfo(index).layout)); desktop_background_mode_ = BACKGROUND_IMAGE; } diff --git a/ash/desktop_background/desktop_background_controller.h b/ash/desktop_background/desktop_background_controller.h index a368443..710e00e 100644 --- a/ash/desktop_background/desktop_background_controller.h +++ b/ash/desktop_background/desktop_background_controller.h @@ -42,13 +42,10 @@ class ASH_EXPORT DesktopBackgroundController { return desktop_background_mode_; } - // Change the desktop background image to user selected wallpaper. - void OnDesktopBackgroundChanged(); - // Sets the desktop background to image mode and create a new background - // widget with |wallpaper| and image |layout|. - void SetDesktopBackgroundImageMode(const SkBitmap& wallpaper, - ImageLayout layout); + // widget with user selected wallpaper or default wallpaper. Delete the old + // widget if any. + void SetDesktopBackgroundImageMode(); // Sets the desktop background to solid color mode and create a solid color // layout. diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc index 5004ab2..64c8785 100644 --- a/ash/desktop_background/desktop_background_view.cc +++ b/ash/desktop_background/desktop_background_view.cc @@ -9,6 +9,7 @@ #include "ash/ash_export.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" +#include "ash/wm/window_animations.h" #include "base/utf_string_conversions.h" #include "grit/ui_resources.h" #include "ui/aura/root_window.h" @@ -38,14 +39,6 @@ DesktopBackgroundView::DesktopBackgroundView(const SkBitmap& wallpaper, DesktopBackgroundView::~DesktopBackgroundView() { } -void DesktopBackgroundView::SetWallpaper(const SkBitmap& wallpaper, - ImageLayout layout) { - image_layout_ = layout; - wallpaper_ = wallpaper; - wallpaper_.buildMipMap(false); - SchedulePaint(); -} - //////////////////////////////////////////////////////////////////////////////// // DesktopBackgroundView, views::View overrides: @@ -115,6 +108,10 @@ views::Widget* CreateDesktopBackground(const SkBitmap& wallpaper, ash::internal::kShellWindowId_DesktopBackgroundContainer); desktop_widget->Init(params); desktop_widget->SetContentsView(view); + ash::SetWindowVisibilityAnimationType( + desktop_widget->GetNativeView(), + ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); + desktop_widget->SetBounds(params.parent->bounds()); desktop_widget->Show(); desktop_widget->GetNativeView()->SetName("DesktopBackgroundView"); return desktop_widget; diff --git a/ash/desktop_background/desktop_background_view.h b/ash/desktop_background/desktop_background_view.h index 4e5560c..3effb1f 100644 --- a/ash/desktop_background/desktop_background_view.h +++ b/ash/desktop_background/desktop_background_view.h @@ -19,11 +19,6 @@ class DesktopBackgroundView : public views::WidgetDelegateView { DesktopBackgroundView(const SkBitmap& wallpaper, ImageLayout layout); virtual ~DesktopBackgroundView(); - // TODO(bshe): Remove this function once issue 117244 is fixed. It is - // currently used in DesktopBackgroundController:: - // OnDesktopBackgroundChanged. - void SetWallpaper(const SkBitmap& wallpaper, ImageLayout layout); - private: // Overridden from views::View: virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; diff --git a/ash/shell.cc b/ash/shell.cc index 4dfb483..c11d268 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -140,9 +140,11 @@ void CreateSpecialContainers(aura::RootWindow* root_window) { "UnparentedControlContainer", non_lock_screen_containers); - CreateContainer(internal::kShellWindowId_DesktopBackgroundContainer, - "DesktopBackgroundContainer", - non_lock_screen_containers); + aura::Window* desktop_background_containers = CreateContainer( + internal::kShellWindowId_DesktopBackgroundContainer, + "DesktopBackgroundContainer", + non_lock_screen_containers); + SetChildWindowVisibilityChangesAnimated(desktop_background_containers); aura::Window* default_container = CreateContainer( internal::kShellWindowId_DefaultContainer, @@ -933,11 +935,7 @@ void Shell::InitLayoutManagers() { always_on_top_container->GetRootWindow())); // Create desktop background widget. - // TODO(bshe): We should be able to use OnDesktopBackgroundChanged function - // here after issue 117244 got fixed. - int index = user_wallpaper_delegate_->GetUserWallpaperIndex(); - desktop_background_controller_->SetDesktopBackgroundImageMode( - GetWallpaper(index), GetWallpaperInfo(index).layout); + desktop_background_controller_->SetDesktopBackgroundImageMode(); } void Shell::DisableWorkspaceGridLayout() { |