Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 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> |
| 11 | 11 |
| (...skipping 21 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 bool get_image_data(std::vector<unsigned char>* image_data) const; | |
|
Ivan Korotkov
2012/05/29 10:50:23
Maybe just const vector& get_image_data() const {
ygorshenin1
2012/05/30 12:17:34
Done.
| |
| 44 | |
| 43 private: | 45 private: |
| 44 // It's a reference counted object, so destructor is private. | 46 // It's a reference counted object, so destructor is private. |
| 45 virtual ~ImageDecoder(); | 47 virtual ~ImageDecoder(); |
| 46 | 48 |
| 47 // Overidden from UtilityProcessHostClient: | 49 // Overidden from UtilityProcessHostClient: |
| 48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 50 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 49 | 51 |
| 50 // IPC message handlers. | 52 // IPC message handlers. |
| 51 void OnDecodeImageSucceeded(const SkBitmap& decoded_image); | 53 void OnDecodeImageSucceeded(const SkBitmap& decoded_image); |
| 52 void OnDecodeImageFailed(); | 54 void OnDecodeImageFailed(); |
| 53 | 55 |
| 54 // Launches sandboxed process that will decode the image. | 56 // Launches sandboxed process that will decode the image. |
| 55 void DecodeImageInSandbox(const std::vector<unsigned char>& image_data); | 57 void DecodeImageInSandbox(const std::vector<unsigned char>& image_data); |
| 56 | 58 |
| 57 Delegate* delegate_; | 59 Delegate* delegate_; |
| 58 std::vector<unsigned char> image_data_; | 60 std::vector<unsigned char> image_data_; |
| 59 content::BrowserThread::ID target_thread_id_; | 61 content::BrowserThread::ID target_thread_id_; |
| 60 | 62 |
| 61 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); | 63 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ | 66 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ |
| OLD | NEW |