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

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: merge boo boo 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 #include "net/base/net_errors.h" 154 #include "net/base/net_errors.h"
154 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 155 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
155 #include "net/http/http_util.h" 156 #include "net/http/http_util.h"
156 #include "storage/common/data_element.h" 157 #include "storage/common/data_element.h"
157 #include "third_party/WebKit/public/platform/FilePathConversion.h" 158 #include "third_party/WebKit/public/platform/FilePathConversion.h"
158 #include "third_party/WebKit/public/platform/URLConversion.h" 159 #include "third_party/WebKit/public/platform/URLConversion.h"
159 #include "third_party/WebKit/public/platform/WebCachePolicy.h" 160 #include "third_party/WebKit/public/platform/WebCachePolicy.h"
160 #include "third_party/WebKit/public/platform/WebData.h" 161 #include "third_party/WebKit/public/platform/WebData.h"
161 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 162 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
162 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" 163 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h"
164 #include "third_party/WebKit/public/platform/WebPoint.h"
163 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 165 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
164 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" 166 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h"
165 #include "third_party/WebKit/public/platform/WebString.h" 167 #include "third_party/WebKit/public/platform/WebString.h"
166 #include "third_party/WebKit/public/platform/WebURL.h" 168 #include "third_party/WebKit/public/platform/WebURL.h"
167 #include "third_party/WebKit/public/platform/WebURLError.h" 169 #include "third_party/WebKit/public/platform/WebURLError.h"
168 #include "third_party/WebKit/public/platform/WebURLResponse.h" 170 #include "third_party/WebKit/public/platform/WebURLResponse.h"
169 #include "third_party/WebKit/public/platform/WebVector.h" 171 #include "third_party/WebKit/public/platform/WebVector.h"
170 #include "third_party/WebKit/public/web/WebColorSuggestion.h" 172 #include "third_party/WebKit/public/web/WebColorSuggestion.h"
171 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 173 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
172 #include "third_party/WebKit/public/web/WebDocument.h" 174 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 using blink::WebLocalFrame; 272 using blink::WebLocalFrame;
271 using blink::WebMediaPlayer; 273 using blink::WebMediaPlayer;
272 using blink::WebMediaPlayerClient; 274 using blink::WebMediaPlayerClient;
273 using blink::WebMediaPlayerEncryptedMediaClient; 275 using blink::WebMediaPlayerEncryptedMediaClient;
274 using blink::WebMediaSession; 276 using blink::WebMediaSession;
275 using blink::WebNavigationPolicy; 277 using blink::WebNavigationPolicy;
276 using blink::WebNavigationType; 278 using blink::WebNavigationType;
277 using blink::WebNode; 279 using blink::WebNode;
278 using blink::WebPluginDocument; 280 using blink::WebPluginDocument;
279 using blink::WebPluginParams; 281 using blink::WebPluginParams;
282 using blink::WebPoint;
280 using blink::WebPopupMenuInfo; 283 using blink::WebPopupMenuInfo;
281 using blink::WebRange; 284 using blink::WebRange;
282 using blink::WebRect; 285 using blink::WebRect;
283 using blink::WebReferrerPolicy; 286 using blink::WebReferrerPolicy;
284 using blink::WebScriptSource; 287 using blink::WebScriptSource;
285 using blink::WebSearchableFormData; 288 using blink::WebSearchableFormData;
286 using blink::WebSecurityOrigin; 289 using blink::WebSecurityOrigin;
287 using blink::WebSecurityPolicy; 290 using blink::WebSecurityPolicy;
288 using blink::WebSerializedScriptValue; 291 using blink::WebSerializedScriptValue;
289 using blink::WebServiceWorkerProvider; 292 using blink::WebServiceWorkerProvider;
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) 1490 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete)
1488 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) 1491 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll)
1489 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) 1492 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange)
1490 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, 1493 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset,
1491 OnAdjustSelectionByCharacterOffset) 1494 OnAdjustSelectionByCharacterOffset)
1492 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) 1495 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect)
1493 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, 1496 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent,
1494 OnMoveRangeSelectionExtent) 1497 OnMoveRangeSelectionExtent)
1495 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) 1498 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace)
1496 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) 1499 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling)
1500 IPC_MESSAGE_HANDLER(FrameMsg_CopyImageAt, OnCopyImageAt)
1501 IPC_MESSAGE_HANDLER(FrameMsg_SaveImageAt, OnSaveImageAt)
1497 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, 1502 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete,
1498 OnExtendSelectionAndDelete) 1503 OnExtendSelectionAndDelete)
1499 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, 1504 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText,
1500 OnSetCompositionFromExistingText) 1505 OnSetCompositionFromExistingText)
1501 IPC_MESSAGE_HANDLER(InputMsg_SetEditableSelectionOffsets, 1506 IPC_MESSAGE_HANDLER(InputMsg_SetEditableSelectionOffsets,
1502 OnSetEditableSelectionOffsets) 1507 OnSetEditableSelectionOffsets)
1503 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, 1508 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand,
1504 OnExecuteNoValueEditCommand) 1509 OnExecuteNoValueEditCommand)
1505 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) 1510 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest)
1506 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) 1511 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole)
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 SyncSelectionIfRequired(); 1891 SyncSelectionIfRequired();
1887 } 1892 }
1888 1893
1889 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { 1894 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) {
1890 if (!frame_->hasSelection()) 1895 if (!frame_->hasSelection())
1891 return; 1896 return;
1892 1897
1893 frame_->replaceMisspelledRange(text); 1898 frame_->replaceMisspelledRange(text);
1894 } 1899 }
1895 1900
1901 void RenderFrameImpl::OnCopyImageAt(int x, int y) {
1902 frame_->copyImageAt(WebPoint(x, y));
dcheng 2016/06/17 20:17:56 Unrelated, but it feels like (x, y) should just be
1903 }
1904
1905 void RenderFrameImpl::OnSaveImageAt(int x, int y) {
1906 frame_->saveImageAt(WebPoint(x, y));
1907 }
1908
1896 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) { 1909 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) {
1897 frame_->document().insertStyleSheet(WebString::fromUTF8(css)); 1910 frame_->document().insertStyleSheet(WebString::fromUTF8(css));
1898 } 1911 }
1899 1912
1900 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level, 1913 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level,
1901 const std::string& message) { 1914 const std::string& message) {
1902 AddMessageToConsole(level, message); 1915 AddMessageToConsole(level, message);
1903 } 1916 }
1904 1917
1905 void RenderFrameImpl::OnJavaScriptExecuteRequest( 1918 void RenderFrameImpl::OnJavaScriptExecuteRequest(
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 routing_id_, static_cast<int32_t>(log_severity), message.text, 2988 routing_id_, static_cast<int32_t>(log_severity), message.text,
2976 static_cast<int32_t>(source_line), source_name)); 2989 static_cast<int32_t>(source_line), source_name));
2977 } 2990 }
2978 2991
2979 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request, 2992 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request,
2980 blink::WebNavigationPolicy policy, 2993 blink::WebNavigationPolicy policy,
2981 const blink::WebString& suggested_name, 2994 const blink::WebString& suggested_name,
2982 bool should_replace_current_entry) { 2995 bool should_replace_current_entry) {
2983 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request)); 2996 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request));
2984 if (policy == blink::WebNavigationPolicyDownload) { 2997 if (policy == blink::WebNavigationPolicyDownload) {
2985 render_view_->Send(new ViewHostMsg_DownloadUrl(render_view_->GetRoutingID(), 2998 Send(new FrameHostMsg_DownloadUrl(render_view_->GetRoutingID(),
2986 GetRoutingID(), 2999 GetRoutingID(), request.url(), referrer,
2987 request.url(), referrer, 3000 suggested_name));
2988 suggested_name));
2989 } else { 3001 } else {
2990 OpenURL(request.url(), referrer, policy, should_replace_current_entry, 3002 OpenURL(request.url(), referrer, policy, should_replace_current_entry,
2991 false); 3003 false);
2992 } 3004 }
2993 } 3005 }
2994 3006
2995 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() { 3007 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() {
2996 // OOPIF enabled modes will punt this navigation to the browser in 3008 // OOPIF enabled modes will punt this navigation to the browser in
2997 // decidePolicyForNavigation. 3009 // decidePolicyForNavigation.
2998 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) 3010 if (SiteIsolationPolicy::UseSubframeNavigationEntries())
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3864 gfx::Rect start_rect; 3876 gfx::Rect start_rect;
3865 gfx::Rect end_rect; 3877 gfx::Rect end_rect;
3866 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect); 3878 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect);
3867 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); 3879 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom());
3868 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); 3880 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom());
3869 #endif 3881 #endif
3870 3882
3871 Send(new FrameHostMsg_ContextMenu(routing_id_, params)); 3883 Send(new FrameHostMsg_ContextMenu(routing_id_, params));
3872 } 3884 }
3873 3885
3886 void RenderFrameImpl::saveImageFromDataURL(const blink::WebString& data_url) {
3887 // Note: We should basically send GURL but we use size-limited string instead
3888 // in order to send a larger data url to save a image for <canvas> or <img>.
3889 if (data_url.length() < kMaxLengthOfDataURLString) {
3890 Send(new FrameHostMsg_SaveImageFromDataURL(
3891 render_view_->GetRoutingID(), routing_id_, data_url.utf8()));
3892 }
3893 }
3894
3874 void RenderFrameImpl::willSendRequest( 3895 void RenderFrameImpl::willSendRequest(
3875 blink::WebLocalFrame* frame, 3896 blink::WebLocalFrame* frame,
3876 unsigned identifier, 3897 unsigned identifier,
3877 blink::WebURLRequest& request, 3898 blink::WebURLRequest& request,
3878 const blink::WebURLResponse& redirect_response) { 3899 const blink::WebURLResponse& redirect_response) {
3879 DCHECK_EQ(frame_, frame); 3900 DCHECK_EQ(frame_, frame);
3880 // The request my be empty during tests. 3901 // The request my be empty during tests.
3881 if (request.url().isEmpty()) 3902 if (request.url().isEmpty())
3882 return; 3903 return;
3883 3904
(...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
6235 // event target. Potentially a Pepper plugin will receive the event. 6256 // event target. Potentially a Pepper plugin will receive the event.
6236 // In order to tell whether a plugin gets the last mouse event and which it 6257 // In order to tell whether a plugin gets the last mouse event and which it
6237 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6258 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6238 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6259 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6239 // |pepper_last_mouse_event_target_|. 6260 // |pepper_last_mouse_event_target_|.
6240 pepper_last_mouse_event_target_ = nullptr; 6261 pepper_last_mouse_event_target_ = nullptr;
6241 #endif 6262 #endif
6242 } 6263 }
6243 6264
6244 } // namespace content 6265 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698