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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void OnWallpaperDecoded(const gfx::ImageSkia& image) override; | 67 void OnWallpaperDecoded(const gfx::ImageSkia& image) override; |
68 | 68 |
69 // File doesn't exist. Sets javascript callback parameter to false. | 69 // File doesn't exist. Sets javascript callback parameter to false. |
70 void OnFileNotExists(const std::string& error); | 70 void OnFileNotExists(const std::string& error); |
71 | 71 |
72 // Reads file specified by |file_path|. If success, post a task to start | 72 // Reads file specified by |file_path|. If success, post a task to start |
73 // decoding the file. | 73 // decoding the file. |
74 void ReadFileAndInitiateStartDecode(const base::FilePath& file_path, | 74 void ReadFileAndInitiateStartDecode(const base::FilePath& file_path, |
75 const base::FilePath& fallback_path); | 75 const base::FilePath& fallback_path); |
76 | 76 |
77 scoped_ptr<extensions::api::wallpaper_private::SetWallpaperIfExists::Params> | 77 std::unique_ptr< |
| 78 extensions::api::wallpaper_private::SetWallpaperIfExists::Params> |
78 params; | 79 params; |
79 | 80 |
80 // User id of the active user when this api is been called. | 81 // User id of the active user when this api is been called. |
81 AccountId account_id_ = EmptyAccountId(); | 82 AccountId account_id_ = EmptyAccountId(); |
82 | 83 |
83 // Sequence token associated with wallpaper operations. Shared with | 84 // Sequence token associated with wallpaper operations. Shared with |
84 // WallpaperManager. | 85 // WallpaperManager. |
85 base::SequencedWorkerPool::SequenceToken sequence_token_; | 86 base::SequencedWorkerPool::SequenceToken sequence_token_; |
86 }; | 87 }; |
87 | 88 |
(...skipping 10 matching lines...) Expand all Loading... |
98 // AsyncExtensionFunction overrides. | 99 // AsyncExtensionFunction overrides. |
99 bool RunAsync() override; | 100 bool RunAsync() override; |
100 | 101 |
101 private: | 102 private: |
102 void OnWallpaperDecoded(const gfx::ImageSkia& image) override; | 103 void OnWallpaperDecoded(const gfx::ImageSkia& image) override; |
103 | 104 |
104 // Saves the image data to a file. | 105 // Saves the image data to a file. |
105 void SaveToFile(); | 106 void SaveToFile(); |
106 | 107 |
107 // Sets wallpaper to the decoded image. | 108 // Sets wallpaper to the decoded image. |
108 void SetDecodedWallpaper(scoped_ptr<gfx::ImageSkia> image); | 109 void SetDecodedWallpaper(std::unique_ptr<gfx::ImageSkia> image); |
109 | 110 |
110 scoped_ptr<extensions::api::wallpaper_private::SetWallpaper::Params> params; | 111 std::unique_ptr<extensions::api::wallpaper_private::SetWallpaper::Params> |
| 112 params; |
111 | 113 |
112 // The decoded wallpaper. It may accessed from UI thread to set wallpaper or | 114 // The decoded wallpaper. It may accessed from UI thread to set wallpaper or |
113 // FILE thread to resize and save wallpaper to disk. | 115 // FILE thread to resize and save wallpaper to disk. |
114 gfx::ImageSkia wallpaper_; | 116 gfx::ImageSkia wallpaper_; |
115 | 117 |
116 // User account id of the active user when this api is been called. | 118 // User account id of the active user when this api is been called. |
117 AccountId account_id_ = EmptyAccountId(); | 119 AccountId account_id_ = EmptyAccountId(); |
118 | 120 |
119 // Sequence token associated with wallpaper operations. Shared with | 121 // Sequence token associated with wallpaper operations. Shared with |
120 // WallpaperManager. | 122 // WallpaperManager. |
(...skipping 28 matching lines...) Expand all Loading... |
149 | 151 |
150 // AsyncExtensionFunction overrides. | 152 // AsyncExtensionFunction overrides. |
151 bool RunAsync() override; | 153 bool RunAsync() override; |
152 | 154 |
153 private: | 155 private: |
154 void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) override; | 156 void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) override; |
155 | 157 |
156 // Generates thumbnail of custom wallpaper. A simple STRETCH is used for | 158 // Generates thumbnail of custom wallpaper. A simple STRETCH is used for |
157 // generating thunbail. | 159 // generating thunbail. |
158 void GenerateThumbnail(const base::FilePath& thumbnail_path, | 160 void GenerateThumbnail(const base::FilePath& thumbnail_path, |
159 scoped_ptr<gfx::ImageSkia> image); | 161 std::unique_ptr<gfx::ImageSkia> image); |
160 | 162 |
161 // Thumbnail is ready. Calls api function javascript callback. | 163 // Thumbnail is ready. Calls api function javascript callback. |
162 void ThumbnailGenerated(base::RefCountedBytes* data); | 164 void ThumbnailGenerated(base::RefCountedBytes* data); |
163 | 165 |
164 scoped_ptr<extensions::api::wallpaper_private::SetCustomWallpaper::Params> | 166 std::unique_ptr< |
| 167 extensions::api::wallpaper_private::SetCustomWallpaper::Params> |
165 params; | 168 params; |
166 | 169 |
167 // User account id of the active user when this api is been called. | 170 // User account id of the active user when this api is been called. |
168 AccountId account_id_ = EmptyAccountId(); | 171 AccountId account_id_ = EmptyAccountId(); |
169 | 172 |
170 // User id hash of the logged in user. | 173 // User id hash of the logged in user. |
171 wallpaper::WallpaperFilesId wallpaper_files_id_; | 174 wallpaper::WallpaperFilesId wallpaper_files_id_; |
172 | 175 |
173 // Sequence token associated with wallpaper operations. Shared with | 176 // Sequence token associated with wallpaper operations. Shared with |
174 // WallpaperManager. | 177 // WallpaperManager. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 WALLPAPERPRIVATE_RECORDWALLPAPERUMA) | 319 WALLPAPERPRIVATE_RECORDWALLPAPERUMA) |
317 | 320 |
318 protected: | 321 protected: |
319 ~WallpaperPrivateRecordWallpaperUMAFunction() override {} | 322 ~WallpaperPrivateRecordWallpaperUMAFunction() override {} |
320 | 323 |
321 // SyncExtensionFunction overrides. | 324 // SyncExtensionFunction overrides. |
322 bool RunSync() override; | 325 bool RunSync() override; |
323 }; | 326 }; |
324 | 327 |
325 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ | 328 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ |
OLD | NEW |