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; | |
| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 extensions::ExternalLoader* CreateExternalLoader(Profile* profile); | 171 extensions::ExternalLoader* CreateExternalLoader(Profile* profile); |
| 171 | 172 |
| 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 // Set delay between network checking for testing. | 176 // Set delay between network checking for testing. |
| 176 void SetZeroNetworkDelayForTesting() { | 177 void SetZeroNetworkDelayForTesting() { |
| 177 network_delay_ = base::TimeDelta(); | 178 network_delay_ = base::TimeDelta(); |
| 178 } | 179 } |
| 179 | 180 |
| 181 // This is also used by WallpaperManager to set customized wallpaper path | |
| 182 // to global default before first wallpaper is shown. | |
| 183 static base::FilePath GetCustomizedWallpaperCacheDir(); | |
| 184 static base::FilePath GetCustomizedWallpaperDownloadedFileName(); | |
| 185 | |
| 180 private: | 186 private: |
| 181 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>; | 187 friend struct DefaultSingletonTraits<ServicesCustomizationDocument>; |
| 188 friend class CustomizationWallpaperDownloader; | |
|
Dmitry Polukhin
2014/03/27 04:36:32
What exactly do you need from private interface of
Alexander Alekseev
2014/03/31 14:15:40
OnCustomizedWallpaperDownloaded();
Ok, let's make
| |
| 182 | 189 |
| 183 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> > | 190 typedef std::vector<base::WeakPtr<ServicesCustomizationExternalLoader> > |
| 184 ExternalLoaders; | 191 ExternalLoaders; |
| 185 | 192 |
| 186 // C-tor for singleton construction. | 193 // C-tor for singleton construction. |
| 187 ServicesCustomizationDocument(); | 194 ServicesCustomizationDocument(); |
| 188 | 195 |
| 189 // C-tor for test construction. | 196 // C-tor for test construction. |
| 190 explicit ServicesCustomizationDocument(const std::string& manifest); | 197 explicit ServicesCustomizationDocument(const std::string& manifest); |
| 191 | 198 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 void OnCustomizationNotFound(); | 235 void OnCustomizationNotFound(); |
| 229 | 236 |
| 230 // Set OEM apps folder name for AppListSyncableService for |profile|. | 237 // Set OEM apps folder name for AppListSyncableService for |profile|. |
| 231 void SetOemFolderName(Profile* profile, const base::DictionaryValue& root); | 238 void SetOemFolderName(Profile* profile, const base::DictionaryValue& root); |
| 232 | 239 |
| 233 // Returns the name of the folder for OEM apps for given |locale|. | 240 // Returns the name of the folder for OEM apps for given |locale|. |
| 234 std::string GetOemAppsFolderNameImpl( | 241 std::string GetOemAppsFolderNameImpl( |
| 235 const std::string& locale, | 242 const std::string& locale, |
| 236 const base::DictionaryValue& root) const; | 243 const base::DictionaryValue& root) const; |
| 237 | 244 |
| 245 // Set Shell default wallpaper to customized. | |
| 246 static void SetDefaultWallpaperPath(const GURL& wallpaper_url); | |
|
Daniel Erat
2014/03/27 01:45:50
nit: SetDefaultWallpaperURL -- "Path" makes it sou
Alexander Alekseev
2014/03/31 14:15:40
Done.
| |
| 247 | |
| 248 // This is called by CustomizationWallpaperDownloader to destroy self. | |
| 249 static void DestroyWallpaperDownloader(); | |
| 250 | |
| 251 // Start download of wallpaper image if need. | |
| 252 void StartOEMWallpaperDownload(const GURL& wallpaper_url); | |
| 253 | |
| 254 // Check downloaded wallpaper and start download if needed. | |
| 255 void CheckAndApplyWallpaper(); | |
| 256 | |
| 257 // Intermediate function to pass the result of PathExists to ApplyWallpaper. | |
| 258 void OnCheckedWallpaperCacheExists(scoped_ptr<bool>); | |
| 259 | |
| 260 // Called after downloaded wallpaper has been checked. | |
| 261 void ApplyWallpaper(bool default_wallpaper_file_exists); | |
| 262 | |
| 238 // Services customization manifest URL. | 263 // Services customization manifest URL. |
| 239 GURL url_; | 264 GURL url_; |
| 240 | 265 |
| 241 // URLFetcher instance. | 266 // URLFetcher instance. |
| 242 scoped_ptr<net::URLFetcher> url_fetcher_; | 267 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 243 | 268 |
| 244 // How many times we already tried to fetch customization manifest file. | 269 // How many times we already tried to fetch customization manifest file. |
| 245 int num_retries_; | 270 int num_retries_; |
| 246 | 271 |
| 247 // Manifest fetch is already in progress. | 272 // Manifest fetch is already in progress. |
| 248 bool fetch_started_; | 273 bool fetch_started_; |
| 249 | 274 |
| 250 // Delay between checks for network online state. | 275 // Delay between checks for network online state. |
| 251 base::TimeDelta network_delay_; | 276 base::TimeDelta network_delay_; |
| 252 | 277 |
| 253 // Known external loaders. | 278 // Known external loaders. |
| 254 ExternalLoaders external_loaders_; | 279 ExternalLoaders external_loaders_; |
| 255 | 280 |
| 256 // Weak factory for callbacks. | 281 // Weak factory for callbacks. |
| 257 base::WeakPtrFactory<ServicesCustomizationDocument> weak_ptr_factory_; | 282 base::WeakPtrFactory<ServicesCustomizationDocument> weak_ptr_factory_; |
| 258 | 283 |
| 284 scoped_ptr<CustomizationWallpaperDownloader> wallpaper_downloader_; | |
| 285 | |
| 259 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); | 286 DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); |
| 260 }; | 287 }; |
| 261 | 288 |
| 262 } // namespace chromeos | 289 } // namespace chromeos |
| 263 | 290 |
| 264 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ | 291 #endif // CHROME_BROWSER_CHROMEOS_CUSTOMIZATION_DOCUMENT_H_ |
| OLD | NEW |