OLD | NEW |
---|---|
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 15 matching lines...) Expand all Loading... | |
26 #include "content/browser/plugin_service_impl.h" | 26 #include "content/browser/plugin_service_impl.h" |
27 #include "content/browser/ppapi_plugin_process_host.h" | 27 #include "content/browser/ppapi_plugin_process_host.h" |
28 #include "content/browser/renderer_host/pepper/pepper_security_helper.h" | 28 #include "content/browser/renderer_host/pepper/pepper_security_helper.h" |
29 #include "content/browser/renderer_host/render_process_host_impl.h" | 29 #include "content/browser/renderer_host/render_process_host_impl.h" |
30 #include "content/browser/renderer_host/render_view_host_delegate.h" | 30 #include "content/browser/renderer_host/render_view_host_delegate.h" |
31 #include "content/browser/renderer_host/render_widget_helper.h" | 31 #include "content/browser/renderer_host/render_widget_helper.h" |
32 #include "content/browser/renderer_host/render_widget_resize_helper.h" | 32 #include "content/browser/renderer_host/render_widget_resize_helper.h" |
33 #include "content/browser/transition_request_manager.h" | 33 #include "content/browser/transition_request_manager.h" |
34 #include "content/common/child_process_host_impl.h" | 34 #include "content/common/child_process_host_impl.h" |
35 #include "content/common/child_process_messages.h" | 35 #include "content/common/child_process_messages.h" |
36 #include "content/common/content_constants_internal.h" | |
36 #include "content/common/cookie_data.h" | 37 #include "content/common/cookie_data.h" |
37 #include "content/common/desktop_notification_messages.h" | 38 #include "content/common/desktop_notification_messages.h" |
38 #include "content/common/frame_messages.h" | 39 #include "content/common/frame_messages.h" |
39 #include "content/common/host_shared_bitmap_manager.h" | 40 #include "content/common/host_shared_bitmap_manager.h" |
40 #include "content/common/media/media_param_traits.h" | 41 #include "content/common/media/media_param_traits.h" |
41 #include "content/common/view_messages.h" | 42 #include "content/common/view_messages.h" |
42 #include "content/public/browser/browser_child_process_host.h" | 43 #include "content/public/browser/browser_child_process_host.h" |
43 #include "content/public/browser/browser_context.h" | 44 #include "content/public/browser/browser_context.h" |
44 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
45 #include "content/public/browser/content_browser_client.h" | 46 #include "content/public/browser/content_browser_client.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 OnCreateFullscreenWidget) | 385 OnCreateFullscreenWidget) |
385 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCookie, OnSetCookie) | 386 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCookie, OnSetCookie) |
386 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetCookies, OnGetCookies) | 387 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetCookies, OnGetCookies) |
387 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetRawCookies, OnGetRawCookies) | 388 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetRawCookies, OnGetRawCookies) |
388 IPC_MESSAGE_HANDLER(ViewHostMsg_DeleteCookie, OnDeleteCookie) | 389 IPC_MESSAGE_HANDLER(ViewHostMsg_DeleteCookie, OnDeleteCookie) |
389 IPC_MESSAGE_HANDLER(ViewHostMsg_CookiesEnabled, OnCookiesEnabled) | 390 IPC_MESSAGE_HANDLER(ViewHostMsg_CookiesEnabled, OnCookiesEnabled) |
390 #if defined(OS_MACOSX) | 391 #if defined(OS_MACOSX) |
391 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_LoadFont, OnLoadFont) | 392 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_LoadFont, OnLoadFont) |
392 #endif | 393 #endif |
393 IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl) | 394 IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl) |
395 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveImageFromDataURL, | |
396 OnSaveImageFromDataURL) | |
394 #if defined(ENABLE_PLUGINS) | 397 #if defined(ENABLE_PLUGINS) |
395 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins) | 398 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins) |
396 IPC_MESSAGE_HANDLER(FrameHostMsg_GetPluginInfo, OnGetPluginInfo) | 399 IPC_MESSAGE_HANDLER(FrameHostMsg_GetPluginInfo, OnGetPluginInfo) |
397 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_OpenChannelToPlugin, | 400 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_OpenChannelToPlugin, |
398 OnOpenChannelToPlugin) | 401 OnOpenChannelToPlugin) |
399 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_OpenChannelToPepperPlugin, | 402 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_OpenChannelToPepperPlugin, |
400 OnOpenChannelToPepperPlugin) | 403 OnOpenChannelToPepperPlugin) |
401 IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateOutOfProcessPepperInstance, | 404 IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateOutOfProcessPepperInstance, |
402 OnDidCreateOutOfProcessPepperInstance) | 405 OnDidCreateOutOfProcessPepperInstance) |
403 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDeleteOutOfProcessPepperInstance, | 406 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDeleteOutOfProcessPepperInstance, |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
853 media::AudioManagerBase::kDefaultDeviceId); | 856 media::AudioManagerBase::kDefaultDeviceId); |
854 } | 857 } |
855 | 858 |
856 #if defined(OS_WIN) | 859 #if defined(OS_WIN) |
857 void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) { | 860 void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) { |
858 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); | 861 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); |
859 *profile = g_color_profile.Get().profile(); | 862 *profile = g_color_profile.Get().profile(); |
860 } | 863 } |
861 #endif | 864 #endif |
862 | 865 |
863 void RenderMessageFilter::OnDownloadUrl(int render_view_id, | 866 void RenderMessageFilter::DownloadUrl(int render_view_id, |
864 const GURL& url, | 867 const GURL& url, |
865 const Referrer& referrer, | 868 const Referrer& referrer, |
866 const base::string16& suggested_name, | 869 const base::string16& suggested_name, |
867 const bool use_prompt) { | 870 const bool use_prompt) { |
868 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo()); | 871 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo()); |
869 save_info->suggested_name = suggested_name; | 872 save_info->suggested_name = suggested_name; |
870 save_info->prompt_for_save_location = use_prompt; | 873 save_info->prompt_for_save_location = use_prompt; |
871 | 874 |
872 // There may be a special cookie store that we could use for this download, | 875 // 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 | 876 // 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 | 877 // 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 | 878 // special cookie store here, but just initialize the request to use the |
876 // default cookie store. | 879 // default cookie store. |
877 // TODO(tburkard): retrieve the appropriate special cookie store, if this | 880 // TODO(tburkard): retrieve the appropriate special cookie store, if this |
878 // is ever to be used for downloads as well. | 881 // is ever to be used for downloads as well. |
879 scoped_ptr<net::URLRequest> request( | 882 scoped_ptr<net::URLRequest> request( |
880 resource_context_->GetRequestContext()->CreateRequest( | 883 resource_context_->GetRequestContext()->CreateRequest( |
881 url, net::DEFAULT_PRIORITY, NULL, NULL)); | 884 url, net::DEFAULT_PRIORITY, NULL, NULL)); |
882 RecordDownloadSource(INITIATED_BY_RENDERER); | 885 RecordDownloadSource(INITIATED_BY_RENDERER); |
883 resource_dispatcher_host_->BeginDownload( | 886 resource_dispatcher_host_->BeginDownload( |
884 request.Pass(), | 887 request.Pass(), |
885 referrer, | 888 referrer, |
886 true, // is_content_initiated | 889 true, // is_content_initiated |
887 resource_context_, | 890 resource_context_, |
888 render_process_id_, | 891 render_process_id_, |
889 render_view_id, | 892 render_view_id, |
890 false, | 893 false, |
891 save_info.Pass(), | 894 save_info.Pass(), |
892 content::DownloadItem::kInvalidId, | 895 content::DownloadItem::kInvalidId, |
893 ResourceDispatcherHostImpl::DownloadStartedCallback()); | 896 ResourceDispatcherHostImpl::DownloadStartedCallback()); |
894 } | 897 } |
895 | 898 |
899 void RenderMessageFilter::OnDownloadUrl(int render_view_id, | |
900 const GURL& url, | |
901 const Referrer& referrer, | |
902 const base::string16& suggested_name) { | |
903 DownloadUrl(render_view_id, url, referrer, suggested_name); | |
904 } | |
905 | |
906 void RenderMessageFilter::OnSaveImageFromDataURL(int render_view_id, | |
907 const std::string& data_url) { | |
908 // 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.
| |
909 // Please refer to RenderViewImpl::saveImageFromDataURL(). | |
910 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(). (
| |
911 DownloadUrl(render_view_id, GURL(data_url), | |
912 Referrer(), base::string16(), true); | |
913 } | |
914 | |
896 void RenderMessageFilter::OnCheckNotificationPermission( | 915 void RenderMessageFilter::OnCheckNotificationPermission( |
897 const GURL& source_origin, int* result) { | 916 const GURL& source_origin, int* result) { |
898 #if defined(ENABLE_NOTIFICATIONS) | 917 #if defined(ENABLE_NOTIFICATIONS) |
899 *result = GetContentClient()->browser()-> | 918 *result = GetContentClient()->browser()-> |
900 CheckDesktopNotificationPermission(source_origin, resource_context_, | 919 CheckDesktopNotificationPermission(source_origin, resource_context_, |
901 render_process_id_); | 920 render_process_id_); |
902 #else | 921 #else |
903 *result = blink::WebNotificationPresenter::PermissionAllowed; | 922 *result = blink::WebNotificationPresenter::PermissionAllowed; |
904 #endif | 923 #endif |
905 } | 924 } |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1220 int render_frame_id, | 1239 int render_frame_id, |
1221 const std::string& allowed_destination_host_pattern, | 1240 const std::string& allowed_destination_host_pattern, |
1222 const std::string& selector, | 1241 const std::string& selector, |
1223 const std::string& markup) { | 1242 const std::string& markup) { |
1224 TransitionRequestManager::GetInstance()->AddPendingTransitionRequestData( | 1243 TransitionRequestManager::GetInstance()->AddPendingTransitionRequestData( |
1225 render_process_id_, render_frame_id, allowed_destination_host_pattern, | 1244 render_process_id_, render_frame_id, allowed_destination_host_pattern, |
1226 selector, markup); | 1245 selector, markup); |
1227 } | 1246 } |
1228 | 1247 |
1229 } // namespace content | 1248 } // namespace content |
OLD | NEW |