OLD | NEW |
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_IMAGE_DECODER_H_ | 5 #ifndef CHROME_BROWSER_IMAGE_DECODER_H_ |
6 #define CHROME_BROWSER_IMAGE_DECODER_H_ | 6 #define CHROME_BROWSER_IMAGE_DECODER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 22 matching lines...) Expand all Loading... |
33 protected: | 33 protected: |
34 virtual ~Delegate() {} | 34 virtual ~Delegate() {} |
35 }; | 35 }; |
36 | 36 |
37 ImageDecoder(Delegate* delegate, | 37 ImageDecoder(Delegate* delegate, |
38 const std::string& image_data); | 38 const std::string& image_data); |
39 | 39 |
40 // Starts image decoding. | 40 // Starts image decoding. |
41 void Start(); | 41 void Start(); |
42 | 42 |
| 43 const std::vector<unsigned char>& get_image_data() const { |
| 44 return image_data_; |
| 45 } |
| 46 |
43 private: | 47 private: |
44 // It's a reference counted object, so destructor is private. | 48 // It's a reference counted object, so destructor is private. |
45 virtual ~ImageDecoder(); | 49 virtual ~ImageDecoder(); |
46 | 50 |
47 // Overidden from UtilityProcessHostClient: | 51 // Overidden from UtilityProcessHostClient: |
48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 52 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
49 | 53 |
50 // IPC message handlers. | 54 // IPC message handlers. |
51 void OnDecodeImageSucceeded(const SkBitmap& decoded_image); | 55 void OnDecodeImageSucceeded(const SkBitmap& decoded_image); |
52 void OnDecodeImageFailed(); | 56 void OnDecodeImageFailed(); |
53 | 57 |
54 // Launches sandboxed process that will decode the image. | 58 // Launches sandboxed process that will decode the image. |
55 void DecodeImageInSandbox(const std::vector<unsigned char>& image_data); | 59 void DecodeImageInSandbox(const std::vector<unsigned char>& image_data); |
56 | 60 |
57 Delegate* delegate_; | 61 Delegate* delegate_; |
58 std::vector<unsigned char> image_data_; | 62 std::vector<unsigned char> image_data_; |
59 content::BrowserThread::ID target_thread_id_; | 63 content::BrowserThread::ID target_thread_id_; |
60 | 64 |
61 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); | 65 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); |
62 }; | 66 }; |
63 | 67 |
64 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ | 68 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ |
OLD | NEW |