| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 return true; | 223 return true; |
| 224 } | 224 } |
| 225 | 225 |
| 226 class WallpaperFunctionBase::WallpaperDecoder : public ImageDecoder::Delegate { | 226 class WallpaperFunctionBase::WallpaperDecoder : public ImageDecoder::Delegate { |
| 227 public: | 227 public: |
| 228 explicit WallpaperDecoder(scoped_refptr<WallpaperFunctionBase> function) | 228 explicit WallpaperDecoder(scoped_refptr<WallpaperFunctionBase> function) |
| 229 : function_(function) { | 229 : function_(function) { |
| 230 } | 230 } |
| 231 | 231 |
| 232 void Start(const std::string& image_data) { | 232 void Start(const std::string& image_data) { |
| 233 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 233 image_decoder_ = new ImageDecoder(this, image_data, | 234 image_decoder_ = new ImageDecoder(this, image_data, |
| 234 ImageDecoder::ROBUST_JPEG_CODEC); | 235 ImageDecoder::ROBUST_JPEG_CODEC); |
| 235 image_decoder_->Start(); | 236 scoped_refptr<base::MessageLoopProxy> task_runner = |
| 237 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); |
| 238 image_decoder_->Start(task_runner); |
| 236 } | 239 } |
| 237 | 240 |
| 238 void Cancel() { | 241 void Cancel() { |
| 239 cancel_flag_.Set(); | 242 cancel_flag_.Set(); |
| 240 } | 243 } |
| 241 | 244 |
| 242 virtual void OnImageDecoded(const ImageDecoder* decoder, | 245 virtual void OnImageDecoded(const ImageDecoder* decoder, |
| 243 const SkBitmap& decoded_image) OVERRIDE { | 246 const SkBitmap& decoded_image) OVERRIDE { |
| 244 gfx::ImageSkia final_image(decoded_image); | 247 gfx::ImageSkia final_image(decoded_image); |
| 245 final_image.MakeThreadSafe(); | 248 final_image.MakeThreadSafe(); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 this, file_list)); | 694 this, file_list)); |
| 692 } | 695 } |
| 693 | 696 |
| 694 void WallpaperGetOfflineWallpaperListFunction::OnComplete( | 697 void WallpaperGetOfflineWallpaperListFunction::OnComplete( |
| 695 const std::vector<std::string>& file_list) { | 698 const std::vector<std::string>& file_list) { |
| 696 ListValue* results = new ListValue(); | 699 ListValue* results = new ListValue(); |
| 697 results->AppendStrings(file_list); | 700 results->AppendStrings(file_list); |
| 698 SetResult(results); | 701 SetResult(results); |
| 699 SendResponse(true); | 702 SendResponse(true); |
| 700 } | 703 } |
| OLD | NEW |