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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1836973003: Move download messages from Renderer to Frame filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "content/child/service_worker/service_worker_provider_context.h" 43 #include "content/child/service_worker/service_worker_provider_context.h"
44 #include "content/child/service_worker/web_service_worker_provider_impl.h" 44 #include "content/child/service_worker/web_service_worker_provider_impl.h"
45 #include "content/child/v8_value_converter_impl.h" 45 #include "content/child/v8_value_converter_impl.h"
46 #include "content/child/web_url_loader_impl.h" 46 #include "content/child/web_url_loader_impl.h"
47 #include "content/child/web_url_request_util.h" 47 #include "content/child/web_url_request_util.h"
48 #include "content/child/webmessageportchannel_impl.h" 48 #include "content/child/webmessageportchannel_impl.h"
49 #include "content/child/websocket_bridge.h" 49 #include "content/child/websocket_bridge.h"
50 #include "content/child/weburlresponse_extradata_impl.h" 50 #include "content/child/weburlresponse_extradata_impl.h"
51 #include "content/common/accessibility_messages.h" 51 #include "content/common/accessibility_messages.h"
52 #include "content/common/clipboard_messages.h" 52 #include "content/common/clipboard_messages.h"
53 #include "content/common/content_constants_internal.h"
53 #include "content/common/content_security_policy_header.h" 54 #include "content/common/content_security_policy_header.h"
54 #include "content/common/frame_messages.h" 55 #include "content/common/frame_messages.h"
55 #include "content/common/frame_replication_state.h" 56 #include "content/common/frame_replication_state.h"
56 #include "content/common/gpu/client/context_provider_command_buffer.h" 57 #include "content/common/gpu/client/context_provider_command_buffer.h"
57 #include "content/common/input_messages.h" 58 #include "content/common/input_messages.h"
58 #include "content/common/navigation_params.h" 59 #include "content/common/navigation_params.h"
59 #include "content/common/page_messages.h" 60 #include "content/common/page_messages.h"
60 #include "content/common/savable_subframe.h" 61 #include "content/common/savable_subframe.h"
61 #include "content/common/service_worker/service_worker_types.h" 62 #include "content/common/service_worker/service_worker_types.h"
62 #include "content/common/site_isolation_policy.h" 63 #include "content/common/site_isolation_policy.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 #include "net/base/data_url.h" 150 #include "net/base/data_url.h"
150 #include "net/base/net_errors.h" 151 #include "net/base/net_errors.h"
151 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 152 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
152 #include "net/http/http_util.h" 153 #include "net/http/http_util.h"
153 #include "storage/common/data_element.h" 154 #include "storage/common/data_element.h"
154 #include "third_party/WebKit/public/platform/URLConversion.h" 155 #include "third_party/WebKit/public/platform/URLConversion.h"
155 #include "third_party/WebKit/public/platform/WebCachePolicy.h" 156 #include "third_party/WebKit/public/platform/WebCachePolicy.h"
156 #include "third_party/WebKit/public/platform/WebData.h" 157 #include "third_party/WebKit/public/platform/WebData.h"
157 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 158 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
158 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" 159 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h"
160 #include "third_party/WebKit/public/platform/WebPoint.h"
159 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 161 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
160 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" 162 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h"
161 #include "third_party/WebKit/public/platform/WebString.h" 163 #include "third_party/WebKit/public/platform/WebString.h"
162 #include "third_party/WebKit/public/platform/WebURL.h" 164 #include "third_party/WebKit/public/platform/WebURL.h"
163 #include "third_party/WebKit/public/platform/WebURLError.h" 165 #include "third_party/WebKit/public/platform/WebURLError.h"
164 #include "third_party/WebKit/public/platform/WebURLResponse.h" 166 #include "third_party/WebKit/public/platform/WebURLResponse.h"
165 #include "third_party/WebKit/public/platform/WebVector.h" 167 #include "third_party/WebKit/public/platform/WebVector.h"
166 #include "third_party/WebKit/public/web/WebColorSuggestion.h" 168 #include "third_party/WebKit/public/web/WebColorSuggestion.h"
167 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 169 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
168 #include "third_party/WebKit/public/web/WebDocument.h" 170 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 using blink::WebLocalFrame; 268 using blink::WebLocalFrame;
267 using blink::WebMediaPlayer; 269 using blink::WebMediaPlayer;
268 using blink::WebMediaPlayerClient; 270 using blink::WebMediaPlayerClient;
269 using blink::WebMediaPlayerEncryptedMediaClient; 271 using blink::WebMediaPlayerEncryptedMediaClient;
270 using blink::WebMediaSession; 272 using blink::WebMediaSession;
271 using blink::WebNavigationPolicy; 273 using blink::WebNavigationPolicy;
272 using blink::WebNavigationType; 274 using blink::WebNavigationType;
273 using blink::WebNode; 275 using blink::WebNode;
274 using blink::WebPluginDocument; 276 using blink::WebPluginDocument;
275 using blink::WebPluginParams; 277 using blink::WebPluginParams;
278 using blink::WebPoint;
276 using blink::WebPopupMenuInfo; 279 using blink::WebPopupMenuInfo;
277 using blink::WebRange; 280 using blink::WebRange;
278 using blink::WebRect; 281 using blink::WebRect;
279 using blink::WebReferrerPolicy; 282 using blink::WebReferrerPolicy;
280 using blink::WebScriptSource; 283 using blink::WebScriptSource;
281 using blink::WebSearchableFormData; 284 using blink::WebSearchableFormData;
282 using blink::WebSecurityOrigin; 285 using blink::WebSecurityOrigin;
283 using blink::WebSecurityPolicy; 286 using blink::WebSecurityPolicy;
284 using blink::WebSerializedScriptValue; 287 using blink::WebSerializedScriptValue;
285 using blink::WebServiceWorkerProvider; 288 using blink::WebServiceWorkerProvider;
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) 1453 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete)
1451 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) 1454 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll)
1452 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) 1455 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange)
1453 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, 1456 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset,
1454 OnAdjustSelectionByCharacterOffset) 1457 OnAdjustSelectionByCharacterOffset)
1455 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) 1458 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect)
1456 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, 1459 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent,
1457 OnMoveRangeSelectionExtent) 1460 OnMoveRangeSelectionExtent)
1458 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) 1461 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace)
1459 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) 1462 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling)
1463 IPC_MESSAGE_HANDLER(FrameMsg_CopyImageAt, OnCopyImageAt)
1464 IPC_MESSAGE_HANDLER(FrameMsg_SaveImageAt, OnSaveImageAt)
1460 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, 1465 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete,
1461 OnExtendSelectionAndDelete) 1466 OnExtendSelectionAndDelete)
1462 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, 1467 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText,
1463 OnSetCompositionFromExistingText) 1468 OnSetCompositionFromExistingText)
1464 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, 1469 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand,
1465 OnExecuteNoValueEditCommand) 1470 OnExecuteNoValueEditCommand)
1466 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) 1471 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest)
1467 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) 1472 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole)
1468 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, 1473 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest,
1469 OnJavaScriptExecuteRequest) 1474 OnJavaScriptExecuteRequest)
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 SyncSelectionIfRequired(); 1853 SyncSelectionIfRequired();
1849 } 1854 }
1850 1855
1851 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { 1856 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) {
1852 if (!frame_->hasSelection()) 1857 if (!frame_->hasSelection())
1853 return; 1858 return;
1854 1859
1855 frame_->replaceMisspelledRange(text); 1860 frame_->replaceMisspelledRange(text);
1856 } 1861 }
1857 1862
1863 void RenderFrameImpl::OnCopyImageAt(int x, int y) {
1864 frame_->copyImageAt(WebPoint(x, y));
1865 }
1866
1867 void RenderFrameImpl::OnSaveImageAt(int x, int y) {
1868 frame_->saveImageAt(WebPoint(x, y));
1869 }
1870
1858 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) { 1871 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) {
1859 frame_->document().insertStyleSheet(WebString::fromUTF8(css)); 1872 frame_->document().insertStyleSheet(WebString::fromUTF8(css));
1860 } 1873 }
1861 1874
1862 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level, 1875 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level,
1863 const std::string& message) { 1876 const std::string& message) {
1864 AddMessageToConsole(level, message); 1877 AddMessageToConsole(level, message);
1865 } 1878 }
1866 1879
1867 void RenderFrameImpl::OnJavaScriptExecuteRequest( 1880 void RenderFrameImpl::OnJavaScriptExecuteRequest(
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
2912 routing_id_, static_cast<int32_t>(log_severity), message.text, 2925 routing_id_, static_cast<int32_t>(log_severity), message.text,
2913 static_cast<int32_t>(source_line), source_name)); 2926 static_cast<int32_t>(source_line), source_name));
2914 } 2927 }
2915 2928
2916 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request, 2929 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request,
2917 blink::WebNavigationPolicy policy, 2930 blink::WebNavigationPolicy policy,
2918 const blink::WebString& suggested_name, 2931 const blink::WebString& suggested_name,
2919 bool should_replace_current_entry) { 2932 bool should_replace_current_entry) {
2920 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request)); 2933 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request));
2921 if (policy == blink::WebNavigationPolicyDownload) { 2934 if (policy == blink::WebNavigationPolicyDownload) {
2922 render_view_->Send(new ViewHostMsg_DownloadUrl(render_view_->GetRoutingID(), 2935 Send(new FrameHostMsg_DownloadUrl(render_view_->GetRoutingID(),
2923 GetRoutingID(), 2936 GetRoutingID(), request.url(), referrer,
2924 request.url(), referrer, 2937 suggested_name));
2925 suggested_name));
2926 } else { 2938 } else {
2927 OpenURL(request.url(), referrer, policy, should_replace_current_entry, 2939 OpenURL(request.url(), referrer, policy, should_replace_current_entry,
2928 false); 2940 false);
2929 } 2941 }
2930 } 2942 }
2931 2943
2932 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() { 2944 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() {
2933 // OOPIF enabled modes will punt this navigation to the browser in 2945 // OOPIF enabled modes will punt this navigation to the browser in
2934 // decidePolicyForNavigation. 2946 // decidePolicyForNavigation.
2935 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) 2947 if (SiteIsolationPolicy::UseSubframeNavigationEntries())
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
3770 gfx::Rect start_rect; 3782 gfx::Rect start_rect;
3771 gfx::Rect end_rect; 3783 gfx::Rect end_rect;
3772 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect); 3784 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect);
3773 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); 3785 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom());
3774 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); 3786 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom());
3775 #endif 3787 #endif
3776 3788
3777 Send(new FrameHostMsg_ContextMenu(routing_id_, params)); 3789 Send(new FrameHostMsg_ContextMenu(routing_id_, params));
3778 } 3790 }
3779 3791
3792 void RenderFrameImpl::saveImageFromDataURL(const blink::WebString& data_url) {
3793 // Note: We should basically send GURL but we use size-limited string instead
3794 // in order to send a larger data url to save a image for <canvas> or <img>.
3795 if (data_url.length() < kMaxLengthOfDataURLString) {
3796 Send(new FrameHostMsg_SaveImageFromDataURL(
3797 render_view_->GetRoutingID(), routing_id_, data_url.utf8()));
3798 }
3799 }
3800
3780 void RenderFrameImpl::willSendRequest( 3801 void RenderFrameImpl::willSendRequest(
3781 blink::WebLocalFrame* frame, 3802 blink::WebLocalFrame* frame,
3782 unsigned identifier, 3803 unsigned identifier,
3783 blink::WebURLRequest& request, 3804 blink::WebURLRequest& request,
3784 const blink::WebURLResponse& redirect_response) { 3805 const blink::WebURLResponse& redirect_response) {
3785 DCHECK_EQ(frame_, frame); 3806 DCHECK_EQ(frame_, frame);
3786 // The request my be empty during tests. 3807 // The request my be empty during tests.
3787 if (request.url().isEmpty()) 3808 if (request.url().isEmpty())
3788 return; 3809 return;
3789 3810
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after
6104 // event target. Potentially a Pepper plugin will receive the event. 6125 // event target. Potentially a Pepper plugin will receive the event.
6105 // In order to tell whether a plugin gets the last mouse event and which it 6126 // In order to tell whether a plugin gets the last mouse event and which it
6106 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6127 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6107 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6128 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6108 // |pepper_last_mouse_event_target_|. 6129 // |pepper_last_mouse_event_target_|.
6109 pepper_last_mouse_event_target_ = nullptr; 6130 pepper_last_mouse_event_target_ = nullptr;
6110 #endif 6131 #endif
6111 } 6132 }
6112 6133
6113 } // namespace content 6134 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698