| 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 #include "chrome/browser/chromeos/login/user_image_loader.h" | 5 #include "chrome/browser/chromeos/login/user_image_loader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // Also downsize the image to save space and memory. | 85 // Also downsize the image to save space and memory. |
| 86 final_image = | 86 final_image = |
| 87 skia::ImageOperations::Resize(cropped_image, | 87 skia::ImageOperations::Resize(cropped_image, |
| 88 skia::ImageOperations::RESIZE_LANCZOS3, | 88 skia::ImageOperations::RESIZE_LANCZOS3, |
| 89 image_info.size, | 89 image_info.size, |
| 90 image_info.size); | 90 image_info.size); |
| 91 } else { | 91 } else { |
| 92 final_image = cropped_image; | 92 final_image = cropped_image; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 gfx::ImageSkia final_image_skia(final_image); |
| 96 final_image_skia.MakeThreadSafe(); |
| 96 target_message_loop_->PostTask( | 97 target_message_loop_->PostTask( |
| 97 FROM_HERE, | 98 FROM_HERE, |
| 98 base::Bind(image_info.loaded_cb, | 99 base::Bind(image_info.loaded_cb, |
| 99 UserImage(final_image, decoder->get_image_data()))); | 100 UserImage(final_image_skia, decoder->get_image_data()))); |
| 100 | 101 |
| 101 image_info_map_.erase(info_it); | 102 image_info_map_.erase(info_it); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void UserImageLoader::OnDecodeImageFailed(const ImageDecoder* decoder) { | 105 void UserImageLoader::OnDecodeImageFailed(const ImageDecoder* decoder) { |
| 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 106 image_info_map_.erase(decoder); | 107 image_info_map_.erase(decoder); |
| 107 } | 108 } |
| 108 | 109 |
| 109 } // namespace chromeos | 110 } // namespace chromeos |
| OLD | NEW |