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

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, 7 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/frame_messages.h" 54 #include "content/common/frame_messages.h"
54 #include "content/common/frame_replication_state.h" 55 #include "content/common/frame_replication_state.h"
55 #include "content/common/gpu/client/context_provider_command_buffer.h" 56 #include "content/common/gpu/client/context_provider_command_buffer.h"
56 #include "content/common/input_messages.h" 57 #include "content/common/input_messages.h"
57 #include "content/common/navigation_params.h" 58 #include "content/common/navigation_params.h"
58 #include "content/common/page_messages.h" 59 #include "content/common/page_messages.h"
59 #include "content/common/savable_subframe.h" 60 #include "content/common/savable_subframe.h"
60 #include "content/common/service_worker/service_worker_types.h" 61 #include "content/common/service_worker/service_worker_types.h"
61 #include "content/common/site_isolation_policy.h" 62 #include "content/common/site_isolation_policy.h"
62 #include "content/common/ssl_status_serialization.h" 63 #include "content/common/ssl_status_serialization.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 #include "mojo/edk/js/support.h" 149 #include "mojo/edk/js/support.h"
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 "third_party/WebKit/public/platform/URLConversion.h" 154 #include "third_party/WebKit/public/platform/URLConversion.h"
154 #include "third_party/WebKit/public/platform/WebCachePolicy.h" 155 #include "third_party/WebKit/public/platform/WebCachePolicy.h"
155 #include "third_party/WebKit/public/platform/WebData.h" 156 #include "third_party/WebKit/public/platform/WebData.h"
156 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 157 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
157 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" 158 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h"
159 #include "third_party/WebKit/public/platform/WebPoint.h"
158 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 160 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
159 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" 161 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h"
160 #include "third_party/WebKit/public/platform/WebString.h" 162 #include "third_party/WebKit/public/platform/WebString.h"
161 #include "third_party/WebKit/public/platform/WebURL.h" 163 #include "third_party/WebKit/public/platform/WebURL.h"
162 #include "third_party/WebKit/public/platform/WebURLError.h" 164 #include "third_party/WebKit/public/platform/WebURLError.h"
163 #include "third_party/WebKit/public/platform/WebURLResponse.h" 165 #include "third_party/WebKit/public/platform/WebURLResponse.h"
164 #include "third_party/WebKit/public/platform/WebVector.h" 166 #include "third_party/WebKit/public/platform/WebVector.h"
165 #include "third_party/WebKit/public/web/WebColorSuggestion.h" 167 #include "third_party/WebKit/public/web/WebColorSuggestion.h"
166 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 168 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
167 #include "third_party/WebKit/public/web/WebDocument.h" 169 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 using blink::WebLocalFrame; 266 using blink::WebLocalFrame;
265 using blink::WebMediaPlayer; 267 using blink::WebMediaPlayer;
266 using blink::WebMediaPlayerClient; 268 using blink::WebMediaPlayerClient;
267 using blink::WebMediaPlayerEncryptedMediaClient; 269 using blink::WebMediaPlayerEncryptedMediaClient;
268 using blink::WebMediaSession; 270 using blink::WebMediaSession;
269 using blink::WebNavigationPolicy; 271 using blink::WebNavigationPolicy;
270 using blink::WebNavigationType; 272 using blink::WebNavigationType;
271 using blink::WebNode; 273 using blink::WebNode;
272 using blink::WebPluginDocument; 274 using blink::WebPluginDocument;
273 using blink::WebPluginParams; 275 using blink::WebPluginParams;
276 using blink::WebPoint;
274 using blink::WebPopupMenuInfo; 277 using blink::WebPopupMenuInfo;
275 using blink::WebRange; 278 using blink::WebRange;
276 using blink::WebRect; 279 using blink::WebRect;
277 using blink::WebReferrerPolicy; 280 using blink::WebReferrerPolicy;
278 using blink::WebScriptSource; 281 using blink::WebScriptSource;
279 using blink::WebSearchableFormData; 282 using blink::WebSearchableFormData;
280 using blink::WebSecurityOrigin; 283 using blink::WebSecurityOrigin;
281 using blink::WebSecurityPolicy; 284 using blink::WebSecurityPolicy;
282 using blink::WebSerializedScriptValue; 285 using blink::WebSerializedScriptValue;
283 using blink::WebServiceWorkerProvider; 286 using blink::WebServiceWorkerProvider;
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) 1413 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete)
1411 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) 1414 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll)
1412 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) 1415 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange)
1413 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, 1416 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset,
1414 OnAdjustSelectionByCharacterOffset) 1417 OnAdjustSelectionByCharacterOffset)
1415 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) 1418 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect)
1416 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, 1419 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent,
1417 OnMoveRangeSelectionExtent) 1420 OnMoveRangeSelectionExtent)
1418 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) 1421 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace)
1419 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) 1422 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling)
1423 IPC_MESSAGE_HANDLER(FrameMsg_CopyImageAt, OnCopyImageAt)
1424 IPC_MESSAGE_HANDLER(FrameMsg_SaveImageAt, OnSaveImageAt)
1420 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, 1425 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete,
1421 OnExtendSelectionAndDelete) 1426 OnExtendSelectionAndDelete)
1422 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, 1427 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText,
1423 OnSetCompositionFromExistingText) 1428 OnSetCompositionFromExistingText)
1424 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, 1429 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand,
1425 OnExecuteNoValueEditCommand) 1430 OnExecuteNoValueEditCommand)
1426 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) 1431 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest)
1427 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) 1432 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole)
1428 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, 1433 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest,
1429 OnJavaScriptExecuteRequest) 1434 OnJavaScriptExecuteRequest)
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 SyncSelectionIfRequired(); 1812 SyncSelectionIfRequired();
1808 } 1813 }
1809 1814
1810 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { 1815 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) {
1811 if (!frame_->hasSelection()) 1816 if (!frame_->hasSelection())
1812 return; 1817 return;
1813 1818
1814 frame_->replaceMisspelledRange(text); 1819 frame_->replaceMisspelledRange(text);
1815 } 1820 }
1816 1821
1822 void RenderFrameImpl::OnCopyImageAt(int x, int y) {
1823 frame_->copyImageAt(WebPoint(x, y));
1824 }
1825
1826 void RenderFrameImpl::OnSaveImageAt(int x, int y) {
1827 frame_->saveImageAt(WebPoint(x, y));
1828 }
1829
1817 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) { 1830 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) {
1818 frame_->document().insertStyleSheet(WebString::fromUTF8(css)); 1831 frame_->document().insertStyleSheet(WebString::fromUTF8(css));
1819 } 1832 }
1820 1833
1821 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level, 1834 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level,
1822 const std::string& message) { 1835 const std::string& message) {
1823 AddMessageToConsole(level, message); 1836 AddMessageToConsole(level, message);
1824 } 1837 }
1825 1838
1826 void RenderFrameImpl::OnJavaScriptExecuteRequest( 1839 void RenderFrameImpl::OnJavaScriptExecuteRequest(
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 routing_id_, static_cast<int32_t>(log_severity), message.text, 2887 routing_id_, static_cast<int32_t>(log_severity), message.text,
2875 static_cast<int32_t>(source_line), source_name)); 2888 static_cast<int32_t>(source_line), source_name));
2876 } 2889 }
2877 2890
2878 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request, 2891 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request,
2879 blink::WebNavigationPolicy policy, 2892 blink::WebNavigationPolicy policy,
2880 const blink::WebString& suggested_name, 2893 const blink::WebString& suggested_name,
2881 bool should_replace_current_entry) { 2894 bool should_replace_current_entry) {
2882 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request)); 2895 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request));
2883 if (policy == blink::WebNavigationPolicyDownload) { 2896 if (policy == blink::WebNavigationPolicyDownload) {
2884 render_view_->Send(new ViewHostMsg_DownloadUrl(render_view_->GetRoutingID(), 2897 Send(new FrameHostMsg_DownloadUrl(render_view_->GetRoutingID(),
2885 GetRoutingID(), 2898 GetRoutingID(), request.url(), referrer,
2886 request.url(), referrer, 2899 suggested_name));
2887 suggested_name));
2888 } else { 2900 } else {
2889 OpenURL(request.url(), referrer, policy, should_replace_current_entry, 2901 OpenURL(request.url(), referrer, policy, should_replace_current_entry,
2890 false); 2902 false);
2891 } 2903 }
2892 } 2904 }
2893 2905
2894 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() { 2906 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() {
2895 // OOPIF enabled modes will punt this navigation to the browser in 2907 // OOPIF enabled modes will punt this navigation to the browser in
2896 // decidePolicyForNavigation. 2908 // decidePolicyForNavigation.
2897 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) 2909 if (SiteIsolationPolicy::UseSubframeNavigationEntries())
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
3725 gfx::Rect start_rect; 3737 gfx::Rect start_rect;
3726 gfx::Rect end_rect; 3738 gfx::Rect end_rect;
3727 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect); 3739 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect);
3728 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); 3740 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom());
3729 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); 3741 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom());
3730 #endif 3742 #endif
3731 3743
3732 Send(new FrameHostMsg_ContextMenu(routing_id_, params)); 3744 Send(new FrameHostMsg_ContextMenu(routing_id_, params));
3733 } 3745 }
3734 3746
3747 void RenderFrameImpl::saveImageFromDataURL(const blink::WebString& data_url) {
3748 // Note: We should basically send GURL but we use size-limited string instead
3749 // in order to send a larger data url to save a image for <canvas> or <img>.
3750 if (data_url.length() < kMaxLengthOfDataURLString) {
3751 Send(new FrameHostMsg_SaveImageFromDataURL(
3752 render_view_->GetRoutingID(), routing_id_, data_url.utf8()));
3753 }
3754 }
3755
3735 void RenderFrameImpl::willSendRequest( 3756 void RenderFrameImpl::willSendRequest(
3736 blink::WebLocalFrame* frame, 3757 blink::WebLocalFrame* frame,
3737 unsigned identifier, 3758 unsigned identifier,
3738 blink::WebURLRequest& request, 3759 blink::WebURLRequest& request,
3739 const blink::WebURLResponse& redirect_response) { 3760 const blink::WebURLResponse& redirect_response) {
3740 DCHECK_EQ(frame_, frame); 3761 DCHECK_EQ(frame_, frame);
3741 // The request my be empty during tests. 3762 // The request my be empty during tests.
3742 if (request.url().isEmpty()) 3763 if (request.url().isEmpty())
3743 return; 3764 return;
3744 3765
(...skipping 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after
6144 // event target. Potentially a Pepper plugin will receive the event. 6165 // event target. Potentially a Pepper plugin will receive the event.
6145 // In order to tell whether a plugin gets the last mouse event and which it 6166 // In order to tell whether a plugin gets the last mouse event and which it
6146 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6167 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6147 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6168 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6148 // |pepper_last_mouse_event_target_|. 6169 // |pepper_last_mouse_event_target_|.
6149 pepper_last_mouse_event_target_ = nullptr; 6170 pepper_last_mouse_event_target_ = nullptr;
6150 #endif 6171 #endif
6151 } 6172 }
6152 6173
6153 } // namespace content 6174 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698