OLD | NEW |
1 // Copyright (c) 2010 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_IMAGE_DECODER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DECODER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DECODER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DECODER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "chrome/browser/utility_process_host.h" | 12 #include "chrome/browser/utility_process_host.h" |
13 | 13 |
14 class ResourceDispatcherHost; | |
15 | |
16 namespace chromeos { | 14 namespace chromeos { |
17 | 15 |
18 // Decodes an image in a sandboxed process. | 16 // Decodes an image in a sandboxed process. |
19 class ImageDecoder : public UtilityProcessHost::Client { | 17 class ImageDecoder : public UtilityProcessHost::Client { |
20 public: | 18 public: |
21 class Delegate { | 19 class Delegate { |
22 public: | 20 public: |
23 // Called when image is decoded. | 21 // Called when image is decoded. |
24 // |decoder| is used to identify the image in case of decoding several | 22 // |decoder| is used to identify the image in case of decoding several |
25 // images simultaneously. | 23 // images simultaneously. |
(...skipping 16 matching lines...) Expand all Loading... |
42 | 40 |
43 private: | 41 private: |
44 // It's a reference counted object, so destructor is private. | 42 // It's a reference counted object, so destructor is private. |
45 virtual ~ImageDecoder() {} | 43 virtual ~ImageDecoder() {} |
46 | 44 |
47 // Overidden from UtilityProcessHost::Client: | 45 // Overidden from UtilityProcessHost::Client: |
48 virtual void OnDecodeImageSucceeded(const SkBitmap& decoded_image); | 46 virtual void OnDecodeImageSucceeded(const SkBitmap& decoded_image); |
49 virtual void OnDecodeImageFailed(); | 47 virtual void OnDecodeImageFailed(); |
50 | 48 |
51 // Launches sandboxed process that will decode the image. | 49 // Launches sandboxed process that will decode the image. |
52 void DecodeImageInSandbox(ResourceDispatcherHost* rdh, | 50 void DecodeImageInSandbox(const std::vector<unsigned char>& image_data); |
53 const std::vector<unsigned char>& image_data); | |
54 | 51 |
55 Delegate* delegate_; | 52 Delegate* delegate_; |
56 std::vector<unsigned char> image_data_; | 53 std::vector<unsigned char> image_data_; |
57 BrowserThread::ID target_thread_id_; | 54 BrowserThread::ID target_thread_id_; |
58 | 55 |
59 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); | 56 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); |
60 }; | 57 }; |
61 | 58 |
62 } // namespace chromeos | 59 } // namespace chromeos |
63 | 60 |
64 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DECODER_H_ | 61 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DECODER_H_ |
65 | |
OLD | NEW |