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 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 return true; | 1247 return true; |
1248 | 1248 |
1249 bool handled = true; | 1249 bool handled = true; |
1250 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1250 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
1251 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1251 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
1252 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1252 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
1253 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1253 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
1254 OnScrollFocusedEditableNodeIntoRect) | 1254 OnScrollFocusedEditableNodeIntoRect) |
1255 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1255 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
1256 OnSetEditCommandsForNextKeyEvent) | 1256 OnSetEditCommandsForNextKeyEvent) |
1257 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | |
1258 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | |
1259 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1257 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
1260 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1258 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
1261 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 1259 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
1262 OnSetZoomLevelForLoadingURL) | 1260 OnSetZoomLevelForLoadingURL) |
1263 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1261 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
1264 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1262 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
1265 OnResetPageEncodingToDefault) | 1263 OnResetPageEncodingToDefault) |
1266 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1264 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
1267 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1265 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
1268 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1266 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 | 1324 |
1327 void RenderViewImpl::OnSelectWordAroundCaret() { | 1325 void RenderViewImpl::OnSelectWordAroundCaret() { |
1328 if (!webview()) | 1326 if (!webview()) |
1329 return; | 1327 return; |
1330 | 1328 |
1331 input_handler_->set_handling_input_event(true); | 1329 input_handler_->set_handling_input_event(true); |
1332 webview()->focusedFrame()->selectWordAroundCaret(); | 1330 webview()->focusedFrame()->selectWordAroundCaret(); |
1333 input_handler_->set_handling_input_event(false); | 1331 input_handler_->set_handling_input_event(false); |
1334 } | 1332 } |
1335 | 1333 |
1336 void RenderViewImpl::OnCopyImageAt(int x, int y) { | |
1337 webview()->copyImageAt(WebPoint(x, y)); | |
1338 } | |
1339 | |
1340 void RenderViewImpl::OnSaveImageAt(int x, int y) { | |
1341 webview()->saveImageAt(WebPoint(x, y)); | |
1342 } | |
1343 | |
1344 void RenderViewImpl::OnUpdateTargetURLAck() { | 1334 void RenderViewImpl::OnUpdateTargetURLAck() { |
1345 // Check if there is a targeturl waiting to be sent. | 1335 // Check if there is a targeturl waiting to be sent. |
1346 if (target_url_status_ == TARGET_PENDING) | 1336 if (target_url_status_ == TARGET_PENDING) |
1347 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); | 1337 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); |
1348 | 1338 |
1349 target_url_status_ = TARGET_NONE; | 1339 target_url_status_ = TARGET_NONE; |
1350 } | 1340 } |
1351 | 1341 |
1352 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, | 1342 void RenderViewImpl::OnExecuteEditCommand(const std::string& name, |
1353 const std::string& value) { | 1343 const std::string& value) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { | 1570 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { |
1581 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 1571 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
1582 return new WebStorageNamespaceImpl(session_storage_namespace_id_); | 1572 return new WebStorageNamespaceImpl(session_storage_namespace_id_); |
1583 } | 1573 } |
1584 | 1574 |
1585 void RenderViewImpl::printPage(WebLocalFrame* frame) { | 1575 void RenderViewImpl::printPage(WebLocalFrame* frame) { |
1586 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 1576 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
1587 PrintPage(frame, input_handler().handling_input_event())); | 1577 PrintPage(frame, input_handler().handling_input_event())); |
1588 } | 1578 } |
1589 | 1579 |
1590 void RenderViewImpl::saveImageFromDataURL(const blink::WebString& data_url) { | |
1591 // Note: We should basically send GURL but we use size-limited string instead | |
1592 // in order to send a larger data url to save a image for <canvas> or <img>. | |
1593 if (data_url.length() < kMaxLengthOfDataURLString) | |
1594 Send(new ViewHostMsg_SaveImageFromDataURL( | |
1595 GetRoutingID(), GetMainRenderFrame()->GetRoutingID(), data_url.utf8())); | |
1596 } | |
1597 | |
1598 bool RenderViewImpl::enumerateChosenDirectory( | 1580 bool RenderViewImpl::enumerateChosenDirectory( |
1599 const WebString& path, | 1581 const WebString& path, |
1600 WebFileChooserCompletion* chooser_completion) { | 1582 WebFileChooserCompletion* chooser_completion) { |
1601 int id = enumeration_completion_id_++; | 1583 int id = enumeration_completion_id_++; |
1602 enumeration_completions_[id] = chooser_completion; | 1584 enumeration_completions_[id] = chooser_completion; |
1603 return Send(new ViewHostMsg_EnumerateDirectory( | 1585 return Send(new ViewHostMsg_EnumerateDirectory( |
1604 GetRoutingID(), id, blink::WebStringToFilePath(path))); | 1586 GetRoutingID(), id, blink::WebStringToFilePath(path))); |
1605 } | 1587 } |
1606 | 1588 |
1607 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { | 1589 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { |
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3339 return render_frame->focused_pepper_plugin(); | 3321 return render_frame->focused_pepper_plugin(); |
3340 } | 3322 } |
3341 frame = frame->traverseNext(false); | 3323 frame = frame->traverseNext(false); |
3342 } | 3324 } |
3343 | 3325 |
3344 return nullptr; | 3326 return nullptr; |
3345 } | 3327 } |
3346 #endif | 3328 #endif |
3347 | 3329 |
3348 } // namespace content | 3330 } // namespace content |
OLD | NEW |