| 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 #include "chrome/browser/chromeos/login/image_decoder.h" | 5 #include "chrome/browser/chromeos/login/image_decoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/common/chrome_utility_messages.h" | 9 #include "chrome/common/chrome_utility_messages.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool ImageDecoder::OnMessageReceived(const IPC::Message& message) { | 35 bool ImageDecoder::OnMessageReceived(const IPC::Message& message) { |
| 36 bool handled = true; | 36 bool handled = true; |
| 37 IPC_BEGIN_MESSAGE_MAP(ImageDecoder, message) | 37 IPC_BEGIN_MESSAGE_MAP(ImageDecoder, message) |
| 38 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_DecodeImage_Succeeded, | 38 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_DecodeImage_Succeeded, |
| 39 OnDecodeImageSucceeded) | 39 OnDecodeImageSucceeded) |
| 40 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_DecodeImage_Failed, | 40 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_DecodeImage_Failed, |
| 41 OnDecodeImageFailed) | 41 OnDecodeImageFailed) |
| 42 IPC_MESSAGE_UNHANDLED(handled = false) | 42 IPC_MESSAGE_UNHANDLED(handled = false) |
| 43 IPC_END_MESSAGE_MAP_EX() | 43 IPC_END_MESSAGE_MAP() |
| 44 return handled; | 44 return handled; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void ImageDecoder::OnDecodeImageSucceeded(const SkBitmap& decoded_image) { | 47 void ImageDecoder::OnDecodeImageSucceeded(const SkBitmap& decoded_image) { |
| 48 DCHECK(BrowserThread::CurrentlyOn(target_thread_id_)); | 48 DCHECK(BrowserThread::CurrentlyOn(target_thread_id_)); |
| 49 if (delegate_) | 49 if (delegate_) |
| 50 delegate_->OnImageDecoded(this, decoded_image); | 50 delegate_->OnImageDecoded(this, decoded_image); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void ImageDecoder::OnDecodeImageFailed() { | 53 void ImageDecoder::OnDecodeImageFailed() { |
| 54 DCHECK(BrowserThread::CurrentlyOn(target_thread_id_)); | 54 DCHECK(BrowserThread::CurrentlyOn(target_thread_id_)); |
| 55 if (delegate_) | 55 if (delegate_) |
| 56 delegate_->OnDecodeImageFailed(this); | 56 delegate_->OnDecodeImageFailed(this); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ImageDecoder::DecodeImageInSandbox( | 59 void ImageDecoder::DecodeImageInSandbox( |
| 60 const std::vector<unsigned char>& image_data) { | 60 const std::vector<unsigned char>& image_data) { |
| 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 62 UtilityProcessHost* utility_process_host = | 62 UtilityProcessHost* utility_process_host = |
| 63 new UtilityProcessHost(this, | 63 new UtilityProcessHost(this, |
| 64 target_thread_id_); | 64 target_thread_id_); |
| 65 utility_process_host->Send(new ChromeUtilityMsg_DecodeImage(image_data)); | 65 utility_process_host->Send(new ChromeUtilityMsg_DecodeImage(image_data)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace chromeos | 68 } // namespace chromeos |
| OLD | NEW |