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

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

Issue 208273005: If customization includes default wallpaper, download and apply it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 26 matching lines...) Expand all
37 namespace user_prefs { 37 namespace user_prefs {
38 class PrefRegistrySyncable; 38 class PrefRegistrySyncable;
39 } 39 }
40 40
41 // This test is in global namespace so it must be declared here. 41 // This test is in global namespace so it must be declared here.
42 void Test__InitStartupCustomizationDocument(const std::string& manifest); 42 void Test__InitStartupCustomizationDocument(const std::string& manifest);
43 43
44 namespace chromeos { 44 namespace chromeos {
45 45
46 class ServicesCustomizationExternalLoader; 46 class ServicesCustomizationExternalLoader;
47 class CustomizationWallpaperDownloader;
47 48
48 namespace system { 49 namespace system {
49 class StatisticsProvider; 50 class StatisticsProvider;
50 } // system 51 } // system
51 52
52 // Base class for OEM customization document classes. 53 // Base class for OEM customization document classes.
53 class CustomizationDocument { 54 class CustomizationDocument {
54 public: 55 public:
55 virtual ~CustomizationDocument(); 56 virtual ~CustomizationDocument();
56 57
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Returns default wallpaper URL. 164 // Returns default wallpaper URL.
164 GURL GetDefaultWallpaperUrl() const; 165 GURL GetDefaultWallpaperUrl() const;
165 166
166 // Returns list of default apps. 167 // Returns list of default apps.
167 bool GetDefaultApps(std::vector<std::string>* ids) const; 168 bool GetDefaultApps(std::vector<std::string>* ids) const;
168 169
169 // Creates an extensions::ExternalLoader that will provide OEM default apps. 170 // Creates an extensions::ExternalLoader that will provide OEM default apps.
170 // Cache of OEM default apps stored in profile preferences. 171 // Cache of OEM default apps stored in profile preferences.
171 extensions::ExternalLoader* CreateExternalLoader(Profile* profile); 172 extensions::ExternalLoader* CreateExternalLoader(Profile* profile);
172 173
174 // This is also used by Wallpaper manager to set customized wallpaper path
175 // to global default before first wallpaper was shown.
176 static base::FilePath GetCustomizedWallpaperCacheDir();
177 static base::FilePath GetCustomizedWallpaperDownloadedFileName();
178
173 private: 179 private:
174 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>; 180 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>;
181 friend class CustomizationWallpaperDownloader;
175 182
176 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> > 183 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> >
177 ExternalLoaders; 184 ExternalLoaders;
178 185
179 // C-tor for singleton construction. 186 // C-tor for singleton construction.
180 ServicesCustomizationDocument(); 187 ServicesCustomizationDocument();
181 188
182 // C-tor for test construction. 189 // C-tor for test construction.
183 explicit ServicesCustomizationDocument(const std::string& manifest); 190 explicit ServicesCustomizationDocument(const std::string& manifest);
184 191
(...skipping 20 matching lines...) Expand all
205 // Method called when manifest was successfully loaded. 212 // Method called when manifest was successfully loaded.
206 void OnManifestLoaded(); 213 void OnManifestLoaded();
207 214
208 // Returns list of default apps in ExternalProvider format. 215 // Returns list of default apps in ExternalProvider format.
209 static scoped_ptr<base::DictionaryValue> GetDefaultAppsInProviderFormat( 216 static scoped_ptr<base::DictionaryValue> GetDefaultAppsInProviderFormat(
210 const base::DictionaryValue& root); 217 const base::DictionaryValue& root);
211 218
212 // Update cached manifest for |profile|. 219 // Update cached manifest for |profile|.
213 void UpdateCachedManifest(Profile* profile); 220 void UpdateCachedManifest(Profile* profile);
214 221
222 // Set Shell default wallpaper to customized.
223 static void SetDefaultWallpaperPath(const GURL& wallpaper_url);
224
225 // This is called by CustomizationWallpaperDownloader to destroy self.
226 static void DestroyWallpaperDownloader();
227
228 // Start download of wallpaper image if need.
229 void StartOEMWallpaperDownload(const GURL& wallpaper_url);
230
231 // Check downloaded wallpaper and start download if needed.
232 void CheckAndApplyWallpaper();
233
234 // Intermediate function to pass the result of PathExists to ApplyWallpaper.
235 void OnCheckedWallpaperCacheExists(scoped_ptr<bool>);
236
237 // Called after downloaded wallpaper has been checked.
238 void ApplyWallpaper(bool default_wallpaper_file_exists);
239
215 // Services customization manifest URL. 240 // Services customization manifest URL.
216 GURL url_; 241 GURL url_;
217 242
218 // URLFetcher instance. 243 // URLFetcher instance.
219 scoped_ptr<net::URLFetcher> url_fetcher_; 244 scoped_ptr<net::URLFetcher> url_fetcher_;
220 245
221 // Timer to retry fetching file if network is not available. 246 // Timer to retry fetching file if network is not available.
222 base::OneShotTimer<ServicesCustomizationDocument> retry_timer_; 247 base::OneShotTimer<ServicesCustomizationDocument> retry_timer_;
223 248
224 // How many times we already tried to fetch customization manifest file. 249 // How many times we already tried to fetch customization manifest file.
225 int num_retries_; 250 int num_retries_;
226 251
227 // Manifest fetch is already in progress. 252 // Manifest fetch is already in progress.
228 bool fetch_started_; 253 bool fetch_started_;
229 254
230 // Known external loaders. 255 // Known external loaders.
231 ExternalLoaders external_loaders_; 256 ExternalLoaders external_loaders_;
232 257
258 scoped_ptr<CustomizationWallpaperDownloader> wallpaper_downloader_;
259
260 // Tests can destroy singletons.
261 base::WeakPtrFactory<ServicesCustomizationDocument> weak_factory_;
262
233 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); 263 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument);
234 }; 264 };
235 265
236 } // namespace chromeos 266 } // namespace chromeos
237 267
238 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ 268 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698