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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index bc920bb8454fca5e7bccffb50ab68d0fd5609f0a..197815859ae603039d1fb6332125db17ff94f974 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -50,6 +50,7 @@
#include "content/child/weburlresponse_extradata_impl.h"
#include "content/common/accessibility_messages.h"
#include "content/common/clipboard_messages.h"
+#include "content/common/content_constants_internal.h"
#include "content/common/content_security_policy_header.h"
#include "content/common/frame_messages.h"
#include "content/common/frame_replication_state.h"
@@ -160,6 +161,7 @@
#include "third_party/WebKit/public/platform/WebData.h"
#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
#include "third_party/WebKit/public/platform/WebMediaPlayerSource.h"
+#include "third_party/WebKit/public/platform/WebPoint.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
#include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h"
#include "third_party/WebKit/public/platform/WebString.h"
@@ -277,6 +279,7 @@ using blink::WebNavigationType;
using blink::WebNode;
using blink::WebPluginDocument;
using blink::WebPluginParams;
+using blink::WebPoint;
using blink::WebPopupMenuInfo;
using blink::WebRange;
using blink::WebRect;
@@ -1494,6 +1497,8 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
OnMoveRangeSelectionExtent)
IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace)
IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling)
+ IPC_MESSAGE_HANDLER(FrameMsg_CopyImageAt, OnCopyImageAt)
+ IPC_MESSAGE_HANDLER(FrameMsg_SaveImageAt, OnSaveImageAt)
IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete,
OnExtendSelectionAndDelete)
IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText,
@@ -1893,6 +1898,14 @@ void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) {
frame_->replaceMisspelledRange(text);
}
+void RenderFrameImpl::OnCopyImageAt(int x, int y) {
+ frame_->copyImageAt(WebPoint(x, y));
dcheng 2016/06/17 20:17:56 Unrelated, but it feels like (x, y) should just be
+}
+
+void RenderFrameImpl::OnSaveImageAt(int x, int y) {
+ frame_->saveImageAt(WebPoint(x, y));
+}
+
void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) {
frame_->document().insertStyleSheet(WebString::fromUTF8(css));
}
@@ -2982,10 +2995,9 @@ void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request,
bool should_replace_current_entry) {
Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request));
if (policy == blink::WebNavigationPolicyDownload) {
- render_view_->Send(new ViewHostMsg_DownloadUrl(render_view_->GetRoutingID(),
- GetRoutingID(),
- request.url(), referrer,
- suggested_name));
+ Send(new FrameHostMsg_DownloadUrl(render_view_->GetRoutingID(),
+ GetRoutingID(), request.url(), referrer,
+ suggested_name));
} else {
OpenURL(request.url(), referrer, policy, should_replace_current_entry,
false);
@@ -3871,6 +3883,15 @@ void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) {
Send(new FrameHostMsg_ContextMenu(routing_id_, params));
}
+void RenderFrameImpl::saveImageFromDataURL(const blink::WebString& data_url) {
+ // Note: We should basically send GURL but we use size-limited string instead
+ // in order to send a larger data url to save a image for <canvas> or <img>.
+ if (data_url.length() < kMaxLengthOfDataURLString) {
+ Send(new FrameHostMsg_SaveImageFromDataURL(
+ render_view_->GetRoutingID(), routing_id_, data_url.utf8()));
+ }
+}
+
void RenderFrameImpl::willSendRequest(
blink::WebLocalFrame* frame,
unsigned identifier,

Powered by Google App Engine
This is Rietveld 408576698