OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/window_cycle_controller.h" | 10 #include "ash/wm/window_cycle_controller.h" |
11 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 return true; | 224 return true; |
225 } | 225 } |
226 | 226 |
227 class WallpaperFunctionBase::WallpaperDecoder : public ImageDecoder::Delegate { | 227 class WallpaperFunctionBase::WallpaperDecoder : public ImageDecoder::Delegate { |
228 public: | 228 public: |
229 explicit WallpaperDecoder(scoped_refptr<WallpaperFunctionBase> function) | 229 explicit WallpaperDecoder(scoped_refptr<WallpaperFunctionBase> function) |
230 : function_(function) { | 230 : function_(function) { |
231 } | 231 } |
232 | 232 |
233 void Start(const std::string& image_data) { | 233 void Start(const std::string& image_data) { |
| 234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
234 image_decoder_ = new ImageDecoder(this, image_data, | 235 image_decoder_ = new ImageDecoder(this, image_data, |
235 ImageDecoder::ROBUST_JPEG_CODEC); | 236 ImageDecoder::ROBUST_JPEG_CODEC); |
236 image_decoder_->Start(); | 237 scoped_refptr<base::MessageLoopProxy> task_runner = |
| 238 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); |
| 239 image_decoder_->Start(task_runner); |
237 } | 240 } |
238 | 241 |
239 void Cancel() { | 242 void Cancel() { |
240 cancel_flag_.Set(); | 243 cancel_flag_.Set(); |
241 } | 244 } |
242 | 245 |
243 virtual void OnImageDecoded(const ImageDecoder* decoder, | 246 virtual void OnImageDecoded(const ImageDecoder* decoder, |
244 const SkBitmap& decoded_image) OVERRIDE { | 247 const SkBitmap& decoded_image) OVERRIDE { |
245 gfx::ImageSkia final_image = | 248 gfx::ImageSkia final_image = |
246 gfx::ImageSkia::CreateFrom1xBitmap(decoded_image); | 249 gfx::ImageSkia::CreateFrom1xBitmap(decoded_image); |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 this, file_list)); | 696 this, file_list)); |
694 } | 697 } |
695 | 698 |
696 void WallpaperGetOfflineWallpaperListFunction::OnComplete( | 699 void WallpaperGetOfflineWallpaperListFunction::OnComplete( |
697 const std::vector<std::string>& file_list) { | 700 const std::vector<std::string>& file_list) { |
698 ListValue* results = new ListValue(); | 701 ListValue* results = new ListValue(); |
699 results->AppendStrings(file_list); | 702 results->AppendStrings(file_list); |
700 SetResult(results); | 703 SetResult(results); |
701 SendResponse(true); | 704 SendResponse(true); |
702 } | 705 } |
OLD | NEW |