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

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: review comments, merge 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
2977 routing_id_, static_cast<int32_t>(log_severity), message.text, 2990 routing_id_, static_cast<int32_t>(log_severity), message.text,
2978 static_cast<int32_t>(source_line), source_name)); 2991 static_cast<int32_t>(source_line), source_name));
2979 } 2992 }
2980 2993
2981 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request, 2994 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request,
2982 blink::WebNavigationPolicy policy, 2995 blink::WebNavigationPolicy policy,
2983 const blink::WebString& suggested_name, 2996 const blink::WebString& suggested_name,
2984 bool should_replace_current_entry) { 2997 bool should_replace_current_entry) {
2985 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request)); 2998 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request));
2986 if (policy == blink::WebNavigationPolicyDownload) { 2999 if (policy == blink::WebNavigationPolicyDownload) {
2987 render_view_->Send(new ViewHostMsg_DownloadUrl(render_view_->GetRoutingID(), 3000 Send(new FrameHostMsg_DownloadUrl(render_view_->GetRoutingID(),
2988 GetRoutingID(), 3001 GetRoutingID(), request.url(), referrer,
2989 request.url(), referrer, 3002 suggested_name));
2990 suggested_name));
2991 } else { 3003 } else {
2992 OpenURL(request.url(), referrer, policy, should_replace_current_entry, 3004 OpenURL(request.url(), referrer, policy, should_replace_current_entry,
2993 false); 3005 false);
2994 } 3006 }
2995 } 3007 }
2996 3008
2997 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() { 3009 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() {
2998 // OOPIF enabled modes will punt this navigation to the browser in 3010 // OOPIF enabled modes will punt this navigation to the browser in
2999 // decidePolicyForNavigation. 3011 // decidePolicyForNavigation.
3000 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) 3012 if (SiteIsolationPolicy::UseSubframeNavigationEntries())
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3866 gfx::Rect start_rect; 3878 gfx::Rect start_rect;
3867 gfx::Rect end_rect; 3879 gfx::Rect end_rect;
3868 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect); 3880 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect);
3869 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); 3881 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom());
3870 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); 3882 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom());
3871 #endif 3883 #endif
3872 3884
3873 Send(new FrameHostMsg_ContextMenu(routing_id_, params)); 3885 Send(new FrameHostMsg_ContextMenu(routing_id_, params));
3874 } 3886 }
3875 3887
3888 void RenderFrameImpl::saveImageFromDataURL(const blink::WebString& data_url) {
3889 // Note: We should basically send GURL but we use size-limited string instead
3890 // in order to send a larger data url to save a image for <canvas> or <img>.
3891 if (data_url.length() < kMaxLengthOfDataURLString) {
3892 Send(new FrameHostMsg_SaveImageFromDataURL(
3893 render_view_->GetRoutingID(), routing_id_, data_url.utf8()));
3894 }
3895 }
3896
3876 void RenderFrameImpl::willSendRequest( 3897 void RenderFrameImpl::willSendRequest(
3877 blink::WebLocalFrame* frame, 3898 blink::WebLocalFrame* frame,
3878 unsigned identifier, 3899 unsigned identifier,
3879 blink::WebURLRequest& request, 3900 blink::WebURLRequest& request,
3880 const blink::WebURLResponse& redirect_response) { 3901 const blink::WebURLResponse& redirect_response) {
3881 DCHECK_EQ(frame_, frame); 3902 DCHECK_EQ(frame_, frame);
3882 // The request my be empty during tests. 3903 // The request my be empty during tests.
3883 if (request.url().isEmpty()) 3904 if (request.url().isEmpty())
3884 return; 3905 return;
3885 3906
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after
6241 // event target. Potentially a Pepper plugin will receive the event. 6262 // event target. Potentially a Pepper plugin will receive the event.
6242 // In order to tell whether a plugin gets the last mouse event and which it 6263 // In order to tell whether a plugin gets the last mouse event and which it
6243 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6264 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6244 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6265 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6245 // |pepper_last_mouse_event_target_|. 6266 // |pepper_last_mouse_event_target_|.
6246 pepper_last_mouse_event_target_ = nullptr; 6267 pepper_last_mouse_event_target_ = nullptr;
6247 #endif 6268 #endif
6248 } 6269 }
6249 6270
6250 } // namespace content 6271 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698