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 |
11 #include "base/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
12 #include "chrome/browser/chromeos/extensions/wallpaper_function_base.h" | 12 #include "chrome/browser/chromeos/extensions/wallpaper_function_base.h" |
13 #include "chrome/common/extensions/api/wallpaper_private.h" | 13 #include "chrome/common/extensions/api/wallpaper_private.h" |
| 14 #include "components/signin/core/account_id/account_id.h" |
14 #include "net/url_request/url_fetcher_delegate.h" | 15 #include "net/url_request/url_fetcher_delegate.h" |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 class UserImage; | 18 class UserImage; |
18 } // namespace chromeos | 19 } // namespace chromeos |
19 | 20 |
20 // Wallpaper manager strings. | 21 // Wallpaper manager strings. |
21 class WallpaperPrivateGetStringsFunction : public SyncExtensionFunction { | 22 class WallpaperPrivateGetStringsFunction : public SyncExtensionFunction { |
22 public: | 23 public: |
23 DECLARE_EXTENSION_FUNCTION("wallpaperPrivate.getStrings", | 24 DECLARE_EXTENSION_FUNCTION("wallpaperPrivate.getStrings", |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 66 |
66 // Reads file specified by |file_path|. If success, post a task to start | 67 // Reads file specified by |file_path|. If success, post a task to start |
67 // decoding the file. | 68 // decoding the file. |
68 void ReadFileAndInitiateStartDecode(const base::FilePath& file_path, | 69 void ReadFileAndInitiateStartDecode(const base::FilePath& file_path, |
69 const base::FilePath& fallback_path); | 70 const base::FilePath& fallback_path); |
70 | 71 |
71 scoped_ptr<extensions::api::wallpaper_private::SetWallpaperIfExists::Params> | 72 scoped_ptr<extensions::api::wallpaper_private::SetWallpaperIfExists::Params> |
72 params; | 73 params; |
73 | 74 |
74 // User id of the active user when this api is been called. | 75 // User id of the active user when this api is been called. |
75 std::string user_id_; | 76 AccountId account_id_ = EmptyAccountId(); |
76 | 77 |
77 // Sequence token associated with wallpaper operations. Shared with | 78 // Sequence token associated with wallpaper operations. Shared with |
78 // WallpaperManager. | 79 // WallpaperManager. |
79 base::SequencedWorkerPool::SequenceToken sequence_token_; | 80 base::SequencedWorkerPool::SequenceToken sequence_token_; |
80 }; | 81 }; |
81 | 82 |
82 class WallpaperPrivateSetWallpaperFunction : public WallpaperFunctionBase { | 83 class WallpaperPrivateSetWallpaperFunction : public WallpaperFunctionBase { |
83 public: | 84 public: |
84 DECLARE_EXTENSION_FUNCTION("wallpaperPrivate.setWallpaper", | 85 DECLARE_EXTENSION_FUNCTION("wallpaperPrivate.setWallpaper", |
85 WALLPAPERPRIVATE_SETWALLPAPER) | 86 WALLPAPERPRIVATE_SETWALLPAPER) |
(...skipping 14 matching lines...) Expand all Loading... |
100 | 101 |
101 // Sets wallpaper to the decoded image. | 102 // Sets wallpaper to the decoded image. |
102 void SetDecodedWallpaper(scoped_ptr<gfx::ImageSkia> image); | 103 void SetDecodedWallpaper(scoped_ptr<gfx::ImageSkia> image); |
103 | 104 |
104 scoped_ptr<extensions::api::wallpaper_private::SetWallpaper::Params> params; | 105 scoped_ptr<extensions::api::wallpaper_private::SetWallpaper::Params> params; |
105 | 106 |
106 // The decoded wallpaper. It may accessed from UI thread to set wallpaper or | 107 // The decoded wallpaper. It may accessed from UI thread to set wallpaper or |
107 // FILE thread to resize and save wallpaper to disk. | 108 // FILE thread to resize and save wallpaper to disk. |
108 gfx::ImageSkia wallpaper_; | 109 gfx::ImageSkia wallpaper_; |
109 | 110 |
110 // User id of the active user when this api is been called. | 111 // User account id of the active user when this api is been called. |
111 std::string user_id_; | 112 AccountId account_id_ = EmptyAccountId(); |
112 | 113 |
113 // Sequence token associated with wallpaper operations. Shared with | 114 // Sequence token associated with wallpaper operations. Shared with |
114 // WallpaperManager. | 115 // WallpaperManager. |
115 base::SequencedWorkerPool::SequenceToken sequence_token_; | 116 base::SequencedWorkerPool::SequenceToken sequence_token_; |
116 }; | 117 }; |
117 | 118 |
118 class WallpaperPrivateResetWallpaperFunction | 119 class WallpaperPrivateResetWallpaperFunction |
119 : public AsyncExtensionFunction { | 120 : public AsyncExtensionFunction { |
120 public: | 121 public: |
121 DECLARE_EXTENSION_FUNCTION("wallpaperPrivate.resetWallpaper", | 122 DECLARE_EXTENSION_FUNCTION("wallpaperPrivate.resetWallpaper", |
(...skipping 29 matching lines...) Expand all Loading... |
151 // generating thunbail. | 152 // generating thunbail. |
152 void GenerateThumbnail(const base::FilePath& thumbnail_path, | 153 void GenerateThumbnail(const base::FilePath& thumbnail_path, |
153 scoped_ptr<gfx::ImageSkia> image); | 154 scoped_ptr<gfx::ImageSkia> image); |
154 | 155 |
155 // Thumbnail is ready. Calls api function javascript callback. | 156 // Thumbnail is ready. Calls api function javascript callback. |
156 void ThumbnailGenerated(base::RefCountedBytes* data); | 157 void ThumbnailGenerated(base::RefCountedBytes* data); |
157 | 158 |
158 scoped_ptr<extensions::api::wallpaper_private::SetCustomWallpaper::Params> | 159 scoped_ptr<extensions::api::wallpaper_private::SetCustomWallpaper::Params> |
159 params; | 160 params; |
160 | 161 |
161 // User id of the active user when this api is been called. | 162 // User account id of the active user when this api is been called. |
162 std::string user_id_; | 163 AccountId account_id_ = EmptyAccountId(); |
163 | 164 |
164 // User id hash of the logged in user. | 165 // User id hash of the logged in user. |
165 std::string user_id_hash_; | 166 std::string user_id_hash_; |
166 | 167 |
167 // Sequence token associated with wallpaper operations. Shared with | 168 // Sequence token associated with wallpaper operations. Shared with |
168 // WallpaperManager. | 169 // WallpaperManager. |
169 base::SequencedWorkerPool::SequenceToken sequence_token_; | 170 base::SequencedWorkerPool::SequenceToken sequence_token_; |
170 }; | 171 }; |
171 | 172 |
172 class WallpaperPrivateSetCustomWallpaperLayoutFunction | 173 class WallpaperPrivateSetCustomWallpaperLayoutFunction |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // Sends the list of files to extension api caller. If no files or no | 296 // Sends the list of files to extension api caller. If no files or no |
296 // directory, sends empty list. | 297 // directory, sends empty list. |
297 void OnComplete(const std::vector<std::string>& file_list); | 298 void OnComplete(const std::vector<std::string>& file_list); |
298 | 299 |
299 // Sequence token associated with wallpaper operations. Shared with | 300 // Sequence token associated with wallpaper operations. Shared with |
300 // WallpaperManager. | 301 // WallpaperManager. |
301 base::SequencedWorkerPool::SequenceToken sequence_token_; | 302 base::SequencedWorkerPool::SequenceToken sequence_token_; |
302 }; | 303 }; |
303 | 304 |
304 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ | 305 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ |
OLD | NEW |