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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 WallpaperRestoreMinimizedWindowsFunction(); | 132 WallpaperRestoreMinimizedWindowsFunction(); |
133 | 133 |
134 protected: | 134 protected: |
135 virtual ~WallpaperRestoreMinimizedWindowsFunction(); | 135 virtual ~WallpaperRestoreMinimizedWindowsFunction(); |
136 | 136 |
137 // AsyncExtensionFunction overrides. | 137 // AsyncExtensionFunction overrides. |
138 virtual bool RunImpl() OVERRIDE; | 138 virtual bool RunImpl() OVERRIDE; |
139 }; | 139 }; |
140 | 140 |
141 class WallpaperGetThumbnailFunction : public AsyncExtensionFunction { | |
142 public: | |
143 DECLARE_EXTENSION_FUNCTION_NAME("wallpaperPrivate.getThumbnail"); | |
144 | |
145 WallpaperGetThumbnailFunction(); | |
146 | |
147 protected: | |
148 virtual ~WallpaperGetThumbnailFunction(); | |
149 | |
150 // AsyncExtensionFunction overrides. | |
151 virtual bool RunImpl() OVERRIDE; | |
152 | |
153 private: | |
154 // Failed to get thumbnail for |file_name|. | |
155 void Failure(const std::string& file_name); | |
156 | |
157 // Sets success field in the results to false. Called when the requested | |
158 // thumbnail is not found or corrupted in thumbnail directory. | |
159 void FileNotLoaded(); | |
160 | |
161 // Sets success field to true and data field to the loaded thumbnail binary | |
162 // data in the results. Called when requested wallpaper thumbnail loaded | |
163 // successfully. | |
164 void FileLoaded(const std::string& data); | |
165 | |
166 // Gets thumbnail with |file_name| from thumbnail directory. If |file_name| | |
167 // does not exist, call FileNotLoaded(). | |
168 void Get(const std::string& file_name); | |
169 | |
170 // Sequence token associated with wallpaper operations. Shared with | |
171 // WallpaperManager. | |
172 base::SequencedWorkerPool::SequenceToken sequence_token_; | |
173 }; | |
174 | |
175 class WallpaperSaveThumbnailFunction : public AsyncExtensionFunction { | |
176 public: | |
177 DECLARE_EXTENSION_FUNCTION_NAME("wallpaperPrivate.saveThumbnail"); | |
178 | |
179 WallpaperSaveThumbnailFunction(); | |
180 | |
181 protected: | |
182 virtual ~WallpaperSaveThumbnailFunction(); | |
183 | |
184 // AsyncExtensionFunction overrides. | |
185 virtual bool RunImpl() OVERRIDE; | |
186 | |
187 private: | |
188 // Failed to save thumbnail for |file_name|. | |
189 void Failure(const std::string& file_name); | |
190 | |
191 // Saved thumbnail to thumbnail directory. | |
192 void Success(); | |
193 | |
194 // Saves thumbnail to thumbnail directory as |file_name|. | |
195 void Save(const std::string& data, const std::string& file_name); | |
196 | |
197 // Sequence token associated with wallpaper operations. Shared with | |
198 // WallpaperManager. | |
199 base::SequencedWorkerPool::SequenceToken sequence_token_; | |
200 }; | |
201 | |
202 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ | 141 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ |
OLD | NEW |