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

Unified Diff: content/browser/renderer_host/render_message_filter.cc

Issue 518693002: Fix a crash when saving a <canvas> or <img> image which is large. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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: content/browser/renderer_host/render_message_filter.cc
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 13ce2f81908143bf29cb00cdc31c5c8253c351a2..ba36446d2a851a1ea8f83124b97721dbadb26700 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -33,6 +33,7 @@
#include "content/browser/transition_request_manager.h"
#include "content/common/child_process_host_impl.h"
#include "content/common/child_process_messages.h"
+#include "content/common/content_constants_internal.h"
#include "content/common/cookie_data.h"
#include "content/common/desktop_notification_messages.h"
#include "content/common/frame_messages.h"
@@ -391,6 +392,8 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_LoadFont, OnLoadFont)
#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SaveImageFromDataURL,
+ OnSaveImageFromDataURL)
#if defined(ENABLE_PLUGINS)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins)
IPC_MESSAGE_HANDLER(FrameHostMsg_GetPluginInfo, OnGetPluginInfo)
@@ -860,11 +863,11 @@ void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) {
}
#endif
-void RenderMessageFilter::OnDownloadUrl(int render_view_id,
- const GURL& url,
- const Referrer& referrer,
- const base::string16& suggested_name,
- const bool use_prompt) {
+void RenderMessageFilter::DownloadUrl(int render_view_id,
+ const GURL& url,
+ const Referrer& referrer,
+ const base::string16& suggested_name,
+ const bool use_prompt) {
scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
save_info->suggested_name = suggested_name;
save_info->prompt_for_save_location = use_prompt;
@@ -893,6 +896,22 @@ void RenderMessageFilter::OnDownloadUrl(int render_view_id,
ResourceDispatcherHostImpl::DownloadStartedCallback());
}
+void RenderMessageFilter::OnDownloadUrl(int render_view_id,
+ const GURL& url,
+ const Referrer& referrer,
+ const base::string16& suggested_name) {
+ DownloadUrl(render_view_id, url, referrer, suggested_name);
+}
+
+void RenderMessageFilter::OnSaveImageFromDataURL(int render_view_id,
+ const std::string& data_url) {
+ // Note: |data_url| has a size limitation. (< 10MiB)
palmer 2014/09/03 17:31:46 Minor nit: I think the code is so clear (line 910)
zino 2014/09/05 03:47:47 Done.
+ // Please refer to RenderViewImpl::saveImageFromDataURL().
+ if (data_url.length() < kMaxLengthOfDataURLString)
Ken Russell (switch to Gerrit) 2014/09/04 00:23:26 Please see my comments in your other CL https://co
zino 2014/09/05 03:47:47 It will be return in WebViewImpl::saveImageAt(). (
+ DownloadUrl(render_view_id, GURL(data_url),
+ Referrer(), base::string16(), true);
+}
+
void RenderMessageFilter::OnCheckNotificationPermission(
const GURL& source_origin, int* result) {
#if defined(ENABLE_NOTIFICATIONS)

Powered by Google App Engine
This is Rietveld 408576698