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

Unified Diff: chrome/browser/chromeos/login/user_image.h

Issue 10454044: Added support for animated/nonanimated user image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed mock. 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.h
diff --git a/chrome/browser/chromeos/login/user_image.h b/chrome/browser/chromeos/login/user_image.h
new file mode 100644
index 0000000000000000000000000000000000000000..a9f9f3837c006736b023258d28817dc6fb003c7d
--- /dev/null
+++ b/chrome/browser/chromeos/login/user_image.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_
+#pragma once
+
+#include <vector>
+
+#include "third_party/skia/include/core/SkBitmap.h"
+
+namespace chromeos {
+
+// Wrapper class for bitmaps and raw images when it's necessary. Could
+// be used for storing profile images (including animated profile
+// images) and user wallpapers.
Nikita (slow) 2012/05/30 17:19:11 nit: why wallpaper is mentioned? Is there a plan t
ygorshenin1 2012/05/31 11:17:46 As UserImageLoader is used to load both wallpapers
+class UserImage {
+ public:
+ typedef std::vector<unsigned char> RawImage;
+
+ // Constructs UserImage from bitmap. Should be used where only
+ // static image is needed (e.g. wallpapers).
+ explicit UserImage(const SkBitmap& image);
+
+ // Constructs UserImage from raw image and bitmap that should
+ // represent single frame from that one. Can be used for wrapping
+ // animated images.
+ UserImage(const SkBitmap& image, const RawImage& raw_image);
+
+ virtual ~UserImage();
+
+ void SetImage(const SkBitmap& image);
Nikita (slow) 2012/05/30 17:19:11 nit: Add comment that setting image would reset ra
ygorshenin1 2012/05/31 11:17:46 Done.
+ const SkBitmap& image() const { return image_; }
+ bool has_raw_image() const { return has_raw_image_; }
+ bool has_animated_image() const { return has_animated_image_; }
+ const RawImage& raw_image() const { return raw_image_; }
+
+ private:
+ SkBitmap image_;
+ bool has_raw_image_;
+ bool has_animated_image_;
+ RawImage raw_image_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_

Powered by Google App Engine
This is Rietveld 408576698