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 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 return true; | 1229 return true; |
1230 | 1230 |
1231 bool handled = true; | 1231 bool handled = true; |
1232 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1232 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
1233 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1233 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
1234 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1234 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
1235 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1235 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
1236 OnScrollFocusedEditableNodeIntoRect) | 1236 OnScrollFocusedEditableNodeIntoRect) |
1237 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1237 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
1238 OnSetEditCommandsForNextKeyEvent) | 1238 OnSetEditCommandsForNextKeyEvent) |
1239 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | |
1240 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | |
1241 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1239 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
1242 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1240 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
1243 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 1241 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
1244 OnSetZoomLevelForLoadingURL) | 1242 OnSetZoomLevelForLoadingURL) |
1245 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1243 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
1246 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1244 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
1247 OnResetPageEncodingToDefault) | 1245 OnResetPageEncodingToDefault) |
1248 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1246 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
1249 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1247 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
1250 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1248 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 | 1305 |
1308 void RenderViewImpl::OnSelectWordAroundCaret() { | 1306 void RenderViewImpl::OnSelectWordAroundCaret() { |
1309 if (!webview()) | 1307 if (!webview()) |
1310 return; | 1308 return; |
1311 | 1309 |
1312 input_handler_->set_handling_input_event(true); | 1310 input_handler_->set_handling_input_event(true); |
1313 webview()->focusedFrame()->selectWordAroundCaret(); | 1311 webview()->focusedFrame()->selectWordAroundCaret(); |
1314 input_handler_->set_handling_input_event(false); | 1312 input_handler_->set_handling_input_event(false); |
1315 } | 1313 } |
1316 | 1314 |
1317 void RenderViewImpl::OnCopyImageAt(int x, int y) { | |
1318 webview()->copyImageAt(WebPoint(x, y)); | |
1319 } | |
1320 | |
1321 void RenderViewImpl::OnSaveImageAt(int x, int y) { | |
1322 webview()->saveImageAt(WebPoint(x, y)); | |
1323 } | |
1324 | |
1325 void RenderViewImpl::OnUpdateTargetURLAck() { | 1315 void RenderViewImpl::OnUpdateTargetURLAck() { |
1326 // Check if there is a targeturl waiting to be sent. | 1316 // Check if there is a targeturl waiting to be sent. |
1327 if (target_url_status_ == TARGET_PENDING) | 1317 if (target_url_status_ == TARGET_PENDING) |
1328 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); | 1318 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); |
1329 | 1319 |
1330 target_url_status_ = TARGET_NONE; | 1320 target_url_status_ = TARGET_NONE; |
1331 } | 1321 } |
1332 | 1322 |
1333 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, | 1323 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, |
1334 const std::string& value) { | 1324 const std::string& value) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { | 1551 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { |
1562 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 1552 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
1563 return new WebStorageNamespaceImpl(session_storage_namespace_id_); | 1553 return new WebStorageNamespaceImpl(session_storage_namespace_id_); |
1564 } | 1554 } |
1565 | 1555 |
1566 void RenderViewImpl::printPage(WebLocalFrame* frame) { | 1556 void RenderViewImpl::printPage(WebLocalFrame* frame) { |
1567 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 1557 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
1568 PrintPage(frame, input_handler().handling_input_event())); | 1558 PrintPage(frame, input_handler().handling_input_event())); |
1569 } | 1559 } |
1570 | 1560 |
1571 void RenderViewImpl::saveImageFromDataURL(const blink::WebString& data_url) { | |
1572 // Note: We should basically send GURL but we use size-limited string instead | |
1573 // in order to send a larger data url to save a image for <canvas> or <img>. | |
1574 if (data_url.length() < kMaxLengthOfDataURLString) | |
1575 Send(new ViewHostMsg_SaveImageFromDataURL( | |
1576 GetRoutingID(), GetMainRenderFrame()->GetRoutingID(), data_url.utf8())); | |
1577 } | |
1578 | |
1579 bool RenderViewImpl::enumerateChosenDirectory( | 1561 bool RenderViewImpl::enumerateChosenDirectory( |
1580 const WebString& path, | 1562 const WebString& path, |
1581 WebFileChooserCompletion* chooser_completion) { | 1563 WebFileChooserCompletion* chooser_completion) { |
1582 int id = enumeration_completion_id_++; | 1564 int id = enumeration_completion_id_++; |
1583 enumeration_completions_[id] = chooser_completion; | 1565 enumeration_completions_[id] = chooser_completion; |
1584 return Send(new ViewHostMsg_EnumerateDirectory( | 1566 return Send(new ViewHostMsg_EnumerateDirectory( |
1585 GetRoutingID(), id, blink::WebStringToFilePath(path))); | 1567 GetRoutingID(), id, blink::WebStringToFilePath(path))); |
1586 } | 1568 } |
1587 | 1569 |
1588 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { | 1570 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { |
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3236 return render_frame->focused_pepper_plugin(); | 3218 return render_frame->focused_pepper_plugin(); |
3237 } | 3219 } |
3238 frame = frame->traverseNext(false); | 3220 frame = frame->traverseNext(false); |
3239 } | 3221 } |
3240 | 3222 |
3241 return nullptr; | 3223 return nullptr; |
3242 } | 3224 } |
3243 #endif | 3225 #endif |
3244 | 3226 |
3245 } // namespace content | 3227 } // namespace content |
OLD | NEW |