OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "chrome/browser/image_decoder.h" | 15 #include "chrome/browser/image_decoder.h" |
15 | 16 |
16 class MessageLoop; | 17 class MessageLoop; |
17 class SkBitmap; | 18 class SkBitmap; |
18 | 19 |
19 namespace chromeos { | 20 namespace chromeos { |
20 | 21 |
21 // A facility to read a file containing user image asynchronously in the IO | 22 // A facility to read a file containing user image asynchronously in the IO |
22 // thread. Returns the image in the form of an SkBitmap. | 23 // thread. Returns the image in the form of an SkBitmap. |
(...skipping 26 matching lines...) Expand all Loading... |
49 typedef std::map<const ImageDecoder*, ImageInfo> ImageInfoMap; | 50 typedef std::map<const ImageDecoder*, ImageInfo> ImageInfoMap; |
50 | 51 |
51 virtual ~UserImageLoader(); | 52 virtual ~UserImageLoader(); |
52 | 53 |
53 // Method that reads the file on the file thread and starts decoding it in | 54 // Method that reads the file on the file thread and starts decoding it in |
54 // sandboxed process. | 55 // sandboxed process. |
55 void LoadImage(const std::string& filepath, const ImageInfo& image_info); | 56 void LoadImage(const std::string& filepath, const ImageInfo& image_info); |
56 | 57 |
57 // ImageDecoder::Delegate implementation. | 58 // ImageDecoder::Delegate implementation. |
58 virtual void OnImageDecoded(const ImageDecoder* decoder, | 59 virtual void OnImageDecoded(const ImageDecoder* decoder, |
59 const SkBitmap& decoded_image); | 60 const SkBitmap& decoded_image) OVERRIDE; |
60 virtual void OnDecodeImageFailed(const ImageDecoder* decoder); | 61 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; |
61 | 62 |
62 // The message loop object of the thread in which we notify the delegate. | 63 // The message loop object of the thread in which we notify the delegate. |
63 MessageLoop* target_message_loop_; | 64 MessageLoop* target_message_loop_; |
64 | 65 |
65 // Holds info structures about all images we're trying to decode. | 66 // Holds info structures about all images we're trying to decode. |
66 // Accessed only on FILE thread. | 67 // Accessed only on FILE thread. |
67 ImageInfoMap image_info_map_; | 68 ImageInfoMap image_info_map_; |
68 | 69 |
69 DISALLOW_COPY_AND_ASSIGN(UserImageLoader); | 70 DISALLOW_COPY_AND_ASSIGN(UserImageLoader); |
70 }; | 71 }; |
71 | 72 |
72 } // namespace chromeos | 73 } // namespace chromeos |
73 | 74 |
74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_LOADER_H_ | 75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_LOADER_H_ |
OLD | NEW |