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

Side by Side 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: Nit Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "ash/ash_export.h" 9 #include "ash/ash_export.h"
10 #include "ash/desktop_background/desktop_background_resources.h" 10 #include "ash/desktop_background/desktop_background_resources.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/weak_ptr.h"
12 13
13 class SkBitmap; 14 class SkBitmap;
14 15
15 namespace ash { 16 namespace ash {
16 17
17 class UserWallpaperDelegate { 18 class UserWallpaperDelegate {
18 public: 19 public:
19 virtual ~UserWallpaperDelegate() {} 20 virtual ~UserWallpaperDelegate() {}
20 21
21 // Gets the index of user selected wallpaper. 22 // Gets the index of user selected wallpaper.
(...skipping 17 matching lines...) Expand all
39 }; 40 };
40 41
41 DesktopBackgroundController(); 42 DesktopBackgroundController();
42 virtual ~DesktopBackgroundController(); 43 virtual ~DesktopBackgroundController();
43 44
44 // Get the desktop background mode. 45 // Get the desktop background mode.
45 BackgroundMode desktop_background_mode() const { 46 BackgroundMode desktop_background_mode() const {
46 return desktop_background_mode_; 47 return desktop_background_mode_;
47 } 48 }
48 49
49 // Sets the desktop background to image mode and create a new background 50 // Load default wallpaper at |index| asynchronously and set to current
50 // widget with user selected wallpaper or default wallpaper. Delete the old 51 // wallpaper after loaded.
51 // widget if any. 52 void SetDefaultWallpaper(int index);
52 void SetDesktopBackgroundImageMode(); 53
54 // Cancel the current wallpaper loading operation.
55 void CancelPendingWallpaperOperation();
56
57 // Load logged in user wallpaper asynchronously and set to current wallpaper
58 // after loaded.
59 void SetLoggedInUserWallpaper();
53 60
54 // Sets the desktop background to solid color mode and create a solid color 61 // Sets the desktop background to solid color mode and create a solid color
55 // layout. 62 // layout.
56 void SetDesktopBackgroundSolidColorMode(); 63 void SetDesktopBackgroundSolidColorMode();
57 64
58 private: 65 private:
66 // An operation to asynchronously load wallpaper.
67 class WallpaperOperation;
68
69 // Sets the desktop background to image mode and create a new background
70 // widget with user selected wallpaper or default wallpaper. Delete the old
71 // widget if any.
72 void SetDesktopBackgroundImageMode(scoped_refptr<WallpaperOperation> wo);
73
74 // Default wallpapper loaded, set the background mode to image mode.
75 void OnWallpaperLoadCompleted(scoped_refptr<WallpaperOperation> wo);
76
59 // Can change at runtime. 77 // Can change at runtime.
60 BackgroundMode desktop_background_mode_; 78 BackgroundMode desktop_background_mode_;
61 79
80 // The previous successfully loaded wallpaper.
81 int previous_index_;
82
83 scoped_refptr<WallpaperOperation> wallpaper_op_;
84
85 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_;
86
62 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); 87 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController);
63 }; 88 };
64 89
65 } // namespace ash 90 } // namespace ash
66 91
67 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 92 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698