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

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

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <deque> 10 #include <deque>
11 #include <memory>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "ash/desktop_background/desktop_background_controller.h" 15 #include "ash/desktop_background/desktop_background_controller.h"
15 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/ref_counted_memory.h" 18 #include "base/memory/ref_counted_memory.h"
18 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/observer_list.h" 20 #include "base/observer_list.h"
21 #include "base/threading/sequenced_worker_pool.h" 21 #include "base/threading/sequenced_worker_pool.h"
22 #include "base/time/time.h" 22 #include "base/time/time.h"
23 #include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h" 23 #include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h"
24 #include "chrome/browser/chromeos/settings/cros_settings.h" 24 #include "chrome/browser/chromeos/settings/cros_settings.h"
25 #include "components/user_manager/user.h" 25 #include "components/user_manager/user.h"
26 #include "components/user_manager/user_image/user_image.h" 26 #include "components/user_manager/user_image/user_image.h"
27 #include "components/user_manager/user_manager.h" 27 #include "components/user_manager/user_manager.h"
28 #include "components/wallpaper/wallpaper_layout.h" 28 #include "components/wallpaper/wallpaper_layout.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const content::NotificationSource& source, 73 const content::NotificationSource& source,
74 const content::NotificationDetails& details) override; 74 const content::NotificationDetails& details) override;
75 75
76 // Removes all |account_id| related wallpaper info and saved wallpapers. 76 // Removes all |account_id| related wallpaper info and saved wallpapers.
77 void RemoveUserWallpaperInfo(const AccountId& account_id) override; 77 void RemoveUserWallpaperInfo(const AccountId& account_id) override;
78 78
79 // Called when the policy-set wallpaper has been fetched. Initiates decoding 79 // Called when the policy-set wallpaper has been fetched. Initiates decoding
80 // of the JPEG |data| with a callback to SetPolicyControlledWallpaper(). 80 // of the JPEG |data| with a callback to SetPolicyControlledWallpaper().
81 void OnPolicyFetched(const std::string& policy, 81 void OnPolicyFetched(const std::string& policy,
82 const AccountId& account_id, 82 const AccountId& account_id,
83 scoped_ptr<std::string> data) override; 83 std::unique_ptr<std::string> data) override;
84 84
85 // Saves custom wallpaper to file, post task to generate thumbnail and updates 85 // Saves custom wallpaper to file, post task to generate thumbnail and updates
86 // local state preferences. If |update_wallpaper| is false, don't change 86 // local state preferences. If |update_wallpaper| is false, don't change
87 // wallpaper but only update cache. 87 // wallpaper but only update cache.
88 void SetCustomWallpaper(const AccountId& account_id, 88 void SetCustomWallpaper(const AccountId& account_id,
89 const wallpaper::WallpaperFilesId& wallpaper_files_id, 89 const wallpaper::WallpaperFilesId& wallpaper_files_id,
90 const std::string& file, 90 const std::string& file,
91 wallpaper::WallpaperLayout layout, 91 wallpaper::WallpaperLayout layout,
92 user_manager::User::WallpaperType type, 92 user_manager::User::WallpaperType type,
93 const gfx::ImageSkia& image, 93 const gfx::ImageSkia& image,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 PendingWallpaper* GetPendingWallpaper(const AccountId& account_id, 148 PendingWallpaper* GetPendingWallpaper(const AccountId& account_id,
149 bool delayed); 149 bool delayed);
150 150
151 // This is called by PendingWallpaper when load is finished. 151 // This is called by PendingWallpaper when load is finished.
152 void RemovePendingWallpaperFromList(PendingWallpaper* pending); 152 void RemovePendingWallpaperFromList(PendingWallpaper* pending);
153 153
154 // Set wallpaper to |user_image| controlled by policy. (Takes a UserImage 154 // Set wallpaper to |user_image| controlled by policy. (Takes a UserImage
155 // because that's the callback interface provided by UserImageLoader.) 155 // because that's the callback interface provided by UserImageLoader.)
156 void SetPolicyControlledWallpaper( 156 void SetPolicyControlledWallpaper(
157 const AccountId& account_id, 157 const AccountId& account_id,
158 scoped_ptr<user_manager::UserImage> user_image); 158 std::unique_ptr<user_manager::UserImage> user_image);
159 159
160 // Calls SetCustomWallpaper() with |wallpaper_files_id_str| received from 160 // Calls SetCustomWallpaper() with |wallpaper_files_id_str| received from
161 // cryptohome. 161 // cryptohome.
162 void SetCustomWallpaperOnSanitizedUsername( 162 void SetCustomWallpaperOnSanitizedUsername(
163 const AccountId& account_id, 163 const AccountId& account_id,
164 const gfx::ImageSkia& image, 164 const gfx::ImageSkia& image,
165 bool update_wallpaper, 165 bool update_wallpaper,
166 bool cryptohome_success, 166 bool cryptohome_success,
167 const std::string& wallpaper_files_id_str); 167 const std::string& wallpaper_files_id_str);
168 168
169 // WallpaperManagerBase overrides: 169 // WallpaperManagerBase overrides:
170 void InitializeRegisteredDeviceWallpaper() override; 170 void InitializeRegisteredDeviceWallpaper() override;
171 bool GetUserWallpaperInfo(const AccountId& account_id, 171 bool GetUserWallpaperInfo(const AccountId& account_id,
172 wallpaper::WallpaperInfo* info) const override; 172 wallpaper::WallpaperInfo* info) const override;
173 void OnWallpaperDecoded( 173 void OnWallpaperDecoded(
174 const AccountId& account_id, 174 const AccountId& account_id,
175 wallpaper::WallpaperLayout layout, 175 wallpaper::WallpaperLayout layout,
176 bool update_wallpaper, 176 bool update_wallpaper,
177 wallpaper::MovableOnDestroyCallbackHolder on_finish, 177 wallpaper::MovableOnDestroyCallbackHolder on_finish,
178 scoped_ptr<user_manager::UserImage> user_image) override; 178 std::unique_ptr<user_manager::UserImage> user_image) override;
179 void StartLoad(const AccountId& account_id, 179 void StartLoad(const AccountId& account_id,
180 const wallpaper::WallpaperInfo& info, 180 const wallpaper::WallpaperInfo& info,
181 bool update_wallpaper, 181 bool update_wallpaper,
182 const base::FilePath& wallpaper_path, 182 const base::FilePath& wallpaper_path,
183 wallpaper::MovableOnDestroyCallbackHolder on_finish) override; 183 wallpaper::MovableOnDestroyCallbackHolder on_finish) override;
184 void SetCustomizedDefaultWallpaperAfterCheck( 184 void SetCustomizedDefaultWallpaperAfterCheck(
185 const GURL& wallpaper_url, 185 const GURL& wallpaper_url,
186 const base::FilePath& downloaded_file, 186 const base::FilePath& downloaded_file,
187 scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files) override; 187 std::unique_ptr<CustomizedWallpaperRescaledFiles> rescaled_files)
188 override;
188 void OnCustomizedDefaultWallpaperResized( 189 void OnCustomizedDefaultWallpaperResized(
189 const GURL& wallpaper_url, 190 const GURL& wallpaper_url,
190 scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files, 191 std::unique_ptr<CustomizedWallpaperRescaledFiles> rescaled_files,
191 scoped_ptr<bool> success, 192 std::unique_ptr<bool> success,
192 scoped_ptr<gfx::ImageSkia> small_wallpaper_image, 193 std::unique_ptr<gfx::ImageSkia> small_wallpaper_image,
193 scoped_ptr<gfx::ImageSkia> large_wallpaper_image) override; 194 std::unique_ptr<gfx::ImageSkia> large_wallpaper_image) override;
194 void SetDefaultWallpaperPathsFromCommandLine( 195 void SetDefaultWallpaperPathsFromCommandLine(
195 base::CommandLine* command_line) override; 196 base::CommandLine* command_line) override;
196 void OnDefaultWallpaperDecoded( 197 void OnDefaultWallpaperDecoded(
197 const base::FilePath& path, 198 const base::FilePath& path,
198 const wallpaper::WallpaperLayout layout, 199 const wallpaper::WallpaperLayout layout,
199 scoped_ptr<user_manager::UserImage>* result, 200 std::unique_ptr<user_manager::UserImage>* result,
200 wallpaper::MovableOnDestroyCallbackHolder on_finish, 201 wallpaper::MovableOnDestroyCallbackHolder on_finish,
201 scoped_ptr<user_manager::UserImage> user_image) override; 202 std::unique_ptr<user_manager::UserImage> user_image) override;
202 void StartLoadAndSetDefaultWallpaper( 203 void StartLoadAndSetDefaultWallpaper(
203 const base::FilePath& path, 204 const base::FilePath& path,
204 const wallpaper::WallpaperLayout layout, 205 const wallpaper::WallpaperLayout layout,
205 wallpaper::MovableOnDestroyCallbackHolder on_finish, 206 wallpaper::MovableOnDestroyCallbackHolder on_finish,
206 scoped_ptr<user_manager::UserImage>* result_out) override; 207 std::unique_ptr<user_manager::UserImage>* result_out) override;
207 void SetDefaultWallpaperPath( 208 void SetDefaultWallpaperPath(
208 const base::FilePath& customized_default_wallpaper_file_small, 209 const base::FilePath& customized_default_wallpaper_file_small,
209 scoped_ptr<gfx::ImageSkia> small_wallpaper_image, 210 std::unique_ptr<gfx::ImageSkia> small_wallpaper_image,
210 const base::FilePath& customized_default_wallpaper_file_large, 211 const base::FilePath& customized_default_wallpaper_file_large,
211 scoped_ptr<gfx::ImageSkia> large_wallpaper_image) override; 212 std::unique_ptr<gfx::ImageSkia> large_wallpaper_image) override;
212 213
213 scoped_ptr<CrosSettings::ObserverSubscription> 214 std::unique_ptr<CrosSettings::ObserverSubscription>
214 show_user_name_on_signin_subscription_; 215 show_user_name_on_signin_subscription_;
215 216
216 // Pointer to last inactive (waiting) entry of 'loading_' list. 217 // Pointer to last inactive (waiting) entry of 'loading_' list.
217 // NULL when there is no inactive request. 218 // NULL when there is no inactive request.
218 PendingWallpaper* pending_inactive_; 219 PendingWallpaper* pending_inactive_;
219 220
220 // Owns PendingWallpaper. 221 // Owns PendingWallpaper.
221 // PendingWallpaper deletes itself from here on load complete. 222 // PendingWallpaper deletes itself from here on load complete.
222 // All pending will be finally deleted on destroy. 223 // All pending will be finally deleted on destroy.
223 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; 224 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList;
224 PendingList loading_; 225 PendingList loading_;
225 226
226 content::NotificationRegistrar registrar_; 227 content::NotificationRegistrar registrar_;
227 228
228 base::WeakPtrFactory<WallpaperManager> weak_factory_; 229 base::WeakPtrFactory<WallpaperManager> weak_factory_;
229 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); 230 DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
230 }; 231 };
231 232
232 } // namespace chromeos 233 } // namespace chromeos
233 234
234 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ 235 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698