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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 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 #include "content/browser/renderer_host/render_message_filter.h" 5 #include "content/browser/renderer_host/render_message_filter.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 OnCreateFullscreenWidget) 384 OnCreateFullscreenWidget)
385 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCookie, OnSetCookie) 385 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCookie, OnSetCookie)
386 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetCookies, OnGetCookies) 386 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetCookies, OnGetCookies)
387 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetRawCookies, OnGetRawCookies) 387 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetRawCookies, OnGetRawCookies)
388 IPC_MESSAGE_HANDLER(ViewHostMsg_DeleteCookie, OnDeleteCookie) 388 IPC_MESSAGE_HANDLER(ViewHostMsg_DeleteCookie, OnDeleteCookie)
389 IPC_MESSAGE_HANDLER(ViewHostMsg_CookiesEnabled, OnCookiesEnabled) 389 IPC_MESSAGE_HANDLER(ViewHostMsg_CookiesEnabled, OnCookiesEnabled)
390 #if defined(OS_MACOSX) 390 #if defined(OS_MACOSX)
391 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_LoadFont, OnLoadFont) 391 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_LoadFont, OnLoadFont)
392 #endif 392 #endif
393 IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl) 393 IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl)
394 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveImageAs, OnSaveImageAs)
394 #if defined(ENABLE_PLUGINS) 395 #if defined(ENABLE_PLUGINS)
395 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins) 396 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins)
396 IPC_MESSAGE_HANDLER(FrameHostMsg_GetPluginInfo, OnGetPluginInfo) 397 IPC_MESSAGE_HANDLER(FrameHostMsg_GetPluginInfo, OnGetPluginInfo)
397 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_OpenChannelToPlugin, 398 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_OpenChannelToPlugin,
398 OnOpenChannelToPlugin) 399 OnOpenChannelToPlugin)
399 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_OpenChannelToPepperPlugin, 400 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_OpenChannelToPepperPlugin,
400 OnOpenChannelToPepperPlugin) 401 OnOpenChannelToPepperPlugin)
401 IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateOutOfProcessPepperInstance, 402 IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateOutOfProcessPepperInstance,
402 OnDidCreateOutOfProcessPepperInstance) 403 OnDidCreateOutOfProcessPepperInstance)
403 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDeleteOutOfProcessPepperInstance, 404 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDeleteOutOfProcessPepperInstance,
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 media::AudioManagerBase::kDefaultDeviceId); 854 media::AudioManagerBase::kDefaultDeviceId);
854 } 855 }
855 856
856 #if defined(OS_WIN) 857 #if defined(OS_WIN)
857 void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) { 858 void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) {
858 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); 859 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO));
859 *profile = g_color_profile.Get().profile(); 860 *profile = g_color_profile.Get().profile();
860 } 861 }
861 #endif 862 #endif
862 863
863 void RenderMessageFilter::OnDownloadUrl(int render_view_id, 864 void RenderMessageFilter::DownloadUrl(int render_view_id,
864 const GURL& url, 865 const GURL& url,
865 const Referrer& referrer, 866 const Referrer& referrer,
866 const base::string16& suggested_name, 867 const base::string16& suggested_name,
867 const bool use_prompt) { 868 const bool use_prompt) {
868 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo()); 869 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
869 save_info->suggested_name = suggested_name; 870 save_info->suggested_name = suggested_name;
870 save_info->prompt_for_save_location = use_prompt; 871 save_info->prompt_for_save_location = use_prompt;
871 872
872 // There may be a special cookie store that we could use for this download, 873 // There may be a special cookie store that we could use for this download,
873 // rather than the default one. Since this feature is generally only used for 874 // rather than the default one. Since this feature is generally only used for
874 // proper render views, and not downloads, we do not need to retrieve the 875 // proper render views, and not downloads, we do not need to retrieve the
875 // special cookie store here, but just initialize the request to use the 876 // special cookie store here, but just initialize the request to use the
876 // default cookie store. 877 // default cookie store.
877 // TODO(tburkard): retrieve the appropriate special cookie store, if this 878 // TODO(tburkard): retrieve the appropriate special cookie store, if this
878 // is ever to be used for downloads as well. 879 // is ever to be used for downloads as well.
879 scoped_ptr<net::URLRequest> request( 880 scoped_ptr<net::URLRequest> request(
880 resource_context_->GetRequestContext()->CreateRequest( 881 resource_context_->GetRequestContext()->CreateRequest(
881 url, net::DEFAULT_PRIORITY, NULL, NULL)); 882 url, net::DEFAULT_PRIORITY, NULL, NULL));
882 RecordDownloadSource(INITIATED_BY_RENDERER); 883 RecordDownloadSource(INITIATED_BY_RENDERER);
883 resource_dispatcher_host_->BeginDownload( 884 resource_dispatcher_host_->BeginDownload(
884 request.Pass(), 885 request.Pass(),
885 referrer, 886 referrer,
886 true, // is_content_initiated 887 true, // is_content_initiated
887 resource_context_, 888 resource_context_,
888 render_process_id_, 889 render_process_id_,
889 render_view_id, 890 render_view_id,
890 false, 891 false,
891 save_info.Pass(), 892 save_info.Pass(),
892 content::DownloadItem::kInvalidId, 893 content::DownloadItem::kInvalidId,
893 ResourceDispatcherHostImpl::DownloadStartedCallback()); 894 ResourceDispatcherHostImpl::DownloadStartedCallback());
894 } 895 }
895 896
897 void RenderMessageFilter::OnDownloadUrl(int render_view_id,
898 const GURL& url,
899 const Referrer& referrer,
900 const base::string16& suggested_name) {
901 DownloadUrl(render_view_id, url, referrer, suggested_name, false);
902 }
903
904 void RenderMessageFilter::OnSaveImageAs(int render_view_id,
905 const std::string& encoded_image_data,
906 const Referrer& referrer,
907 const base::string16& suggested_name) {
908 DownloadUrl(render_view_id, GURL(encoded_image_data),
Ken Russell (switch to Gerrit) 2014/08/29 23:29:26 This code needs to check the incoming encoded_imag
palmer 2014/08/30 00:37:29 And do something to make sure the |suggested_name|
909 referrer, suggested_name, true);
910 }
911
896 void RenderMessageFilter::OnCheckNotificationPermission( 912 void RenderMessageFilter::OnCheckNotificationPermission(
897 const GURL& source_origin, int* result) { 913 const GURL& source_origin, int* result) {
898 #if defined(ENABLE_NOTIFICATIONS) 914 #if defined(ENABLE_NOTIFICATIONS)
899 *result = GetContentClient()->browser()-> 915 *result = GetContentClient()->browser()->
900 CheckDesktopNotificationPermission(source_origin, resource_context_, 916 CheckDesktopNotificationPermission(source_origin, resource_context_,
901 render_process_id_); 917 render_process_id_);
902 #else 918 #else
903 *result = blink::WebNotificationPresenter::PermissionAllowed; 919 *result = blink::WebNotificationPresenter::PermissionAllowed;
904 #endif 920 #endif
905 } 921 }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 int render_frame_id, 1236 int render_frame_id,
1221 const std::string& allowed_destination_host_pattern, 1237 const std::string& allowed_destination_host_pattern,
1222 const std::string& selector, 1238 const std::string& selector,
1223 const std::string& markup) { 1239 const std::string& markup) {
1224 TransitionRequestManager::GetInstance()->AddPendingTransitionRequestData( 1240 TransitionRequestManager::GetInstance()->AddPendingTransitionRequestData(
1225 render_process_id_, render_frame_id, allowed_destination_host_pattern, 1241 render_process_id_, render_frame_id, allowed_destination_host_pattern,
1226 selector, markup); 1242 selector, markup);
1227 } 1243 }
1228 1244
1229 } // namespace content 1245 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698