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

Side by Side Diff: content/renderer/render_view_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: RenderViewHostTest 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 return true; 1289 return true;
1290 1290
1291 bool handled = true; 1291 bool handled = true;
1292 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) 1292 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message)
1293 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) 1293 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1294 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) 1294 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
1295 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, 1295 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect,
1296 OnScrollFocusedEditableNodeIntoRect) 1296 OnScrollFocusedEditableNodeIntoRect)
1297 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, 1297 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent,
1298 OnSetEditCommandsForNextKeyEvent) 1298 OnSetEditCommandsForNextKeyEvent)
1299 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
1300 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt)
1301 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) 1299 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale)
1302 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) 1300 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
1303 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, 1301 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
1304 OnSetZoomLevelForLoadingURL) 1302 OnSetZoomLevelForLoadingURL)
1305 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) 1303 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
1306 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, 1304 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
1307 OnResetPageEncodingToDefault) 1305 OnResetPageEncodingToDefault)
1308 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) 1306 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter)
1309 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) 1307 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver)
1310 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) 1308 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 1366
1369 void RenderViewImpl::OnSelectWordAroundCaret() { 1367 void RenderViewImpl::OnSelectWordAroundCaret() {
1370 if (!webview()) 1368 if (!webview())
1371 return; 1369 return;
1372 1370
1373 input_handler_->set_handling_input_event(true); 1371 input_handler_->set_handling_input_event(true);
1374 webview()->focusedFrame()->selectWordAroundCaret(); 1372 webview()->focusedFrame()->selectWordAroundCaret();
1375 input_handler_->set_handling_input_event(false); 1373 input_handler_->set_handling_input_event(false);
1376 } 1374 }
1377 1375
1378 void RenderViewImpl::OnCopyImageAt(int x, int y) {
1379 webview()->copyImageAt(WebPoint(x, y));
1380 }
1381
1382 void RenderViewImpl::OnSaveImageAt(int x, int y) {
1383 webview()->saveImageAt(WebPoint(x, y));
1384 }
1385
1386 void RenderViewImpl::OnUpdateTargetURLAck() { 1376 void RenderViewImpl::OnUpdateTargetURLAck() {
1387 // Check if there is a targeturl waiting to be sent. 1377 // Check if there is a targeturl waiting to be sent.
1388 if (target_url_status_ == TARGET_PENDING) 1378 if (target_url_status_ == TARGET_PENDING)
1389 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); 1379 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_));
1390 1380
1391 target_url_status_ = TARGET_NONE; 1381 target_url_status_ = TARGET_NONE;
1392 } 1382 }
1393 1383
1394 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, 1384 void RenderViewImpl::OnExecuteEditCommand(const std::string& name,
1395 const std::string& value) { 1385 const std::string& value) {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { 1612 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() {
1623 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); 1613 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId);
1624 return new WebStorageNamespaceImpl(session_storage_namespace_id_); 1614 return new WebStorageNamespaceImpl(session_storage_namespace_id_);
1625 } 1615 }
1626 1616
1627 void RenderViewImpl::printPage(WebLocalFrame* frame) { 1617 void RenderViewImpl::printPage(WebLocalFrame* frame) {
1628 FOR_EACH_OBSERVER(RenderViewObserver, observers_, 1618 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
1629 PrintPage(frame, input_handler().handling_input_event())); 1619 PrintPage(frame, input_handler().handling_input_event()));
1630 } 1620 }
1631 1621
1632 void RenderViewImpl::saveImageFromDataURL(const blink::WebString& data_url) {
1633 // Note: We should basically send GURL but we use size-limited string instead
1634 // in order to send a larger data url to save a image for <canvas> or <img>.
1635 if (data_url.length() < kMaxLengthOfDataURLString)
1636 Send(new ViewHostMsg_SaveImageFromDataURL(
1637 GetRoutingID(), GetMainRenderFrame()->GetRoutingID(), data_url.utf8()));
1638 }
1639
1640 bool RenderViewImpl::enumerateChosenDirectory( 1622 bool RenderViewImpl::enumerateChosenDirectory(
1641 const WebString& path, 1623 const WebString& path,
1642 WebFileChooserCompletion* chooser_completion) { 1624 WebFileChooserCompletion* chooser_completion) {
1643 int id = enumeration_completion_id_++; 1625 int id = enumeration_completion_id_++;
1644 enumeration_completions_[id] = chooser_completion; 1626 enumeration_completions_[id] = chooser_completion;
1645 return Send(new ViewHostMsg_EnumerateDirectory( 1627 return Send(new ViewHostMsg_EnumerateDirectory(
1646 GetRoutingID(), id, blink::WebStringToFilePath(path))); 1628 GetRoutingID(), id, blink::WebStringToFilePath(path)));
1647 } 1629 }
1648 1630
1649 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { 1631 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) {
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
3395 return render_frame->focused_pepper_plugin(); 3377 return render_frame->focused_pepper_plugin();
3396 } 3378 }
3397 frame = frame->traverseNext(false); 3379 frame = frame->traverseNext(false);
3398 } 3380 }
3399 3381
3400 return nullptr; 3382 return nullptr;
3401 } 3383 }
3402 #endif 3384 #endif
3403 3385
3404 } // namespace content 3386 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698