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

Side by Side Diff: chrome/browser/chromeos/login/user_image_loader.h

Issue 10912019: Enable robust decoding of custom wallpaper and allow custom wallpaper on login page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check conflict. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/user_image_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_LOADER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_LOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_LOADER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_LOADER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 10 matching lines...) Expand all
21 class UserImage; 21 class UserImage;
22 22
23 // A facility to read a file containing user image asynchronously in the IO 23 // A facility to read a file containing user image asynchronously in the IO
24 // thread. Returns the image in the form of an SkBitmap. 24 // thread. Returns the image in the form of an SkBitmap.
25 class UserImageLoader : public base::RefCountedThreadSafe<UserImageLoader>, 25 class UserImageLoader : public base::RefCountedThreadSafe<UserImageLoader>,
26 public ImageDecoder::Delegate { 26 public ImageDecoder::Delegate {
27 public: 27 public:
28 // Callback used to indicate that image has been loaded. 28 // Callback used to indicate that image has been loaded.
29 typedef base::Callback<void(const UserImage& user_image)> LoadedCallback; 29 typedef base::Callback<void(const UserImage& user_image)> LoadedCallback;
30 30
31 UserImageLoader(); 31 explicit UserImageLoader(ImageDecoder::ImageCodec image_codec);
32 32
33 // Start reading the image from |filepath| on the file thread. Calls 33 // Start reading the image from |filepath| on the file thread. Calls
34 // |loaded_cb| when image has been successfully loaded. 34 // |loaded_cb| when image has been successfully loaded.
35 // If |size| is positive, image is cropped and (if needed) downsized to 35 // If |size| is positive, image is cropped and (if needed) downsized to
36 // |size|x|size| pixels. 36 // |size|x|size| pixels.
37 void Start(const std::string& filepath, int size, 37 void Start(const std::string& filepath, int size,
38 const LoadedCallback& loaded_cb); 38 const LoadedCallback& loaded_cb);
39 39
40 private: 40 private:
41 friend class base::RefCountedThreadSafe<UserImageLoader>; 41 friend class base::RefCountedThreadSafe<UserImageLoader>;
(...skipping 16 matching lines...) Expand all
58 void LoadImage(const std::string& filepath, const ImageInfo& image_info); 58 void LoadImage(const std::string& filepath, const ImageInfo& image_info);
59 59
60 // ImageDecoder::Delegate implementation. 60 // ImageDecoder::Delegate implementation.
61 virtual void OnImageDecoded(const ImageDecoder* decoder, 61 virtual void OnImageDecoded(const ImageDecoder* decoder,
62 const SkBitmap& decoded_image) OVERRIDE; 62 const SkBitmap& decoded_image) OVERRIDE;
63 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; 63 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE;
64 64
65 // The message loop object of the thread in which we notify the delegate. 65 // The message loop object of the thread in which we notify the delegate.
66 MessageLoop* target_message_loop_; 66 MessageLoop* target_message_loop_;
67 67
68 // Specify how the file should be decoded in the utility process.
69 const ImageDecoder::ImageCodec image_codec_;
70
68 // Holds info structures about all images we're trying to decode. 71 // Holds info structures about all images we're trying to decode.
69 // Accessed only on FILE thread. 72 // Accessed only on FILE thread.
70 ImageInfoMap image_info_map_; 73 ImageInfoMap image_info_map_;
71 74
72 DISALLOW_COPY_AND_ASSIGN(UserImageLoader); 75 DISALLOW_COPY_AND_ASSIGN(UserImageLoader);
73 }; 76 };
74 77
75 } // namespace chromeos 78 } // namespace chromeos
76 79
77 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_LOADER_H_ 80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_LOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/user_image_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698