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

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: 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 25 matching lines...) Expand all
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 ServicesCustomizationExternalLoader; 45 class ServicesCustomizationExternalLoader;
46 class CustomizationWallpaperDownloader;
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();
55 56
(...skipping 116 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
184 // to global default before first wallpaper is shown.
185 static base::FilePath GetCustomizedWallpaperCacheDir();
186 static base::FilePath GetCustomizedWallpaperDownloadedFileName();
187
188 // Set Shell default wallpaper to customized.
189 // Called by CustomizationWallpaperDownloader.
190 static void OnCustomizedWallpaperDownloaded(const GURL& wallpaper_url);
191
192 // This is called by CustomizationWallpaperDownloader to destroy self.
193 void DestroyWallpaperDownloader();
194
182 private: 195 private:
183 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>; 196 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>;
184 197
185 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> > 198 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> >
186 ExternalLoaders; 199 ExternalLoaders;
187 200
188 // C-tor for singleton construction. 201 // C-tor for singleton construction.
189 ServicesCustomizationDocument(); 202 ServicesCustomizationDocument();
190 203
191 // C-tor for test construction. 204 // C-tor for test construction.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void OnCustomizationNotFound(); 243 void OnCustomizationNotFound();
231 244
232 // Set OEM apps folder name for AppListSyncableService for |profile|. 245 // Set OEM apps folder name for AppListSyncableService for |profile|.
233 void SetOemFolderName(Profile* profile, const base::DictionaryValue& root); 246 void SetOemFolderName(Profile* profile, const base::DictionaryValue& root);
234 247
235 // Returns the name of the folder for OEM apps for given |locale|. 248 // Returns the name of the folder for OEM apps for given |locale|.
236 std::string GetOemAppsFolderNameImpl( 249 std::string GetOemAppsFolderNameImpl(
237 const std::string& locale, 250 const std::string& locale,
238 const base::DictionaryValue& root) const; 251 const base::DictionaryValue& root) const;
239 252
253 // Start download of wallpaper image if need.
254 void StartOEMWallpaperDownload(const GURL& wallpaper_url);
255
256 // Check downloaded wallpaper and start download if needed.
257 void CheckAndApplyWallpaper();
258
259 // Intermediate function to pass the result of PathExists to ApplyWallpaper.
260 void OnCheckedWallpaperCacheExists(scoped_ptr<bool>);
261
262 // Called after downloaded wallpaper has been checked.
263 void ApplyWallpaper(bool default_wallpaper_file_exists);
264
240 // Services customization manifest URL. 265 // Services customization manifest URL.
241 GURL url_; 266 GURL url_;
242 267
243 // URLFetcher instance. 268 // URLFetcher instance.
244 scoped_ptr<net::URLFetcher> url_fetcher_; 269 scoped_ptr<net::URLFetcher> url_fetcher_;
245 270
246 // How many times we already tried to fetch customization manifest file. 271 // How many times we already tried to fetch customization manifest file.
247 int num_retries_; 272 int num_retries_;
248 273
249 // Manifest fetch is already in progress. 274 // Manifest fetch is already in progress.
250 bool fetch_started_; 275 bool fetch_started_;
251 276
252 // Delay between checks for network online state. 277 // Delay between checks for network online state.
253 base::TimeDelta network_delay_; 278 base::TimeDelta network_delay_;
254 279
255 // Known external loaders. 280 // Known external loaders.
256 ExternalLoaders external_loaders_; 281 ExternalLoaders external_loaders_;
257 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
286 scoped_ptr<CustomizationWallpaperDownloader> wallpaper_downloader_;
287
261 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); 288 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument);
262 }; 289 };
263 290
264 } // namespace chromeos 291 } // namespace chromeos
265 292
266 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ 293 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698