| 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_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_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/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 virtual ~WallpaperPrivateSetCustomWallpaperFunction(); | 141 virtual ~WallpaperPrivateSetCustomWallpaperFunction(); |
| 142 | 142 |
| 143 // AsyncExtensionFunction overrides. | 143 // AsyncExtensionFunction overrides. |
| 144 virtual bool RunImpl() OVERRIDE; | 144 virtual bool RunImpl() OVERRIDE; |
| 145 | 145 |
| 146 private: | 146 private: |
| 147 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) OVERRIDE; | 147 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) OVERRIDE; |
| 148 | 148 |
| 149 // Generates thumbnail of custom wallpaper. A simple STRETCH is used for | 149 // Generates thumbnail of custom wallpaper. A simple STRETCH is used for |
| 150 // generating thunbail. | 150 // generating thunbail. |
| 151 void GenerateThumbnail(const FilePath& thumbnail_path, | 151 void GenerateThumbnail(const base::FilePath& thumbnail_path, |
| 152 scoped_ptr<gfx::ImageSkia> image); | 152 scoped_ptr<gfx::ImageSkia> image); |
| 153 | 153 |
| 154 // Thumbnail is ready. Calls api function javascript callback. | 154 // Thumbnail is ready. Calls api function javascript callback. |
| 155 void ThumbnailGenerated(); | 155 void ThumbnailGenerated(); |
| 156 | 156 |
| 157 // Layout of the downloaded wallpaper. | 157 // Layout of the downloaded wallpaper. |
| 158 ash::WallpaperLayout layout_; | 158 ash::WallpaperLayout layout_; |
| 159 | 159 |
| 160 // Email address of logged in user. | 160 // Email address of logged in user. |
| 161 std::string email_; | 161 std::string email_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 // Returns true to suppress javascript console error. Called when the | 218 // Returns true to suppress javascript console error. Called when the |
| 219 // requested thumbnail is not found or corrupted in thumbnail directory. | 219 // requested thumbnail is not found or corrupted in thumbnail directory. |
| 220 void FileNotLoaded(); | 220 void FileNotLoaded(); |
| 221 | 221 |
| 222 // Sets data field to the loaded thumbnail binary data in the results. Called | 222 // Sets data field to the loaded thumbnail binary data in the results. Called |
| 223 // when requested wallpaper thumbnail loaded successfully. | 223 // when requested wallpaper thumbnail loaded successfully. |
| 224 void FileLoaded(const std::string& data); | 224 void FileLoaded(const std::string& data); |
| 225 | 225 |
| 226 // Gets thumbnail from |path|. If |path| does not exist, call FileNotLoaded(). | 226 // Gets thumbnail from |path|. If |path| does not exist, call FileNotLoaded(). |
| 227 void Get(const FilePath& path); | 227 void Get(const base::FilePath& path); |
| 228 | 228 |
| 229 // Sequence token associated with wallpaper operations. Shared with | 229 // Sequence token associated with wallpaper operations. Shared with |
| 230 // WallpaperManager. | 230 // WallpaperManager. |
| 231 base::SequencedWorkerPool::SequenceToken sequence_token_; | 231 base::SequencedWorkerPool::SequenceToken sequence_token_; |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 class WallpaperPrivateSaveThumbnailFunction : public AsyncExtensionFunction { | 234 class WallpaperPrivateSaveThumbnailFunction : public AsyncExtensionFunction { |
| 235 public: | 235 public: |
| 236 DECLARE_EXTENSION_FUNCTION("wallpaperPrivate.saveThumbnail", | 236 DECLARE_EXTENSION_FUNCTION("wallpaperPrivate.saveThumbnail", |
| 237 WALLPAPERPRIVATE_SAVETHUMBNAIL) | 237 WALLPAPERPRIVATE_SAVETHUMBNAIL) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // Sends the list of files to extension api caller. If no files or no | 279 // Sends the list of files to extension api caller. If no files or no |
| 280 // directory, sends empty list. | 280 // directory, sends empty list. |
| 281 void OnComplete(const std::vector<std::string>& file_list); | 281 void OnComplete(const std::vector<std::string>& file_list); |
| 282 | 282 |
| 283 // Sequence token associated with wallpaper operations. Shared with | 283 // Sequence token associated with wallpaper operations. Shared with |
| 284 // WallpaperManager. | 284 // WallpaperManager. |
| 285 base::SequencedWorkerPool::SequenceToken sequence_token_; | 285 base::SequencedWorkerPool::SequenceToken sequence_token_; |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ | 288 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ |
| OLD | NEW |