Index: chrome/browser/chromeos/login/user_image_loader.cc |
diff --git a/chrome/browser/chromeos/login/user_image_loader.cc b/chrome/browser/chromeos/login/user_image_loader.cc |
index 52c4ace20b4456a6a74514c366e121387f53cd9f..143ee4a0bb108912e70b5d174e184e3d04a95ab9 100644 |
--- a/chrome/browser/chromeos/login/user_image_loader.cc |
+++ b/chrome/browser/chromeos/login/user_image_loader.cc |
@@ -7,8 +7,10 @@ |
#include "base/bind.h" |
#include "base/file_path.h" |
#include "base/file_util.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/message_loop.h" |
#include "chrome/browser/chromeos/login/helper.h" |
+#include "chrome/browser/chromeos/login/user_image.h" |
#include "content/public/browser/browser_thread.h" |
#include "skia/ext/image_operations.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
@@ -19,8 +21,11 @@ using content::BrowserThread; |
namespace chromeos { |
-UserImageLoader::ImageInfo::ImageInfo(int size, const LoadedCallback& loaded_cb) |
+UserImageLoader::ImageInfo::ImageInfo(int size, |
+ bool load_raw_image, |
+ const LoadedCallback& loaded_cb) |
: size(size), |
+ load_raw_image(load_raw_image), |
loaded_cb(loaded_cb) { |
} |
@@ -36,10 +41,11 @@ UserImageLoader::~UserImageLoader() { |
void UserImageLoader::Start(const std::string& filepath, |
int size, |
+ bool load_raw_image, |
const LoadedCallback& loaded_cb) { |
target_message_loop_ = MessageLoop::current(); |
- ImageInfo image_info(size, loaded_cb); |
+ ImageInfo image_info(size, load_raw_image, loaded_cb); |
BrowserThread::PostTask( |
BrowserThread::FILE, FROM_HERE, |
base::Bind(&UserImageLoader::LoadImage, this, filepath, image_info)); |
@@ -86,9 +92,15 @@ void UserImageLoader::OnImageDecoded(const ImageDecoder* decoder, |
image_info.size); |
} |
+ scoped_ptr<UserImage> user_image; |
+ if (image_info.load_raw_image) |
+ user_image.reset(new UserImage(final_image, decoder->get_image_data())); |
+ else |
+ user_image.reset(new UserImage(final_image)); |
+ |
target_message_loop_->PostTask( |
FROM_HERE, |
- base::Bind(image_info.loaded_cb, final_image)); |
+ base::Bind(image_info.loaded_cb, *user_image)); |
image_info_map_.erase(info_it); |
} |