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

Side by Side Diff: chrome/browser/chromeos/customization_document.h

Issue 236013002: Apply default wallpaper from customization manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After-review. Created 6 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 (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 CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_
6 #define CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ 6 #define CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 namespace user_prefs { 36 namespace user_prefs {
37 class PrefRegistrySyncable; 37 class PrefRegistrySyncable;
38 } 38 }
39 39
40 // This test is in global namespace so it must be declared here. 40 // This test is in global namespace so it must be declared here.
41 void Test__InitStartupCustomizationDocument(const std::string& manifest); 41 void Test__InitStartupCustomizationDocument(const std::string& manifest);
42 42
43 namespace chromeos { 43 namespace chromeos {
44 44
45 class CustomizationWallpaperDownloader;
45 class ServicesCustomizationExternalLoader; 46 class ServicesCustomizationExternalLoader;
46 47
47 namespace system { 48 namespace system {
48 class StatisticsProvider; 49 class StatisticsProvider;
49 } // system 50 } // system
50 51
51 // Base class for OEM customization document classes. 52 // Base class for OEM customization document classes.
52 class CustomizationDocument { 53 class CustomizationDocument {
53 public: 54 public:
54 virtual ~CustomizationDocument(); 55 virtual ~CustomizationDocument();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // Returns the name of the folder for OEM apps for given |locale|. 173 // Returns the name of the folder for OEM apps for given |locale|.
173 std::string GetOemAppsFolderName(const std::string& locale) const; 174 std::string GetOemAppsFolderName(const std::string& locale) const;
174 175
175 // Initialize instance of ServicesCustomizationDocument for tests that will 176 // Initialize instance of ServicesCustomizationDocument for tests that will
176 // override singleton until ShutdownForTesting is called. 177 // override singleton until ShutdownForTesting is called.
177 static void InitializeForTesting(); 178 static void InitializeForTesting();
178 179
179 // Remove instance of ServicesCustomizationDocument for tests. 180 // Remove instance of ServicesCustomizationDocument for tests.
180 static void ShutdownForTesting(); 181 static void ShutdownForTesting();
181 182
183 // This is also used by WallpaperManager to set customized wallpaper path
Nikita (slow) 2014/04/15 12:39:24 Comments needs to be updated. It says that these m
Alexander Alekseev 2014/04/15 22:47:31 Done.
184 // to global default before first wallpaper is shown.
185 static base::FilePath GetCustomizedWallpaperCacheDir();
186 static base::FilePath GetCustomizedWallpaperDownloadedFileName();
187
182 private: 188 private:
183 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>; 189 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>;
184 190
185 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> > 191 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> >
186 ExternalLoaders; 192 ExternalLoaders;
187 193
188 // C-tor for singleton construction. 194 // C-tor for singleton construction.
189 ServicesCustomizationDocument(); 195 ServicesCustomizationDocument();
190 196
191 // C-tor for test construction. 197 // C-tor for test construction.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void OnCustomizationNotFound(); 236 void OnCustomizationNotFound();
231 237
232 // Set OEM apps folder name for AppListSyncableService for |profile|. 238 // Set OEM apps folder name for AppListSyncableService for |profile|.
233 void SetOemFolderName(Profile* profile, const base::DictionaryValue& root); 239 void SetOemFolderName(Profile* profile, const base::DictionaryValue& root);
234 240
235 // Returns the name of the folder for OEM apps for given |locale|. 241 // Returns the name of the folder for OEM apps for given |locale|.
236 std::string GetOemAppsFolderNameImpl( 242 std::string GetOemAppsFolderNameImpl(
237 const std::string& locale, 243 const std::string& locale,
238 const base::DictionaryValue& root) const; 244 const base::DictionaryValue& root) const;
239 245
246 // Start download of wallpaper image if needed.
247 void StartOEMWallpaperDownload(const GURL& wallpaper_url);
248
249 // Check downloaded wallpaper and start download if needed.
Nikita (slow) 2014/04/15 12:39:24 nit:
Alexander Alekseev 2014/04/15 22:47:31 If we do not have final two rescaled wallpaper fil
250 void CheckAndApplyWallpaper();
Nikita (slow) 2014/04/15 12:39:24 nit: What does "check" mean in this context?
Alexander Alekseev 2014/04/15 22:47:31 Check that current customized wallpaper cache exis
251
252 // Intermediate function to pass the result of PathExists to ApplyWallpaper.
253 void OnCheckedWallpaperCacheExists(scoped_ptr<bool> exists);
254
255 // Called after downloaded wallpaper has been checked.
256 void ApplyWallpaper(bool default_wallpaper_file_exists);
257
258 // Set Shell default wallpaper to customized.
259 // It's wrapped as a callback and passed as a parameter to
260 // CustomizationWallpaperDownloader.
261 void OnCustomizedWallpaperDownloaded(bool success, const GURL& wallpaper_url);
Nikita (slow) 2014/04/15 12:39:24 nit: Rename to OnOEMWallpaperDownloaded() to match
Alexander Alekseev 2014/04/15 22:47:31 Done.
262
240 // Services customization manifest URL. 263 // Services customization manifest URL.
241 GURL url_; 264 GURL url_;
242 265
243 // URLFetcher instance. 266 // URLFetcher instance.
244 scoped_ptr<net::URLFetcher> url_fetcher_; 267 scoped_ptr<net::URLFetcher> url_fetcher_;
245 268
246 // How many times we already tried to fetch customization manifest file. 269 // How many times we already tried to fetch customization manifest file.
247 int num_retries_; 270 int num_retries_;
248 271
249 // Manifest fetch is already in progress. 272 // Manifest fetch is already in progress.
250 bool fetch_started_; 273 bool fetch_started_;
251 274
252 // Delay between checks for network online state. 275 // Delay between checks for network online state.
253 base::TimeDelta network_delay_; 276 base::TimeDelta network_delay_;
254 277
255 // Known external loaders. 278 // Known external loaders.
256 ExternalLoaders external_loaders_; 279 ExternalLoaders external_loaders_;
257 280
281 scoped_ptr<CustomizationWallpaperDownloader> wallpaper_downloader_;
282
258 // Weak factory for callbacks. 283 // Weak factory for callbacks.
259 base::WeakPtrFactory<ServicesCustomizationDocument> weak_ptr_factory_; 284 base::WeakPtrFactory<ServicesCustomizationDocument> weak_ptr_factory_;
260 285
261 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); 286 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument);
262 }; 287 };
263 288
264 } // namespace chromeos 289 } // namespace chromeos
265 290
266 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ 291 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698