Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6489)

Unified Diff: chrome/browser/chromeos/login/user_image_loader.cc

Issue 10454044: Added support for animated/nonanimated user image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Small fixes to comments. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698