| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSIONS_WALLPAPER_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_API_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_API_H_ |
| 7 | 7 |
| 8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
| 10 #include "chrome/browser/chromeos/extensions/wallpaper_function_base.h" | 10 #include "chrome/browser/chromeos/extensions/wallpaper_function_base.h" |
| 11 | 11 |
| 12 // Implementation of chrome.wallpaper.setWallpaper API. | 12 // Implementation of chrome.wallpaper.setWallpaper API. |
| 13 // After this API being called, a jpeg encoded wallpaper will be saved to | 13 // After this API being called, a jpeg encoded wallpaper will be saved to |
| 14 // /home/chronos/custom_wallpaper/{resolution}/{username}/file_name. The | 14 // /home/chronos/custom_wallpaper/{resolution}/{user_id_hash}/file_name. The |
| 15 // wallpaper can then persistent after Chrome restart. New call to this API | 15 // wallpaper can then persistent after Chrome restart. New call to this API |
| 16 // will replace the previous saved wallpaper with new one. | 16 // will replace the previous saved wallpaper with new one. |
| 17 // Note: For security reason, the original encoded wallpaper image is not saved | 17 // Note: For security reason, the original encoded wallpaper image is not saved |
| 18 // directly. It is decoded and re-encoded to jpeg format before saved to file | 18 // directly. It is decoded and re-encoded to jpeg format before saved to file |
| 19 // system. | 19 // system. |
| 20 class WallpaperSetWallpaperFunction : public WallpaperFunctionBase { | 20 class WallpaperSetWallpaperFunction : public WallpaperFunctionBase { |
| 21 public: | 21 public: |
| 22 DECLARE_EXTENSION_FUNCTION("wallpaper.setWallpaper", | 22 DECLARE_EXTENSION_FUNCTION("wallpaper.setWallpaper", |
| 23 WALLPAPER_SETWALLPAPER) | 23 WALLPAPER_SETWALLPAPER) |
| 24 | 24 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 44 // Layout of the downloaded wallpaper. | 44 // Layout of the downloaded wallpaper. |
| 45 ash::WallpaperLayout layout_; | 45 ash::WallpaperLayout layout_; |
| 46 | 46 |
| 47 // True if need to generate thumbnail and pass to callback. | 47 // True if need to generate thumbnail and pass to callback. |
| 48 bool generate_thumbnail_; | 48 bool generate_thumbnail_; |
| 49 | 49 |
| 50 // Unique file name of the custom wallpaper. | 50 // Unique file name of the custom wallpaper. |
| 51 std::string file_name_; | 51 std::string file_name_; |
| 52 | 52 |
| 53 // Email address of logged in user. | 53 // Email address of logged in user. |
| 54 // TODO(bshe): User's email should not be used as part of wallpaper file path. | |
| 55 // http://crbug.com/287020 | |
| 56 std::string email_; | 54 std::string email_; |
| 57 | 55 |
| 56 // User id hash of the logged in user. |
| 57 std::string user_id_hash_; |
| 58 |
| 58 // String representation of downloaded wallpaper. | 59 // String representation of downloaded wallpaper. |
| 59 std::string image_data_; | 60 std::string image_data_; |
| 60 | 61 |
| 61 // Sequence token associated with wallpaper operations. Shared with | 62 // Sequence token associated with wallpaper operations. Shared with |
| 62 // WallpaperManager. | 63 // WallpaperManager. |
| 63 base::SequencedWorkerPool::SequenceToken sequence_token_; | 64 base::SequencedWorkerPool::SequenceToken sequence_token_; |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_API_H_ | 67 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_API_H_ |
| 67 | 68 |
| OLD | NEW |