| OLD | NEW |
| 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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 return true; | 1266 return true; |
| 1267 | 1267 |
| 1268 bool handled = true; | 1268 bool handled = true; |
| 1269 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1269 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
| 1270 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1270 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 1271 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1271 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
| 1272 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1272 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
| 1273 OnScrollFocusedEditableNodeIntoRect) | 1273 OnScrollFocusedEditableNodeIntoRect) |
| 1274 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1274 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 1275 OnSetEditCommandsForNextKeyEvent) | 1275 OnSetEditCommandsForNextKeyEvent) |
| 1276 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | |
| 1277 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | |
| 1278 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1276 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
| 1279 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1277 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 1280 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 1278 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
| 1281 OnSetZoomLevelForLoadingURL) | 1279 OnSetZoomLevelForLoadingURL) |
| 1282 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1280 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 1283 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1281 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 1284 OnResetPageEncodingToDefault) | 1282 OnResetPageEncodingToDefault) |
| 1285 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1283 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
| 1286 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1284 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
| 1287 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1285 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 | 1343 |
| 1346 void RenderViewImpl::OnSelectWordAroundCaret() { | 1344 void RenderViewImpl::OnSelectWordAroundCaret() { |
| 1347 if (!webview()) | 1345 if (!webview()) |
| 1348 return; | 1346 return; |
| 1349 | 1347 |
| 1350 input_handler_->set_handling_input_event(true); | 1348 input_handler_->set_handling_input_event(true); |
| 1351 webview()->focusedFrame()->selectWordAroundCaret(); | 1349 webview()->focusedFrame()->selectWordAroundCaret(); |
| 1352 input_handler_->set_handling_input_event(false); | 1350 input_handler_->set_handling_input_event(false); |
| 1353 } | 1351 } |
| 1354 | 1352 |
| 1355 void RenderViewImpl::OnCopyImageAt(int x, int y) { | |
| 1356 webview()->copyImageAt(WebPoint(x, y)); | |
| 1357 } | |
| 1358 | |
| 1359 void RenderViewImpl::OnSaveImageAt(int x, int y) { | |
| 1360 webview()->saveImageAt(WebPoint(x, y)); | |
| 1361 } | |
| 1362 | |
| 1363 void RenderViewImpl::OnUpdateTargetURLAck() { | 1353 void RenderViewImpl::OnUpdateTargetURLAck() { |
| 1364 // Check if there is a targeturl waiting to be sent. | 1354 // Check if there is a targeturl waiting to be sent. |
| 1365 if (target_url_status_ == TARGET_PENDING) | 1355 if (target_url_status_ == TARGET_PENDING) |
| 1366 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); | 1356 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); |
| 1367 | 1357 |
| 1368 target_url_status_ = TARGET_NONE; | 1358 target_url_status_ = TARGET_NONE; |
| 1369 } | 1359 } |
| 1370 | 1360 |
| 1371 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, | 1361 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, |
| 1372 const std::string& value) { | 1362 const std::string& value) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { | 1592 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { |
| 1603 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 1593 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
| 1604 return new WebStorageNamespaceImpl(session_storage_namespace_id_); | 1594 return new WebStorageNamespaceImpl(session_storage_namespace_id_); |
| 1605 } | 1595 } |
| 1606 | 1596 |
| 1607 void RenderViewImpl::printPage(WebLocalFrame* frame) { | 1597 void RenderViewImpl::printPage(WebLocalFrame* frame) { |
| 1608 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 1598 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 1609 PrintPage(frame, input_handler().handling_input_event())); | 1599 PrintPage(frame, input_handler().handling_input_event())); |
| 1610 } | 1600 } |
| 1611 | 1601 |
| 1612 void RenderViewImpl::saveImageFromDataURL(const blink::WebString& data_url) { | |
| 1613 // Note: We should basically send GURL but we use size-limited string instead | |
| 1614 // in order to send a larger data url to save a image for <canvas> or <img>. | |
| 1615 if (data_url.length() < kMaxLengthOfDataURLString) | |
| 1616 Send(new ViewHostMsg_SaveImageFromDataURL( | |
| 1617 GetRoutingID(), GetMainRenderFrame()->GetRoutingID(), data_url.utf8())); | |
| 1618 } | |
| 1619 | |
| 1620 bool RenderViewImpl::enumerateChosenDirectory( | 1602 bool RenderViewImpl::enumerateChosenDirectory( |
| 1621 const WebString& path, | 1603 const WebString& path, |
| 1622 WebFileChooserCompletion* chooser_completion) { | 1604 WebFileChooserCompletion* chooser_completion) { |
| 1623 int id = enumeration_completion_id_++; | 1605 int id = enumeration_completion_id_++; |
| 1624 enumeration_completions_[id] = chooser_completion; | 1606 enumeration_completions_[id] = chooser_completion; |
| 1625 return Send(new ViewHostMsg_EnumerateDirectory( | 1607 return Send(new ViewHostMsg_EnumerateDirectory( |
| 1626 GetRoutingID(), id, blink::WebStringToFilePath(path))); | 1608 GetRoutingID(), id, blink::WebStringToFilePath(path))); |
| 1627 } | 1609 } |
| 1628 | 1610 |
| 1629 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { | 1611 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { |
| (...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3390 return render_frame->focused_pepper_plugin(); | 3372 return render_frame->focused_pepper_plugin(); |
| 3391 } | 3373 } |
| 3392 frame = frame->traverseNext(false); | 3374 frame = frame->traverseNext(false); |
| 3393 } | 3375 } |
| 3394 | 3376 |
| 3395 return nullptr; | 3377 return nullptr; |
| 3396 } | 3378 } |
| 3397 #endif | 3379 #endif |
| 3398 | 3380 |
| 3399 } // namespace content | 3381 } // namespace content |
| OLD | NEW |