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_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 "content/browser/utility_process_host.h" |
| 13 |
| 14 class SkBitmap; |
13 | 15 |
14 namespace chromeos { | 16 namespace chromeos { |
15 | 17 |
16 // Decodes an image in a sandboxed process. | 18 // Decodes an image in a sandboxed process. |
17 class ImageDecoder : public UtilityProcessHost::Client { | 19 class ImageDecoder : public UtilityProcessHost::Client { |
18 public: | 20 public: |
19 class Delegate { | 21 class Delegate { |
20 public: | 22 public: |
21 // Called when image is decoded. | 23 // Called when image is decoded. |
22 // |decoder| is used to identify the image in case of decoding several | 24 // |decoder| is used to identify the image in case of decoding several |
(...skipping 13 matching lines...) Expand all Loading... |
36 const std::string& image_data); | 38 const std::string& image_data); |
37 | 39 |
38 // Starts image decoding. | 40 // Starts image decoding. |
39 void Start(); | 41 void Start(); |
40 | 42 |
41 private: | 43 private: |
42 // It's a reference counted object, so destructor is private. | 44 // It's a reference counted object, so destructor is private. |
43 virtual ~ImageDecoder(); | 45 virtual ~ImageDecoder(); |
44 | 46 |
45 // Overidden from UtilityProcessHost::Client: | 47 // Overidden from UtilityProcessHost::Client: |
46 virtual void OnDecodeImageSucceeded(const SkBitmap& decoded_image); | 48 virtual bool OnMessageReceived(const IPC::Message& message); |
47 virtual void OnDecodeImageFailed(); | 49 |
| 50 // IPC message handlers. |
| 51 void OnDecodeImageSucceeded(const SkBitmap& decoded_image); |
| 52 void OnDecodeImageFailed(); |
48 | 53 |
49 // Launches sandboxed process that will decode the image. | 54 // Launches sandboxed process that will decode the image. |
50 void DecodeImageInSandbox(const std::vector<unsigned char>& image_data); | 55 void DecodeImageInSandbox(const std::vector<unsigned char>& image_data); |
51 | 56 |
52 Delegate* delegate_; | 57 Delegate* delegate_; |
53 std::vector<unsigned char> image_data_; | 58 std::vector<unsigned char> image_data_; |
54 BrowserThread::ID target_thread_id_; | 59 BrowserThread::ID target_thread_id_; |
55 | 60 |
56 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); | 61 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); |
57 }; | 62 }; |
58 | 63 |
59 } // namespace chromeos | 64 } // namespace chromeos |
60 | 65 |
61 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DECODER_H_ | 66 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_IMAGE_DECODER_H_ |
OLD | NEW |