diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 07:57:10 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 07:57:10 +0000 |
commit | a7611df27b71e52c3792491c08b956e76d98178f (patch) | |
tree | 75b325c2db0da0d3d5956ae5d7d0c3b3a1dcd7bc | |
parent | 9efec3acd222178d1bfee84799d47dd393894f61 (diff) | |
download | chromium_src-a7611df27b71e52c3792491c08b956e76d98178f.zip chromium_src-a7611df27b71e52c3792491c08b956e76d98178f.tar.gz chromium_src-a7611df27b71e52c3792491c08b956e76d98178f.tar.bz2 |
Reload wallpaper when display configuration changes.
BUG=285365,239849
R=bshe@chromium.org
Review URL: https://codereview.chromium.org/24499002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225386 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/ash.gyp | 4 | ||||
-rw-r--r-- | ash/default_user_wallpaper_delegate.cc | 41 | ||||
-rw-r--r-- | ash/default_user_wallpaper_delegate.h | 36 | ||||
-rw-r--r-- | ash/desktop_background/desktop_background_controller.cc | 50 | ||||
-rw-r--r-- | ash/desktop_background/desktop_background_controller.h | 21 | ||||
-rw-r--r-- | ash/desktop_background/desktop_background_controller_unittest.cc | 55 | ||||
-rw-r--r-- | ash/shell.cc | 44 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.cc | 3 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.cc | 3 | ||||
-rw-r--r-- | ash/test/test_user_wallpaper_delegate.cc | 22 | ||||
-rw-r--r-- | ash/test/test_user_wallpaper_delegate.h | 32 |
11 files changed, 242 insertions, 69 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 72fa429..895318d 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -76,6 +76,8 @@ 'caps_lock_delegate_stub.h', 'debug.cc', 'debug.h', + 'default_user_wallpaper_delegate.cc', + 'default_user_wallpaper_delegate.h', 'desktop_background/desktop_background_controller.cc', 'desktop_background/desktop_background_controller.h', 'desktop_background/desktop_background_controller_observer.h', @@ -608,6 +610,8 @@ 'test/shell_test_api.h', 'test/test_activation_delegate.cc', 'test/test_activation_delegate.h', + 'test/test_user_wallpaper_delegate.cc', + 'test/test_user_wallpaper_delegate.h', 'test/test_launcher_delegate.cc', 'test/test_launcher_delegate.h', 'test/test_session_state_delegate.cc', diff --git a/ash/default_user_wallpaper_delegate.cc b/ash/default_user_wallpaper_delegate.cc new file mode 100644 index 0000000..168fc9d --- /dev/null +++ b/ash/default_user_wallpaper_delegate.cc @@ -0,0 +1,41 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/default_user_wallpaper_delegate.h" + +#include "ash/desktop_background/desktop_background_controller.h" +#include "ash/shell.h" + +namespace ash { + +int DefaultUserWallpaperDelegate::GetAnimationType() { + return views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; +} + +bool DefaultUserWallpaperDelegate::ShouldShowInitialAnimation() { + return false; +} + +void DefaultUserWallpaperDelegate::UpdateWallpaper() { +} + +void DefaultUserWallpaperDelegate::InitializeWallpaper() { + ash::Shell::GetInstance()->desktop_background_controller()-> + CreateEmptyWallpaper(); +} + +void DefaultUserWallpaperDelegate::OpenSetWallpaperPage() { +} + +bool DefaultUserWallpaperDelegate::CanOpenSetWallpaperPage() { + return false; +} + +void DefaultUserWallpaperDelegate::OnWallpaperAnimationFinished() { +} + +void DefaultUserWallpaperDelegate::OnWallpaperBootAnimationFinished() { +} + +} // namespace ash diff --git a/ash/default_user_wallpaper_delegate.h b/ash/default_user_wallpaper_delegate.h new file mode 100644 index 0000000..2e22e30 --- /dev/null +++ b/ash/default_user_wallpaper_delegate.h @@ -0,0 +1,36 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_DEFAULT_USER_WALLPAPER_DELEGATE_H_ +#define ASH_DEFAULT_USER_WALLPAPER_DELEGATE_H_ + +#include "ash/ash_export.h" +#include "ash/desktop_background/user_wallpaper_delegate.h" +#include "base/basictypes.h" +#include "base/compiler_specific.h" + +namespace ash { + +class ASH_EXPORT DefaultUserWallpaperDelegate : public UserWallpaperDelegate { + public: + DefaultUserWallpaperDelegate() {} + virtual ~DefaultUserWallpaperDelegate() {} + + // UserWallpaperDelegate overrides: + virtual int GetAnimationType() OVERRIDE; + virtual bool ShouldShowInitialAnimation() OVERRIDE; + virtual void UpdateWallpaper() OVERRIDE; + virtual void InitializeWallpaper() OVERRIDE; + virtual void OpenSetWallpaperPage() OVERRIDE; + virtual bool CanOpenSetWallpaperPage() OVERRIDE; + virtual void OnWallpaperAnimationFinished() OVERRIDE; + virtual void OnWallpaperBootAnimationFinished() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(DefaultUserWallpaperDelegate); +}; + +} // namespace ash + +#endif // ASH_DEFAULT_USER_WALLPAPER_DELEGATE_H_ diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc index b8fef38..8cdd72e 100644 --- a/ash/desktop_background/desktop_background_controller.cc +++ b/ash/desktop_background/desktop_background_controller.cc @@ -39,6 +39,10 @@ using content::BrowserThread; namespace ash { namespace { +// How long to wait reloading the wallpaper after the max display has +// changed? +const int kWallpaperReloadDelayMs = 2000; + const SkColor kTransparentColor = SkColorSetARGB(0x00, 0x00, 0x00, 0x00); internal::RootWindowLayoutManager* GetRootWindowLayoutManager( @@ -161,11 +165,14 @@ DesktopBackgroundController::DesktopBackgroundController() locked_(false), desktop_background_mode_(BACKGROUND_NONE), current_default_wallpaper_resource_id_(-1), - weak_ptr_factory_(this) { + weak_ptr_factory_(this), + wallpaper_reload_delay_(kWallpaperReloadDelayMs) { + Shell::GetInstance()->display_controller()->AddObserver(this); } DesktopBackgroundController::~DesktopBackgroundController() { CancelPendingWallpaperOperation(); + Shell::GetInstance()->display_controller()->RemoveObserver(this); } gfx::ImageSkia DesktopBackgroundController::GetWallpaper() const { @@ -195,23 +202,13 @@ void DesktopBackgroundController::OnRootWindowAdded( // The background hasn't been set yet. if (desktop_background_mode_ == BACKGROUND_NONE) return; - + gfx::Size max_display_size = GetMaxDisplaySizeInNative(); // Handle resolution change for "built-in" images. if (BACKGROUND_IMAGE == desktop_background_mode_ && - current_wallpaper_.get()) { - gfx::Size root_window_size = root_window->GetHostSize(); - int width = current_wallpaper_->wallpaper_image().width(); - int height = current_wallpaper_->wallpaper_image().height(); - // Reloads wallpaper if current wallpaper is smaller than the new added root - // window. - if (width < root_window_size.width() || - height < root_window_size.height()) { - current_wallpaper_.reset(NULL); - current_default_wallpaper_path_ = base::FilePath(); - current_default_wallpaper_resource_id_ = -1; - ash::Shell::GetInstance()->user_wallpaper_delegate()-> - UpdateWallpaper(); - } + current_wallpaper_.get() && + current_max_display_size_ != max_display_size) { + current_max_display_size_ = max_display_size; + UpdateWallpaper(); } InstallDesktopController(root_window); @@ -310,6 +307,18 @@ bool DesktopBackgroundController::MoveDesktopToUnlockedContainer() { GetBackgroundContainerId(false)); } +void DesktopBackgroundController::OnDisplayConfigurationChanged() { + gfx::Size max_display_size = GetMaxDisplaySizeInNative(); + if (current_max_display_size_ != max_display_size) { + current_max_display_size_ = max_display_size; + timer_.Stop(); + timer_.Start(FROM_HERE, + base::TimeDelta::FromMilliseconds(wallpaper_reload_delay_), + this, + &DesktopBackgroundController::UpdateWallpaper); + } +} + bool DesktopBackgroundController::DefaultWallpaperIsAlreadyLoadingOrLoaded( const base::FilePath& image_file, int image_resource_id) const { return (wallpaper_loader_.get() && @@ -375,6 +384,7 @@ void DesktopBackgroundController::InstallDesktopControllerForAllWindows() { iter != root_windows.end(); ++iter) { InstallDesktopController(*iter); } + current_max_display_size_ = GetMaxDisplaySizeInNative(); } bool DesktopBackgroundController::ReparentBackgroundWidgets(int src_container, @@ -420,6 +430,14 @@ int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { internal::kShellWindowId_DesktopBackgroundContainer; } +void DesktopBackgroundController::UpdateWallpaper() { + current_wallpaper_.reset(NULL); + current_default_wallpaper_path_ = base::FilePath(); + current_default_wallpaper_resource_id_ = -1; + ash::Shell::GetInstance()->user_wallpaper_delegate()-> + UpdateWallpaper(); +} + // static gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { int width = 0; diff --git a/ash/desktop_background/desktop_background_controller.h b/ash/desktop_background/desktop_background_controller.h index 4955d20..fdcd748 100644 --- a/ash/desktop_background/desktop_background_controller.h +++ b/ash/desktop_background/desktop_background_controller.h @@ -6,12 +6,14 @@ #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ #include "ash/ash_export.h" +#include "ash/display/display_controller.h" #include "base/basictypes.h" #include "base/files/file_path.h" #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" +#include "base/timer/timer.h" #include "ui/aura/window.h" #include "ui/compositor/layer.h" #include "ui/gfx/image/image_skia.h" @@ -65,7 +67,8 @@ class WallpaperResizer; // Loads selected desktop wallpaper from file system asynchronously and updates // background layer if loaded successfully. -class ASH_EXPORT DesktopBackgroundController { +class ASH_EXPORT DesktopBackgroundController + : public DisplayController::Observer { public: enum BackgroundMode { BACKGROUND_NONE, @@ -128,6 +131,9 @@ class ASH_EXPORT DesktopBackgroundController { // Returns true if the desktop moved. bool MoveDesktopToUnlockedContainer(); + // Overrides DisplayController::Observer: + virtual void OnDisplayConfigurationChanged() OVERRIDE; + private: friend class DesktopBackgroundControllerTest; FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize); @@ -170,6 +176,13 @@ class ASH_EXPORT DesktopBackgroundController { // Send notification that background animation finished. void NotifyAnimationFinished(); + // Reload the wallpaper. + void UpdateWallpaper(); + + void set_wallpaper_reload_delay_for_test(bool value) { + wallpaper_reload_delay_ = value; + } + // Returns the maximum size of all displays combined in native // resolutions. Note that this isn't the bounds of the display who // has maximum resolutions. Instead, this returns the size of the @@ -197,10 +210,16 @@ class ASH_EXPORT DesktopBackgroundController { base::FilePath current_default_wallpaper_path_; int current_default_wallpaper_resource_id_; + gfx::Size current_max_display_size_; + scoped_refptr<WallpaperLoader> wallpaper_loader_; base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; + base::OneShotTimer<DesktopBackgroundController> timer_; + + int wallpaper_reload_delay_; + DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); }; diff --git a/ash/desktop_background/desktop_background_controller_unittest.cc b/ash/desktop_background/desktop_background_controller_unittest.cc index c29c96d..5e4a2ea 100644 --- a/ash/desktop_background/desktop_background_controller_unittest.cc +++ b/ash/desktop_background/desktop_background_controller_unittest.cc @@ -15,6 +15,7 @@ #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" #include "ash/test/display_manager_test_api.h" +#include "ash/test/test_user_wallpaper_delegate.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/files/file_path.h" @@ -112,6 +113,9 @@ class DesktopBackgroundControllerTest : public test::AshTestBase { root_window_controller->SetWallpaperController(NULL); root_window_controller->SetAnimatingWallpaperController(NULL); controller_ = Shell::GetInstance()->desktop_background_controller(); + wallpaper_delegate_ = static_cast<test::TestUserWallpaperDelegate*>( + Shell::GetInstance()->user_wallpaper_delegate()); + controller_->set_wallpaper_reload_delay_for_test(0); } protected: @@ -254,6 +258,8 @@ class DesktopBackgroundControllerTest : public test::AshTestBase { DesktopBackgroundController* controller_; // Not owned. + test::TestUserWallpaperDelegate* wallpaper_delegate_; + private: DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundControllerTest); }; @@ -415,13 +421,9 @@ TEST_F(DesktopBackgroundControllerTest, ChangeWallpaperQuick) { root_window_controller->wallpaper_controller()); } -TEST_F(DesktopBackgroundControllerTest, GetAppropriateResolution) { - // TODO(derat|oshima|bshe): Configuring desktops seems busted on Win8, - // even when just a single display is being used -- the small wallpaper - // is used instead of the large one. Track down the cause of the problem - // and only use a SupportsMultipleDisplays() clause for the dual-display - // code below. - if (!SupportsMultipleDisplays()) +TEST_F(DesktopBackgroundControllerTest, DisplayChange) { + // TODO(derat|oshima|bshe): Host windows can't be resized on Win8. + if (!SupportsHostWindowResize()) return; test::DisplayManagerTestApi display_manager_test_api( @@ -431,36 +433,75 @@ TEST_F(DesktopBackgroundControllerTest, GetAppropriateResolution) { // equal to kSmallWallpaperMaxWidth by kSmallWallpaperMaxHeight, even if // multiple displays are connected. display_manager_test_api.UpdateDisplay("800x600"); + RunAllPendingInMessageLoop(); EXPECT_EQ(WALLPAPER_RESOLUTION_SMALL, controller_->GetAppropriateResolution()); + EXPECT_EQ(0, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); + display_manager_test_api.UpdateDisplay("800x600,800x600"); + RunAllPendingInMessageLoop(); EXPECT_EQ(WALLPAPER_RESOLUTION_SMALL, controller_->GetAppropriateResolution()); + EXPECT_EQ(0, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); + display_manager_test_api.UpdateDisplay("1366x800"); + RunAllPendingInMessageLoop(); EXPECT_EQ(WALLPAPER_RESOLUTION_SMALL, controller_->GetAppropriateResolution()); + EXPECT_EQ(1, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); // At larger sizes, large wallpapers should be used. display_manager_test_api.UpdateDisplay("1367x800"); + RunAllPendingInMessageLoop(); EXPECT_EQ(WALLPAPER_RESOLUTION_LARGE, controller_->GetAppropriateResolution()); + EXPECT_EQ(1, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); + display_manager_test_api.UpdateDisplay("1367x801"); + RunAllPendingInMessageLoop(); EXPECT_EQ(WALLPAPER_RESOLUTION_LARGE, controller_->GetAppropriateResolution()); + EXPECT_EQ(1, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); + display_manager_test_api.UpdateDisplay("2560x1700"); + RunAllPendingInMessageLoop(); EXPECT_EQ(WALLPAPER_RESOLUTION_LARGE, controller_->GetAppropriateResolution()); + EXPECT_EQ(1, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); // Rotated smaller screen may use larger image. display_manager_test_api.UpdateDisplay("800x600/r"); + RunAllPendingInMessageLoop(); EXPECT_EQ(WALLPAPER_RESOLUTION_SMALL, controller_->GetAppropriateResolution()); + EXPECT_EQ(1, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); + display_manager_test_api.UpdateDisplay("800x600/r,800x600"); + RunAllPendingInMessageLoop(); EXPECT_EQ(WALLPAPER_RESOLUTION_SMALL, controller_->GetAppropriateResolution()); + EXPECT_EQ(1, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); display_manager_test_api.UpdateDisplay("1366x800/r"); + RunAllPendingInMessageLoop(); EXPECT_EQ(WALLPAPER_RESOLUTION_LARGE, controller_->GetAppropriateResolution()); + EXPECT_EQ(1, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); + + // Max display size didn't chagne. + display_manager_test_api.UpdateDisplay("900x800/r,400x1366"); + RunAllPendingInMessageLoop(); + EXPECT_EQ(0, + wallpaper_delegate_->GetUpdateWallpaperCountAndReset()); + } // Test that DesktopBackgroundController loads the appropriate wallpaper diff --git a/ash/shell.cc b/ash/shell.cc index 3606c5d..8ee32d7 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -128,47 +128,6 @@ namespace { using aura::Window; using views::Widget; -// This dummy class is used for shell unit tests. We dont have chrome delegate -// in these tests. -class DummyUserWallpaperDelegate : public UserWallpaperDelegate { - public: - DummyUserWallpaperDelegate() {} - - virtual ~DummyUserWallpaperDelegate() {} - - virtual int GetAnimationType() OVERRIDE { - return views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; - } - - virtual bool ShouldShowInitialAnimation() OVERRIDE { - return false; - } - - virtual void UpdateWallpaper() OVERRIDE { - } - - virtual void InitializeWallpaper() OVERRIDE { - ash::Shell::GetInstance()->desktop_background_controller()-> - CreateEmptyWallpaper(); - } - - virtual void OpenSetWallpaperPage() OVERRIDE { - } - - virtual bool CanOpenSetWallpaperPage() OVERRIDE { - return false; - } - - virtual void OnWallpaperAnimationFinished() OVERRIDE { - } - - virtual void OnWallpaperBootAnimationFinished() OVERRIDE { - } - - private: - DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); -}; - // A Corewm VisibilityController subclass that calls the Ash animation routine // so we can pick up our extended animations. See ash/wm/window_animations.h. class AshVisibilityController : public views::corewm::VisibilityController { @@ -309,6 +268,7 @@ Shell::~Shell() { mru_window_tracker_.reset(); resolution_notification_controller_.reset(); + desktop_background_controller_.reset(); // This also deletes all RootWindows. Note that we invoke Shutdown() on // DisplayController before resetting |display_controller_|, since destruction @@ -569,8 +529,6 @@ void Shell::Init() { // This controller needs to be set before SetupManagedWindowMode. desktop_background_controller_.reset(new DesktopBackgroundController()); user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); - if (!user_wallpaper_delegate_) - user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); // StatusAreaWidget uses Shell's CapsLockDelegate. caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index eb6839c..fd95202 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -7,6 +7,7 @@ #include <limits> #include "ash/caps_lock_delegate_stub.h" +#include "ash/default_user_wallpaper_delegate.h" #include "ash/host/root_window_host_factory.h" #include "ash/keyboard_controller_proxy_stub.h" #include "ash/session_state_delegate.h" @@ -173,7 +174,7 @@ ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { } ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() { - return NULL; + return new DefaultUserWallpaperDelegate(); } ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() { diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index 85851eb..7423822 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -15,6 +15,7 @@ #include "ash/test/test_launcher_delegate.h" #include "ash/test/test_session_state_delegate.h" #include "ash/test/test_system_tray_delegate.h" +#include "ash/test/test_user_wallpaper_delegate.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" #include "base/logging.h" @@ -163,7 +164,7 @@ SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() { } UserWallpaperDelegate* TestShellDelegate::CreateUserWallpaperDelegate() { - return NULL; + return new TestUserWallpaperDelegate(); } CapsLockDelegate* TestShellDelegate::CreateCapsLockDelegate() { diff --git a/ash/test/test_user_wallpaper_delegate.cc b/ash/test/test_user_wallpaper_delegate.cc new file mode 100644 index 0000000..c3eb16e --- /dev/null +++ b/ash/test/test_user_wallpaper_delegate.cc @@ -0,0 +1,22 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/test/test_user_wallpaper_delegate.h" + +namespace ash { +namespace test { + +void TestUserWallpaperDelegate::UpdateWallpaper() { + DefaultUserWallpaperDelegate::UpdateWallpaper(); + update_wallpaper_count_ ++; +} + +int TestUserWallpaperDelegate::GetUpdateWallpaperCountAndReset() { + int count = update_wallpaper_count_; + update_wallpaper_count_ = 0; + return count; +} + +} // namespace test +} // namespace ash diff --git a/ash/test/test_user_wallpaper_delegate.h b/ash/test/test_user_wallpaper_delegate.h new file mode 100644 index 0000000..56842357 --- /dev/null +++ b/ash/test/test_user_wallpaper_delegate.h @@ -0,0 +1,32 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_TEST_TEST_USER_WALLPAPER_DELEGATE_H_ +#define ASH_TEST_TEST_USER_WALLPAPER_DELEGATE_H_ + +#include "ash/default_user_wallpaper_delegate.h" + +namespace ash { +namespace test { + +class TestUserWallpaperDelegate : public DefaultUserWallpaperDelegate { + public: + TestUserWallpaperDelegate() : update_wallpaper_count_(0) {} + virtual ~TestUserWallpaperDelegate() {} + + // DefaultUserWallpaperDelegate overrides: + virtual void UpdateWallpaper() OVERRIDE; + + int GetUpdateWallpaperCountAndReset(); + + private: + int update_wallpaper_count_; + + DISALLOW_COPY_AND_ASSIGN(TestUserWallpaperDelegate); +}; + +} // namespace test +} // namespace ash + +#endif // ASH_TEST_TEST_USER_WALLPAPER_DELEGATE_H_ |