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

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: 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 5f3ab60a7bf3ef5f6b3851f4f2efd44090984100..56d2e9cdd3f307573433521ce2d2e6871d71ff16 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));
+}
+
+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));
}
@@ -2984,10 +2997,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);
@@ -3873,6 +3885,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,
« 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