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 #include "chrome/browser/chromeos/extensions/wallpaper_api.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/desktop_background/desktop_background_controller.h" | 11 #include "ash/desktop_background/desktop_background_controller.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/memory/ptr_util.h" |
14 #include "base/memory/ref_counted_memory.h" | 15 #include "base/memory/ref_counted_memory.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
16 #include "base/threading/worker_pool.h" | 17 #include "base/threading/worker_pool.h" |
17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" | 19 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" |
19 #include "chrome/browser/chromeos/file_manager/app_id.h" | 20 #include "chrome/browser/chromeos/file_manager/app_id.h" |
20 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 21 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
21 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 22 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 base::RefCountedBytes* original_data, | 230 base::RefCountedBytes* original_data, |
230 base::RefCountedBytes* thumbnail_data) { | 231 base::RefCountedBytes* thumbnail_data) { |
231 BinaryValue* original_result = BinaryValue::CreateWithCopiedBuffer( | 232 BinaryValue* original_result = BinaryValue::CreateWithCopiedBuffer( |
232 reinterpret_cast<const char*>(original_data->front()), | 233 reinterpret_cast<const char*>(original_data->front()), |
233 original_data->size()); | 234 original_data->size()); |
234 BinaryValue* thumbnail_result = BinaryValue::CreateWithCopiedBuffer( | 235 BinaryValue* thumbnail_result = BinaryValue::CreateWithCopiedBuffer( |
235 reinterpret_cast<const char*>(thumbnail_data->front()), | 236 reinterpret_cast<const char*>(thumbnail_data->front()), |
236 thumbnail_data->size()); | 237 thumbnail_data->size()); |
237 | 238 |
238 if (params_->details.thumbnail) { | 239 if (params_->details.thumbnail) { |
239 SetResult(thumbnail_result); | 240 SetResult(base::WrapUnique(thumbnail_result)); |
240 SendResponse(true); | 241 SendResponse(true); |
241 } | 242 } |
242 | 243 |
243 // Inform the native Wallpaper Picker Application that the current wallpaper | 244 // Inform the native Wallpaper Picker Application that the current wallpaper |
244 // has been modified by a third party application. | 245 // has been modified by a third party application. |
245 if (extension()->id() != extension_misc::kWallpaperManagerId) { | 246 if (extension()->id() != extension_misc::kWallpaperManagerId) { |
246 Profile* profile = Profile::FromBrowserContext(browser_context()); | 247 Profile* profile = Profile::FromBrowserContext(browser_context()); |
247 extensions::EventRouter* event_router = | 248 extensions::EventRouter* event_router = |
248 extensions::EventRouter::Get(profile); | 249 extensions::EventRouter::Get(profile); |
249 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); | 250 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); |
(...skipping 27 matching lines...) Expand all Loading... |
277 const std::string& response) { | 278 const std::string& response) { |
278 if (success) { | 279 if (success) { |
279 params_->details.data.reset( | 280 params_->details.data.reset( |
280 new std::vector<char>(response.begin(), response.end())); | 281 new std::vector<char>(response.begin(), response.end())); |
281 StartDecode(*params_->details.data); | 282 StartDecode(*params_->details.data); |
282 } else { | 283 } else { |
283 SetError(response); | 284 SetError(response); |
284 SendResponse(false); | 285 SendResponse(false); |
285 } | 286 } |
286 } | 287 } |
OLD | NEW |