Index: chrome/utility/chrome_content_utility_client.cc |
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc |
index 6b92765c242ba42799f61c81fc3c35829522738e..e2c76f6e37d7d28a667a5c8022233122932ef5b1 100644 |
--- a/chrome/utility/chrome_content_utility_client.cc |
+++ b/chrome/utility/chrome_content_utility_client.cc |
@@ -182,6 +182,8 @@ bool ChromeContentUtilityClient::OnMessageReceived( |
bool handled = true; |
IPC_BEGIN_MESSAGE_MAP(ChromeContentUtilityClient, message) |
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImage, OnDecodeImage) |
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImageByHandle, |
+ OnDecodeImageByHandle) |
#if defined(OS_CHROMEOS) |
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage, |
OnRobustJPEGDecodeImage) |
@@ -294,6 +296,17 @@ void ChromeContentUtilityClient::DecodeImageAndSend( |
ReleaseProcessIfNeeded(); |
} |
+void ChromeContentUtilityClient::OnDecodeImageByHandle( |
+ const IPC::PlatformFileForTransit& image_file, |
+ bool shrink_to_fit, |
+ int request_id) { |
+ base::File file = IPC::PlatformFileForTransitToFile(image_file); |
+ |
+ std::vector<unsigned char> image_data(file.GetLength()); |
+ file.Read(0, reinterpret_cast<char*>(image_data.data()), file.GetLength()); |
asanka
2015/06/11 03:30:52
Fail early if reading failed.
yoshiki
2015/06/11 08:22:09
Done.
|
+ DecodeImageAndSend(image_data, shrink_to_fit, request_id); |
+} |
+ |
void ChromeContentUtilityClient::OnDecodeImage( |
const std::vector<unsigned char>& encoded_data, |
bool shrink_to_fit, |