Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 1159363002: [Download Notification] Show preview if downloaded file is image (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adressed comment #10 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
« chrome/browser/image_decoder.cc ('K') | « chrome/utility/chrome_content_utility_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698