| 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 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 return true; | 1275 return true; |
| 1276 | 1276 |
| 1277 bool handled = true; | 1277 bool handled = true; |
| 1278 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1278 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
| 1279 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1279 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 1280 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1280 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
| 1281 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1281 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
| 1282 OnScrollFocusedEditableNodeIntoRect) | 1282 OnScrollFocusedEditableNodeIntoRect) |
| 1283 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1283 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 1284 OnSetEditCommandsForNextKeyEvent) | 1284 OnSetEditCommandsForNextKeyEvent) |
| 1285 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | |
| 1286 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | |
| 1287 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1285 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
| 1288 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1286 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 1289 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 1287 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
| 1290 OnSetZoomLevelForLoadingURL) | 1288 OnSetZoomLevelForLoadingURL) |
| 1291 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1289 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 1292 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1290 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 1293 OnResetPageEncodingToDefault) | 1291 OnResetPageEncodingToDefault) |
| 1294 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1292 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
| 1295 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1293 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
| 1296 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1294 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 | 1351 |
| 1354 void RenderViewImpl::OnSelectWordAroundCaret() { | 1352 void RenderViewImpl::OnSelectWordAroundCaret() { |
| 1355 if (!webview()) | 1353 if (!webview()) |
| 1356 return; | 1354 return; |
| 1357 | 1355 |
| 1358 input_handler_->set_handling_input_event(true); | 1356 input_handler_->set_handling_input_event(true); |
| 1359 webview()->focusedFrame()->selectWordAroundCaret(); | 1357 webview()->focusedFrame()->selectWordAroundCaret(); |
| 1360 input_handler_->set_handling_input_event(false); | 1358 input_handler_->set_handling_input_event(false); |
| 1361 } | 1359 } |
| 1362 | 1360 |
| 1363 void RenderViewImpl::OnCopyImageAt(int x, int y) { | |
| 1364 webview()->copyImageAt(WebPoint(x, y)); | |
| 1365 } | |
| 1366 | |
| 1367 void RenderViewImpl::OnSaveImageAt(int x, int y) { | |
| 1368 webview()->saveImageAt(WebPoint(x, y)); | |
| 1369 } | |
| 1370 | |
| 1371 void RenderViewImpl::OnUpdateTargetURLAck() { | 1361 void RenderViewImpl::OnUpdateTargetURLAck() { |
| 1372 // Check if there is a targeturl waiting to be sent. | 1362 // Check if there is a targeturl waiting to be sent. |
| 1373 if (target_url_status_ == TARGET_PENDING) | 1363 if (target_url_status_ == TARGET_PENDING) |
| 1374 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); | 1364 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); |
| 1375 | 1365 |
| 1376 target_url_status_ = TARGET_NONE; | 1366 target_url_status_ = TARGET_NONE; |
| 1377 } | 1367 } |
| 1378 | 1368 |
| 1379 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, | 1369 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, |
| 1380 const std::string& value) { | 1370 const std::string& value) { |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { | 1597 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { |
| 1608 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 1598 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
| 1609 return new WebStorageNamespaceImpl(session_storage_namespace_id_); | 1599 return new WebStorageNamespaceImpl(session_storage_namespace_id_); |
| 1610 } | 1600 } |
| 1611 | 1601 |
| 1612 void RenderViewImpl::printPage(WebLocalFrame* frame) { | 1602 void RenderViewImpl::printPage(WebLocalFrame* frame) { |
| 1613 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 1603 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 1614 PrintPage(frame, input_handler().handling_input_event())); | 1604 PrintPage(frame, input_handler().handling_input_event())); |
| 1615 } | 1605 } |
| 1616 | 1606 |
| 1617 void RenderViewImpl::saveImageFromDataURL(const blink::WebString& data_url) { | |
| 1618 // Note: We should basically send GURL but we use size-limited string instead | |
| 1619 // in order to send a larger data url to save a image for <canvas> or <img>. | |
| 1620 if (data_url.length() < kMaxLengthOfDataURLString) | |
| 1621 Send(new ViewHostMsg_SaveImageFromDataURL( | |
| 1622 GetRoutingID(), GetMainRenderFrame()->GetRoutingID(), data_url.utf8())); | |
| 1623 } | |
| 1624 | |
| 1625 bool RenderViewImpl::enumerateChosenDirectory( | 1607 bool RenderViewImpl::enumerateChosenDirectory( |
| 1626 const WebString& path, | 1608 const WebString& path, |
| 1627 WebFileChooserCompletion* chooser_completion) { | 1609 WebFileChooserCompletion* chooser_completion) { |
| 1628 int id = enumeration_completion_id_++; | 1610 int id = enumeration_completion_id_++; |
| 1629 enumeration_completions_[id] = chooser_completion; | 1611 enumeration_completions_[id] = chooser_completion; |
| 1630 return Send(new ViewHostMsg_EnumerateDirectory( | 1612 return Send(new ViewHostMsg_EnumerateDirectory( |
| 1631 GetRoutingID(), id, blink::WebStringToFilePath(path))); | 1613 GetRoutingID(), id, blink::WebStringToFilePath(path))); |
| 1632 } | 1614 } |
| 1633 | 1615 |
| 1634 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { | 1616 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { |
| (...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3281 return render_frame->focused_pepper_plugin(); | 3263 return render_frame->focused_pepper_plugin(); |
| 3282 } | 3264 } |
| 3283 frame = frame->traverseNext(false); | 3265 frame = frame->traverseNext(false); |
| 3284 } | 3266 } |
| 3285 | 3267 |
| 3286 return nullptr; | 3268 return nullptr; |
| 3287 } | 3269 } |
| 3288 #endif | 3270 #endif |
| 3289 | 3271 |
| 3290 } // namespace content | 3272 } // namespace content |
| OLD | NEW |