Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: ash/desktop_background/desktop_background_controller.h

Issue 10207030: Asynchronously load wallpapers when user pod is selected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/desktop_background/desktop_background_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/desktop_background/desktop_background_controller.h
diff --git a/ash/desktop_background/desktop_background_controller.h b/ash/desktop_background/desktop_background_controller.h
index b603fbde546a71f3d1ec5cc661419252259394d7..b31a21464120ef1ecdff7e6f8e64f0ecb3c23329 100644
--- a/ash/desktop_background/desktop_background_controller.h
+++ b/ash/desktop_background/desktop_background_controller.h
@@ -9,6 +9,7 @@
#include "ash/ash_export.h"
#include "ash/desktop_background/desktop_background_resources.h"
#include "base/basictypes.h"
+#include "base/memory/weak_ptr.h"
class SkBitmap;
@@ -46,19 +47,51 @@ class ASH_EXPORT DesktopBackgroundController {
return desktop_background_mode_;
}
- // Sets the desktop background to image mode and create a new background
- // widget with user selected wallpaper or default wallpaper. Delete the old
- // widget if any.
- void SetDesktopBackgroundImageMode();
+ // Load default wallpaper at |index| asynchronously and set to current
+ // wallpaper after loaded.
+ void SetDefaultWallpaper(int index);
+
+ // Cancel the current wallpaper loading operation.
+ void CancelPendingWallpaperOperation();
+
+ // Load logged in user wallpaper asynchronously and set to current wallpaper
+ // after loaded.
+ void SetLoggedInUserWallpaper();
// Sets the desktop background to solid color mode and create a solid color
// layout.
void SetDesktopBackgroundSolidColorMode();
private:
+ // An operation to asynchronously load wallpaper.
+ class WallpaperOperation;
+
+ // Sets the desktop background to image mode and create a new background
+ // widget with user selected wallpaper or default wallpaper. Delete the old
+ // widget if any.
+ void SetDesktopBackgroundImageMode(scoped_refptr<WallpaperOperation> wo);
+
+ // Default wallpapper loaded, set the background mode to image mode.
+ void OnWallpaperLoadCompleted(scoped_refptr<WallpaperOperation> wo);
+
+ // Create an empty wallpaper. Some tests require a wallpaper widget is ready
+ // when running. However, the wallpaper widgets are now created asynchronously
+ // . If loading a real wallpaper, there are cases that these tests crash
+ // because the required widget is not ready. This function synchronously
+ // creates an empty widget for those tests to prevent crashes. An example test
+ // is SystemGestureEventFilterTest.ThreeFingerSwipe.
+ void CreateEmptyWallpaper();
+
// Can change at runtime.
BackgroundMode desktop_background_mode_;
+ // The previous successfully loaded wallpaper.
+ int previous_index_;
+
+ scoped_refptr<WallpaperOperation> wallpaper_op_;
+
+ base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController);
};
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/desktop_background/desktop_background_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698