Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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; | |
|
Daniel Erat
2014/04/14 15:26:15
nit: alphabetize these
Alexander Alekseev
2014/04/15 01:57:16
Done.
| |
| 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 Loading... | |
| 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 // This is called by CustomizationWallpaperDownloader to destroy self. | |
| 189 void DestroyWallpaperDownloader(); | |
| 190 | |
| 182 private: | 191 private: |
| 183 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>; | 192 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>; |
| 184 | 193 |
| 185 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> > | 194 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> > |
| 186 ExternalLoaders; | 195 ExternalLoaders; |
| 187 | 196 |
| 188 // C-tor for singleton construction. | 197 // C-tor for singleton construction. |
| 189 ServicesCustomizationDocument(); | 198 ServicesCustomizationDocument(); |
| 190 | 199 |
| 191 // C-tor for test construction. | 200 // C-tor for test construction. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 void OnCustomizationNotFound(); | 239 void OnCustomizationNotFound(); |
| 231 | 240 |
| 232 // Set OEM apps folder name for AppListSyncableService for |profile|. | 241 // Set OEM apps folder name for AppListSyncableService for |profile|. |
| 233 void SetOemFolderName(Profile* profile, const base::DictionaryValue& root); | 242 void SetOemFolderName(Profile* profile, const base::DictionaryValue& root); |
| 234 | 243 |
| 235 // Returns the name of the folder for OEM apps for given |locale|. | 244 // Returns the name of the folder for OEM apps for given |locale|. |
| 236 std::string GetOemAppsFolderNameImpl( | 245 std::string GetOemAppsFolderNameImpl( |
| 237 const std::string& locale, | 246 const std::string& locale, |
| 238 const base::DictionaryValue& root) const; | 247 const base::DictionaryValue& root) const; |
| 239 | 248 |
| 249 // Start download of wallpaper image if need. | |
|
Daniel Erat
2014/04/14 15:26:15
nit: s/need/needed/
Alexander Alekseev
2014/04/15 01:57:16
Done.
| |
| 250 void StartOEMWallpaperDownload(const GURL& wallpaper_url); | |
| 251 | |
| 252 // Check downloaded wallpaper and start download if needed. | |
| 253 void CheckAndApplyWallpaper(); | |
| 254 | |
| 255 // Intermediate function to pass the result of PathExists to ApplyWallpaper. | |
| 256 void OnCheckedWallpaperCacheExists(scoped_ptr<bool>); | |
|
Daniel Erat
2014/04/14 15:26:15
name this parameter
Alexander Alekseev
2014/04/15 01:57:16
Done.
| |
| 257 | |
| 258 // Called after downloaded wallpaper has been checked. | |
| 259 void ApplyWallpaper(bool default_wallpaper_file_exists); | |
| 260 | |
| 261 // Set Shell default wallpaper to customized. | |
| 262 // It's wrapped as a callback and passed as a parameter to | |
| 263 // CustomizationWallpaperDownloader. | |
| 264 void OnCustomizedWallpaperDownloaded(const GURL& wallpaper_url); | |
| 265 | |
| 240 // Services customization manifest URL. | 266 // Services customization manifest URL. |
| 241 GURL url_; | 267 GURL url_; |
| 242 | 268 |
| 243 // URLFetcher instance. | 269 // URLFetcher instance. |
| 244 scoped_ptr<net::URLFetcher> url_fetcher_; | 270 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 245 | 271 |
| 246 // How many times we already tried to fetch customization manifest file. | 272 // How many times we already tried to fetch customization manifest file. |
| 247 int num_retries_; | 273 int num_retries_; |
| 248 | 274 |
| 249 // Manifest fetch is already in progress. | 275 // Manifest fetch is already in progress. |
| 250 bool fetch_started_; | 276 bool fetch_started_; |
| 251 | 277 |
| 252 // Delay between checks for network online state. | 278 // Delay between checks for network online state. |
| 253 base::TimeDelta network_delay_; | 279 base::TimeDelta network_delay_; |
| 254 | 280 |
| 255 // Known external loaders. | 281 // Known external loaders. |
| 256 ExternalLoaders external_loaders_; | 282 ExternalLoaders external_loaders_; |
| 257 | 283 |
| 258 // Weak factory for callbacks. | 284 // Weak factory for callbacks. |
| 259 base::WeakPtrFactory<ServicesCustomizationDocument> weak_ptr_factory_; | 285 base::WeakPtrFactory<ServicesCustomizationDocument> weak_ptr_factory_; |
| 260 | 286 |
| 287 scoped_ptr<CustomizationWallpaperDownloader> wallpaper_downloader_; | |
|
Daniel Erat
2014/04/14 15:26:15
weak_ptr_factory_ should come last in the class de
Alexander Alekseev
2014/04/15 01:57:16
Done.
| |
| 288 | |
| 261 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); | 289 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); |
| 262 }; | 290 }; |
| 263 | 291 |
| 264 } // namespace chromeos | 292 } // namespace chromeos |
| 265 | 293 |
| 266 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ | 294 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ |
| OLD | NEW |