| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/users/avatar/user_image_manager_test_uti
l.h" | 5 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_test_uti
l.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 return true; | 47 return true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 ImageLoader::ImageLoader(const base::FilePath& path) : path_(path) { | 50 ImageLoader::ImageLoader(const base::FilePath& path) : path_(path) { |
| 51 } | 51 } |
| 52 | 52 |
| 53 ImageLoader::~ImageLoader() { | 53 ImageLoader::~ImageLoader() { |
| 54 } | 54 } |
| 55 | 55 |
| 56 scoped_ptr<gfx::ImageSkia> ImageLoader::Load() { | 56 std::unique_ptr<gfx::ImageSkia> ImageLoader::Load() { |
| 57 std::string image_data; | 57 std::string image_data; |
| 58 ReadFileToString(path_, &image_data); | 58 ReadFileToString(path_, &image_data); |
| 59 ImageDecoder::StartWithOptions(this, image_data, | 59 ImageDecoder::StartWithOptions(this, image_data, |
| 60 ImageDecoder::ROBUST_JPEG_CODEC, false); | 60 ImageDecoder::ROBUST_JPEG_CODEC, false); |
| 61 run_loop_.Run(); | 61 run_loop_.Run(); |
| 62 return std::move(decoded_image_); | 62 return std::move(decoded_image_); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void ImageLoader::OnImageDecoded(const SkBitmap& decoded_image) { | 65 void ImageLoader::OnImageDecoded(const SkBitmap& decoded_image) { |
| 66 decoded_image_.reset( | 66 decoded_image_.reset( |
| 67 new gfx::ImageSkia(gfx::ImageSkiaRep(decoded_image, 1.0f))); | 67 new gfx::ImageSkia(gfx::ImageSkiaRep(decoded_image, 1.0f))); |
| 68 run_loop_.Quit(); | 68 run_loop_.Quit(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ImageLoader::OnDecodeImageFailed() { | 71 void ImageLoader::OnDecodeImageFailed() { |
| 72 run_loop_.Quit(); | 72 run_loop_.Quit(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace test | 75 } // namespace test |
| 76 } // namespace chromeos | 76 } // namespace chromeos |
| OLD | NEW |