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

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: 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
50 // Load default wallpaper at |index| asynchronously and set to current
51 // wallpaper after loaded.
52 void SetDefaultWallpaper(int index);
53
54 // Load guest wallpaper asynchronously and set to current wallpaper after
55 // loaded.
56 void SetGuestWallpaper();
57
58 // Load logged in user wallpaper asynchronously and set to current wallpaper
59 // after loaded.
60 void SetLoggedInUserWallpaper();
61
49 // Sets the desktop background to image mode and create a new background 62 // Sets the desktop background to image mode and create a new background
50 // widget with user selected wallpaper or default wallpaper. Delete the old 63 // widget with user selected wallpaper or default wallpaper. Delete the old
51 // widget if any. 64 // widget if any.
52 void SetDesktopBackgroundImageMode(); 65 void SetDesktopBackgroundImageMode();
53 66
54 // Sets the desktop background to solid color mode and create a solid color 67 // Sets the desktop background to solid color mode and create a solid color
55 // layout. 68 // layout.
56 void SetDesktopBackgroundSolidColorMode(); 69 void SetDesktopBackgroundSolidColorMode();
57 70
58 private: 71 private:
72 // Start to load default wallpaper asynchronously.
73 void OnWallpaperLoadStarted(int index);
74
75 // Default wallpapper loaded, set the background mode to image mode.
76 void OnWallpaperLoadCompleted();
77
59 // Can change at runtime. 78 // Can change at runtime.
60 BackgroundMode desktop_background_mode_; 79 BackgroundMode desktop_background_mode_;
80 const SkBitmap* wallpaper_;
81 ImageLayout layout_;
82 int previous_index_;
83 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_;
61 84
62 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); 85 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController);
63 }; 86 };
64 87
65 } // namespace ash 88 } // namespace ash
66 89
67 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 90 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698