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

Side by Side Diff: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h

Issue 2772313004: [ash-md] WIP Added wallpaper color caching. (Closed)
Patch Set: "Working'ish" prototype Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/public/interfaces/wallpaper.mojom.h" 12 #include "ash/public/interfaces/wallpaper.mojom.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted_memory.h" 14 #include "base/memory/ref_counted_memory.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "chrome/browser/chromeos/customization/customization_wallpaper_download er.h" 16 #include "chrome/browser/chromeos/customization/customization_wallpaper_download er.h"
17 #include "chrome/browser/chromeos/settings/cros_settings.h" 17 #include "chrome/browser/chromeos/settings/cros_settings.h"
18 #include "components/user_manager/user.h" 18 #include "components/user_manager/user.h"
19 #include "components/user_manager/user_image/user_image.h" 19 #include "components/user_manager/user_image/user_image.h"
20 #include "components/user_manager/user_manager.h" 20 #include "components/user_manager/user_manager.h"
21 #include "components/wallpaper/wallpaper_layout.h" 21 #include "components/wallpaper/wallpaper_layout.h"
22 #include "components/wallpaper/wallpaper_manager_base.h" 22 #include "components/wallpaper/wallpaper_manager_base.h"
23 #include "content/public/browser/notification_observer.h" 23 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_registrar.h" 24 #include "content/public/browser/notification_registrar.h"
25 #include "mojo/public/cpp/bindings/binding.h" 25 #include "mojo/public/cpp/bindings/binding.h"
26 #include "ui/gfx/image/image_skia.h" 26 #include "ui/gfx/image/image_skia.h"
27 27
28 namespace wallpaper {
29 class WallpaperColorCache;
30 } // namespace wallpaper
31
28 namespace chromeos { 32 namespace chromeos {
29 33
30 class WallpaperManager 34 class WallpaperManager
31 : public wallpaper::WallpaperManagerBase, 35 : public wallpaper::WallpaperManagerBase,
32 public ash::mojom::WallpaperPicker, 36 public ash::mojom::WallpaperPicker,
33 public content::NotificationObserver, 37 public content::NotificationObserver,
34 public user_manager::UserManager::UserSessionStateObserver { 38 public user_manager::UserManager::UserSessionStateObserver {
35 public: 39 public:
36 class PendingWallpaper; 40 class PendingWallpaper;
37 41
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 const wallpaper::WallpaperLayout layout, 190 const wallpaper::WallpaperLayout layout,
187 wallpaper::MovableOnDestroyCallbackHolder on_finish, 191 wallpaper::MovableOnDestroyCallbackHolder on_finish,
188 std::unique_ptr<user_manager::UserImage>* result_out) override; 192 std::unique_ptr<user_manager::UserImage>* result_out) override;
189 void SetDefaultWallpaperPath( 193 void SetDefaultWallpaperPath(
190 const base::FilePath& customized_default_wallpaper_file_small, 194 const base::FilePath& customized_default_wallpaper_file_small,
191 std::unique_ptr<gfx::ImageSkia> small_wallpaper_image, 195 std::unique_ptr<gfx::ImageSkia> small_wallpaper_image,
192 const base::FilePath& customized_default_wallpaper_file_large, 196 const base::FilePath& customized_default_wallpaper_file_large,
193 std::unique_ptr<gfx::ImageSkia> large_wallpaper_image) override; 197 std::unique_ptr<gfx::ImageSkia> large_wallpaper_image) override;
194 void RecordWallpaperAppType() override; 198 void RecordWallpaperAppType() override;
195 199
200 // void Foobar();
201
196 mojo::Binding<ash::mojom::WallpaperPicker> binding_; 202 mojo::Binding<ash::mojom::WallpaperPicker> binding_;
197 203
198 std::unique_ptr<CrosSettings::ObserverSubscription> 204 std::unique_ptr<CrosSettings::ObserverSubscription>
199 show_user_name_on_signin_subscription_; 205 show_user_name_on_signin_subscription_;
200 206
201 std::unique_ptr<CrosSettings::ObserverSubscription> 207 std::unique_ptr<CrosSettings::ObserverSubscription>
202 device_wallpaper_image_subscription_; 208 device_wallpaper_image_subscription_;
203 std::unique_ptr<CustomizationWallpaperDownloader> 209 std::unique_ptr<CustomizationWallpaperDownloader>
204 device_wallpaper_downloader_; 210 device_wallpaper_downloader_;
205 bool retry_download_if_failed_ = true; 211 bool retry_download_if_failed_ = true;
206 212
207 // Pointer to last inactive (waiting) entry of 'loading_' list. 213 // Pointer to last inactive (waiting) entry of 'loading_' list.
208 // NULL when there is no inactive request. 214 // NULL when there is no inactive request.
209 PendingWallpaper* pending_inactive_; 215 PendingWallpaper* pending_inactive_;
210 216
211 // Owns PendingWallpaper. 217 // Owns PendingWallpaper.
212 // PendingWallpaper deletes itself from here on load complete. 218 // PendingWallpaper deletes itself from here on load complete.
213 // All pending will be finally deleted on destroy. 219 // All pending will be finally deleted on destroy.
214 typedef std::vector<scoped_refptr<PendingWallpaper>> PendingList; 220 typedef std::vector<scoped_refptr<PendingWallpaper>> PendingList;
215 PendingList loading_; 221 PendingList loading_;
216 222
217 content::NotificationRegistrar registrar_; 223 content::NotificationRegistrar registrar_;
218 224
225 std::unique_ptr<wallpaper::WallpaperColorCache> wallpaper_color_cache_;
226
219 base::WeakPtrFactory<WallpaperManager> weak_factory_; 227 base::WeakPtrFactory<WallpaperManager> weak_factory_;
220 228
221 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); 229 DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
222 }; 230 };
223 231
224 } // namespace chromeos 232 } // namespace chromeos
225 233
226 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ 234 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698