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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) | 870 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) |
871 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 871 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
872 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) | 872 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) |
873 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) | 873 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) |
874 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 874 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
875 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) | 875 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) |
876 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 876 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
877 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) | 877 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) |
878 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 878 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
879 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 879 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
880 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) | |
881 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 880 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
882 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 881 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
883 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) | 882 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) |
884 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 883 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
885 OnSetZoomLevelForLoadingURL) | 884 OnSetZoomLevelForLoadingURL) |
886 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 885 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
887 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 886 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
888 OnResetPageEncodingToDefault) | 887 OnResetPageEncodingToDefault) |
889 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 888 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
890 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) | 889 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) |
(...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3652 void RenderViewImpl::hasTouchEventHandlers(bool has_handlers) { | 3651 void RenderViewImpl::hasTouchEventHandlers(bool has_handlers) { |
3653 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); | 3652 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); |
3654 } | 3653 } |
3655 | 3654 |
3656 void RenderViewImpl::reportFindInPageMatchCount(int request_id, int count, | 3655 void RenderViewImpl::reportFindInPageMatchCount(int request_id, int count, |
3657 bool final_update) { | 3656 bool final_update) { |
3658 int active_match_ordinal = -1; // -1 = don't update active match ordinal | 3657 int active_match_ordinal = -1; // -1 = don't update active match ordinal |
3659 if (!count) | 3658 if (!count) |
3660 active_match_ordinal = 0; | 3659 active_match_ordinal = 0; |
3661 | 3660 |
3662 IPC::Message* msg = new ViewHostMsg_Find_Reply( | 3661 Send(new ViewHostMsg_Find_Reply(routing_id_, |
3663 routing_id_, | 3662 request_id, |
3664 request_id, | 3663 count, |
3665 count, | 3664 gfx::Rect(), |
3666 gfx::Rect(), | 3665 active_match_ordinal, |
3667 active_match_ordinal, | 3666 final_update)); |
3668 final_update); | |
3669 | |
3670 // If we have a message that has been queued up, then we should just replace | |
3671 // it. The ACK from the browser will make sure it gets sent when the browser | |
3672 // wants it. | |
3673 if (queued_find_reply_message_.get()) { | |
3674 queued_find_reply_message_.reset(msg); | |
3675 } else { | |
3676 // Send the search result over to the browser process. | |
3677 Send(msg); | |
3678 } | |
3679 } | 3667 } |
3680 | 3668 |
3681 void RenderViewImpl::reportFindInPageSelection(int request_id, | 3669 void RenderViewImpl::reportFindInPageSelection(int request_id, |
3682 int active_match_ordinal, | 3670 int active_match_ordinal, |
3683 const WebRect& selection_rect) { | 3671 const WebRect& selection_rect) { |
3684 // Send the search result over to the browser process. | 3672 // Send the search result over to the browser process. |
3685 Send(new ViewHostMsg_Find_Reply(routing_id_, | 3673 Send(new ViewHostMsg_Find_Reply(routing_id_, |
3686 request_id, | 3674 request_id, |
3687 -1, | 3675 -1, |
3688 selection_rect, | 3676 selection_rect, |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4433 WebDocument doc = focused_frame->document(); | 4421 WebDocument doc = focused_frame->document(); |
4434 if (!doc.isNull()) { | 4422 if (!doc.isNull()) { |
4435 WebNode node = doc.focusedNode(); | 4423 WebNode node = doc.focusedNode(); |
4436 if (!node.isNull()) | 4424 if (!node.isNull()) |
4437 node.simulateClick(); | 4425 node.simulateClick(); |
4438 } | 4426 } |
4439 } | 4427 } |
4440 } | 4428 } |
4441 } | 4429 } |
4442 | 4430 |
4443 void RenderViewImpl::OnFindReplyAck() { | |
4444 // Check if there is any queued up request waiting to be sent. | |
4445 if (queued_find_reply_message_.get()) { | |
4446 // Send the search result over to the browser process. | |
4447 Send(queued_find_reply_message_.release()); | |
4448 } | |
4449 } | |
4450 | |
4451 void RenderViewImpl::OnZoom(content::PageZoom zoom) { | 4431 void RenderViewImpl::OnZoom(content::PageZoom zoom) { |
4452 if (!webview()) // Not sure if this can happen, but no harm in being safe. | 4432 if (!webview()) // Not sure if this can happen, but no harm in being safe. |
4453 return; | 4433 return; |
4454 | 4434 |
4455 webview()->hidePopups(); | 4435 webview()->hidePopups(); |
4456 | 4436 |
4457 double old_zoom_level = webview()->zoomLevel(); | 4437 double old_zoom_level = webview()->zoomLevel(); |
4458 double zoom_level; | 4438 double zoom_level; |
4459 if (zoom == content::PAGE_ZOOM_RESET) { | 4439 if (zoom == content::PAGE_ZOOM_RESET) { |
4460 zoom_level = 0; | 4440 zoom_level = 0; |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5784 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5764 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5785 return !!RenderThreadImpl::current()->compositor_thread(); | 5765 return !!RenderThreadImpl::current()->compositor_thread(); |
5786 } | 5766 } |
5787 | 5767 |
5788 void RenderViewImpl::OnJavaBridgeInit() { | 5768 void RenderViewImpl::OnJavaBridgeInit() { |
5789 DCHECK(!java_bridge_dispatcher_); | 5769 DCHECK(!java_bridge_dispatcher_); |
5790 #if defined(ENABLE_JAVA_BRIDGE) | 5770 #if defined(ENABLE_JAVA_BRIDGE) |
5791 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5771 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
5792 #endif | 5772 #endif |
5793 } | 5773 } |
OLD | NEW |