| 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 media_stream_dispatcher_(NULL), | 611 media_stream_dispatcher_(NULL), |
| 612 media_stream_impl_(NULL), | 612 media_stream_impl_(NULL), |
| 613 devtools_agent_(NULL), | 613 devtools_agent_(NULL), |
| 614 accessibility_mode_(AccessibilityModeOff), | 614 accessibility_mode_(AccessibilityModeOff), |
| 615 renderer_accessibility_(NULL), | 615 renderer_accessibility_(NULL), |
| 616 java_bridge_dispatcher_(NULL), | 616 java_bridge_dispatcher_(NULL), |
| 617 mouse_lock_dispatcher_(NULL), | 617 mouse_lock_dispatcher_(NULL), |
| 618 #if defined(OS_ANDROID) | 618 #if defined(OS_ANDROID) |
| 619 expected_content_intent_id_(0), | 619 expected_content_intent_id_(0), |
| 620 media_player_proxy_(NULL), | 620 media_player_proxy_(NULL), |
| 621 synchronous_find_active_match_ordinal_(-1), |
| 621 #endif | 622 #endif |
| 622 session_storage_namespace_id_(session_storage_namespace_id), | 623 session_storage_namespace_id_(session_storage_namespace_id), |
| 623 handling_select_range_(false), | 624 handling_select_range_(false), |
| 624 #if defined(OS_WIN) | 625 #if defined(OS_WIN) |
| 625 focused_plugin_id_(-1), | 626 focused_plugin_id_(-1), |
| 626 #endif | 627 #endif |
| 627 guest_to_embedder_channel_(guest_to_embedder_channel), | 628 guest_to_embedder_channel_(guest_to_embedder_channel), |
| 628 guest_pp_instance_(0), | 629 guest_pp_instance_(0), |
| 629 guest_uninitialized_context_(NULL), | 630 guest_uninitialized_context_(NULL), |
| 630 updating_frame_tree_(false), | 631 updating_frame_tree_(false), |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 bool handled = true; | 939 bool handled = true; |
| 939 bool msg_is_ok = true; | 940 bool msg_is_ok = true; |
| 940 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewImpl, message, msg_is_ok) | 941 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewImpl, message, msg_is_ok) |
| 941 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 942 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
| 942 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 943 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
| 943 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) | 944 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) |
| 944 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) | 945 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) |
| 945 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) | 946 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) |
| 946 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) | 947 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) |
| 947 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) | 948 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) |
| 948 #if defined(OS_MACOSX) | |
| 949 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) | |
| 950 #endif | |
| 951 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) | 949 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) |
| 952 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 950 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
| 953 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) | 951 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) |
| 954 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) | 952 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) |
| 955 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 953 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
| 956 IPC_MESSAGE_HANDLER(ViewMsg_ReplaceAll, OnReplaceAll) | 954 IPC_MESSAGE_HANDLER(ViewMsg_ReplaceAll, OnReplaceAll) |
| 957 IPC_MESSAGE_HANDLER(ViewMsg_Unselect, OnUnselect) | 955 IPC_MESSAGE_HANDLER(ViewMsg_Unselect, OnUnselect) |
| 958 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets, | 956 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets, |
| 959 OnSetEditableSelectionOffsets) | 957 OnSetEditableSelectionOffsets) |
| 960 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText, | 958 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText, |
| 961 OnSetCompositionFromExistingText) | 959 OnSetCompositionFromExistingText) |
| 962 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete, | 960 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete, |
| 963 OnExtendSelectionAndDelete) | 961 OnExtendSelectionAndDelete) |
| 964 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) | 962 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) |
| 965 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 963 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
| 966 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) | 964 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 967 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 965 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
| 968 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 966 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
| 969 #if defined(OS_ANDROID) | |
| 970 IPC_MESSAGE_HANDLER(ViewMsg_ActivateNearestFindResult, | |
| 971 OnActivateNearestFindResult) | |
| 972 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, | |
| 973 OnFindMatchRects) | |
| 974 #endif | |
| 975 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 967 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 976 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 968 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
| 977 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) | 969 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) |
| 978 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 970 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
| 979 OnSetZoomLevelForLoadingURL) | 971 OnSetZoomLevelForLoadingURL) |
| 980 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 972 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 981 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 973 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 982 OnResetPageEncodingToDefault) | 974 OnResetPageEncodingToDefault) |
| 983 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 975 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
| 984 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) | 976 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, | 1009 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, |
| 1018 OnDisableScrollbarsForSmallWindows) | 1010 OnDisableScrollbarsForSmallWindows) |
| 1019 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) | 1011 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) |
| 1020 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) | 1012 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) |
| 1021 IPC_MESSAGE_HANDLER(ViewMsg_OrientationChangeEvent, | 1013 IPC_MESSAGE_HANDLER(ViewMsg_OrientationChangeEvent, |
| 1022 OnOrientationChangeEvent) | 1014 OnOrientationChangeEvent) |
| 1023 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) | 1015 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) |
| 1024 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) | 1016 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) |
| 1025 IPC_MESSAGE_HANDLER(ViewMsg_SetNavigationStartTime, | 1017 IPC_MESSAGE_HANDLER(ViewMsg_SetNavigationStartTime, |
| 1026 OnSetNavigationStartTime) | 1018 OnSetNavigationStartTime) |
| 1027 #if defined(OS_MACOSX) | |
| 1028 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | |
| 1029 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | |
| 1030 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | |
| 1031 OnPluginImeCompositionCompleted) | |
| 1032 #endif | |
| 1033 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, | 1019 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, |
| 1034 OnSetEditCommandsForNextKeyEvent) | 1020 OnSetEditCommandsForNextKeyEvent) |
| 1035 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, | 1021 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, |
| 1036 OnCustomContextMenuAction) | 1022 OnCustomContextMenuAction) |
| 1037 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) | 1023 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) |
| 1038 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, | 1024 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, |
| 1039 OnPpapiBrokerChannelCreated) | 1025 OnPpapiBrokerChannelCreated) |
| 1040 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult, | 1026 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult, |
| 1041 OnPpapiBrokerPermissionResult) | 1027 OnPpapiBrokerPermissionResult) |
| 1042 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | 1028 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
| 1043 OnGetAllSavableResourceLinksForCurrentPage) | 1029 OnGetAllSavableResourceLinksForCurrentPage) |
| 1044 IPC_MESSAGE_HANDLER( | 1030 IPC_MESSAGE_HANDLER( |
| 1045 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 1031 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
| 1046 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 1032 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
| 1047 #if defined(OS_MACOSX) | |
| 1048 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | |
| 1049 #elif defined(OS_ANDROID) | |
| 1050 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | |
| 1051 #endif | |
| 1052 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 1033 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
| 1053 // TODO(viettrungluu): Move to a separate message filter. | 1034 // TODO(viettrungluu): Move to a separate message filter. |
| 1054 #if defined(OS_MACOSX) | |
| 1055 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | |
| 1056 #endif | |
| 1057 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 1035 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
| 1058 OnSetHistoryLengthAndPrune) | 1036 OnSetHistoryLengthAndPrune) |
| 1059 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1037 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 1060 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 1038 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
| 1061 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) | 1039 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) |
| 1062 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) | 1040 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) |
| 1041 #if defined(OS_ANDROID) |
| 1042 IPC_MESSAGE_HANDLER(ViewMsg_ActivateNearestFindResult, |
| 1043 OnActivateNearestFindResult) |
| 1044 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) |
| 1045 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
| 1046 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewMsg_SynchronousFind, OnSynchronousFind) |
| 1047 #elif defined(OS_MACOSX) |
| 1048 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) |
| 1049 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
| 1050 OnPluginImeCompositionCompleted) |
| 1051 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
| 1052 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
| 1053 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
| 1054 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
| 1055 #endif |
| 1063 | 1056 |
| 1064 // Have the super handle all other messages. | 1057 // Have the super handle all other messages. |
| 1065 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 1058 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 1066 IPC_END_MESSAGE_MAP() | 1059 IPC_END_MESSAGE_MAP() |
| 1067 | 1060 |
| 1068 if (!msg_is_ok) { | 1061 if (!msg_is_ok) { |
| 1069 // The message had a handler, but its deserialization failed. | 1062 // The message had a handler, but its deserialization failed. |
| 1070 // Kill the renderer to avoid potential spoofing attacks. | 1063 // Kill the renderer to avoid potential spoofing attacks. |
| 1071 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | 1064 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
| 1072 } | 1065 } |
| (...skipping 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3919 } | 3912 } |
| 3920 | 3913 |
| 3921 void RenderViewImpl::numberOfWheelEventHandlersChanged(unsigned num_handlers) { | 3914 void RenderViewImpl::numberOfWheelEventHandlersChanged(unsigned num_handlers) { |
| 3922 Send(new ViewHostMsg_DidChangeNumWheelEvents(routing_id_, num_handlers)); | 3915 Send(new ViewHostMsg_DidChangeNumWheelEvents(routing_id_, num_handlers)); |
| 3923 } | 3916 } |
| 3924 | 3917 |
| 3925 void RenderViewImpl::hasTouchEventHandlers(bool has_handlers) { | 3918 void RenderViewImpl::hasTouchEventHandlers(bool has_handlers) { |
| 3926 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); | 3919 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); |
| 3927 } | 3920 } |
| 3928 | 3921 |
| 3929 void RenderViewImpl::reportFindInPageMatchCount(int request_id, int count, | 3922 void RenderViewImpl::SendFindReply(int request_id, |
| 3923 int match_count, |
| 3924 int ordinal, |
| 3925 const WebRect& selection_rect, |
| 3926 bool final_status_update) { |
| 3927 #if defined(OS_ANDROID) |
| 3928 if (synchronous_find_reply_message_.get()) { |
| 3929 if (final_status_update) { |
| 3930 ViewMsg_SynchronousFind::WriteReplyParams( |
| 3931 synchronous_find_reply_message_.get(), |
| 3932 match_count, |
| 3933 match_count ? synchronous_find_active_match_ordinal_ : 0); |
| 3934 Send(synchronous_find_reply_message_.release()); |
| 3935 } |
| 3936 return; |
| 3937 } |
| 3938 #endif |
| 3939 |
| 3940 Send(new ViewHostMsg_Find_Reply(routing_id_, |
| 3941 request_id, |
| 3942 match_count, |
| 3943 selection_rect, |
| 3944 ordinal, |
| 3945 final_status_update)); |
| 3946 } |
| 3947 |
| 3948 void RenderViewImpl::reportFindInPageMatchCount(int request_id, |
| 3949 int count, |
| 3930 bool final_update) { | 3950 bool final_update) { |
| 3931 int active_match_ordinal = -1; // -1 = don't update active match ordinal | 3951 int active_match_ordinal = -1; // -1 = don't update active match ordinal |
| 3932 if (!count) | 3952 if (!count) |
| 3933 active_match_ordinal = 0; | 3953 active_match_ordinal = 0; |
| 3934 | 3954 |
| 3935 Send(new ViewHostMsg_Find_Reply(routing_id_, | 3955 // Send the search result over to the browser process. |
| 3936 request_id, | 3956 SendFindReply(request_id, |
| 3937 count, | 3957 count, |
| 3938 gfx::Rect(), | 3958 active_match_ordinal, |
| 3939 active_match_ordinal, | 3959 gfx::Rect(), |
| 3940 final_update)); | 3960 final_update); |
| 3941 } | 3961 } |
| 3942 | 3962 |
| 3943 void RenderViewImpl::reportFindInPageSelection(int request_id, | 3963 void RenderViewImpl::reportFindInPageSelection(int request_id, |
| 3944 int active_match_ordinal, | 3964 int active_match_ordinal, |
| 3945 const WebRect& selection_rect) { | 3965 const WebRect& selection_rect) { |
| 3946 // Send the search result over to the browser process. | 3966 #if defined(OS_ANDROID) |
| 3947 Send(new ViewHostMsg_Find_Reply(routing_id_, | 3967 // If this was a SynchronousFind request, we need to remember the ordinal |
| 3948 request_id, | 3968 // value here for replying when reportFindInPageMatchCount is called. |
| 3949 -1, | 3969 if (synchronous_find_reply_message_.get()) { |
| 3950 selection_rect, | 3970 synchronous_find_active_match_ordinal_ = active_match_ordinal; |
| 3951 active_match_ordinal, | 3971 return; |
| 3952 false)); | 3972 } |
| 3973 #endif |
| 3974 |
| 3975 SendFindReply(request_id, |
| 3976 -1, |
| 3977 active_match_ordinal, |
| 3978 selection_rect, |
| 3979 false); |
| 3953 } | 3980 } |
| 3954 | 3981 |
| 3955 void RenderViewImpl::openFileSystem( | 3982 void RenderViewImpl::openFileSystem( |
| 3956 WebFrame* frame, | 3983 WebFrame* frame, |
| 3957 WebFileSystem::Type type, | 3984 WebFileSystem::Type type, |
| 3958 long long size, | 3985 long long size, |
| 3959 bool create, | 3986 bool create, |
| 3960 WebFileSystemCallbacks* callbacks) { | 3987 WebFileSystemCallbacks* callbacks) { |
| 3961 DCHECK(callbacks); | 3988 DCHECK(callbacks); |
| 3962 | 3989 |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4550 web_ui_bindings_.reset(new WebUIBindings( | 4577 web_ui_bindings_.reset(new WebUIBindings( |
| 4551 static_cast<content::RenderView*>(this), routing_id_)); | 4578 static_cast<content::RenderView*>(this), routing_id_)); |
| 4552 } | 4579 } |
| 4553 return web_ui_bindings_.get(); | 4580 return web_ui_bindings_.get(); |
| 4554 } | 4581 } |
| 4555 | 4582 |
| 4556 WebKit::WebPlugin* RenderViewImpl::GetWebPluginFromPluginDocument() { | 4583 WebKit::WebPlugin* RenderViewImpl::GetWebPluginFromPluginDocument() { |
| 4557 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); | 4584 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); |
| 4558 } | 4585 } |
| 4559 | 4586 |
| 4560 void RenderViewImpl::OnFind(int request_id, const string16& search_text, | 4587 void RenderViewImpl::OnFind(int request_id, |
| 4588 const string16& search_text, |
| 4561 const WebFindOptions& options) { | 4589 const WebFindOptions& options) { |
| 4590 #if defined(OS_ANDROID) |
| 4591 // Make sure any asynchronous messages do not disrupt an ongoing synchronous |
| 4592 // find request as it might lead to deadlocks. Also, these should be safe to |
| 4593 // ignore since they would belong to a previous find request. |
| 4594 if (synchronous_find_reply_message_.get()) |
| 4595 return; |
| 4596 #endif |
| 4597 Find(request_id, search_text, options); |
| 4598 } |
| 4599 |
| 4600 void RenderViewImpl::Find(int request_id, |
| 4601 const string16& search_text, |
| 4602 const WebFindOptions& options) { |
| 4562 WebFrame* main_frame = webview()->mainFrame(); | 4603 WebFrame* main_frame = webview()->mainFrame(); |
| 4563 | 4604 |
| 4564 // Check if the plugin still exists in the document. | 4605 // Check if the plugin still exists in the document. |
| 4565 if (main_frame->document().isPluginDocument() && | 4606 if (main_frame->document().isPluginDocument() && |
| 4566 GetWebPluginFromPluginDocument()) { | 4607 GetWebPluginFromPluginDocument()) { |
| 4567 if (options.findNext) { | 4608 if (options.findNext) { |
| 4568 // Just navigate back/forward. | 4609 // Just navigate back/forward. |
| 4569 GetWebPluginFromPluginDocument()->selectFindResult(options.forward); | 4610 GetWebPluginFromPluginDocument()->selectFindResult(options.forward); |
| 4570 } else { | 4611 } else { |
| 4571 if (GetWebPluginFromPluginDocument()->startFind( | 4612 if (!GetWebPluginFromPluginDocument()->startFind( |
| 4572 search_text, options.matchCase, request_id)) { | 4613 search_text, options.matchCase, request_id)) { |
| 4573 } else { | |
| 4574 // Send "no results". | 4614 // Send "no results". |
| 4575 Send(new ViewHostMsg_Find_Reply(routing_id_, | 4615 SendFindReply(request_id, 0, 0, gfx::Rect(), true); |
| 4576 request_id, | |
| 4577 0, | |
| 4578 gfx::Rect(), | |
| 4579 0, | |
| 4580 true)); | |
| 4581 } | 4616 } |
| 4582 } | 4617 } |
| 4583 return; | 4618 return; |
| 4584 } | 4619 } |
| 4585 | 4620 |
| 4586 WebFrame* frame_after_main = main_frame->traverseNext(true); | 4621 WebFrame* frame_after_main = main_frame->traverseNext(true); |
| 4587 WebFrame* focused_frame = webview()->focusedFrame(); | 4622 WebFrame* focused_frame = webview()->focusedFrame(); |
| 4588 WebFrame* search_frame = focused_frame; // start searching focused frame. | 4623 WebFrame* search_frame = focused_frame; // start searching focused frame. |
| 4589 | 4624 |
| 4590 bool multi_frame = (frame_after_main != main_frame); | 4625 bool multi_frame = (frame_after_main != main_frame); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4643 // If nothing is found, set result to "0 of 0", otherwise, set it to | 4678 // If nothing is found, set result to "0 of 0", otherwise, set it to |
| 4644 // "-1 of 1" to indicate that we found at least one item, but we don't know | 4679 // "-1 of 1" to indicate that we found at least one item, but we don't know |
| 4645 // yet what is active. | 4680 // yet what is active. |
| 4646 int ordinal = result ? -1 : 0; // -1 here means, we might know more later. | 4681 int ordinal = result ? -1 : 0; // -1 here means, we might know more later. |
| 4647 int match_count = result ? 1 : 0; // 1 here means possibly more coming. | 4682 int match_count = result ? 1 : 0; // 1 here means possibly more coming. |
| 4648 | 4683 |
| 4649 // If we find no matches then this will be our last status update. | 4684 // If we find no matches then this will be our last status update. |
| 4650 // Otherwise the scoping effort will send more results. | 4685 // Otherwise the scoping effort will send more results. |
| 4651 bool final_status_update = !result; | 4686 bool final_status_update = !result; |
| 4652 | 4687 |
| 4653 // Send the search result over to the browser process. | 4688 SendFindReply(request_id, match_count, ordinal, selection_rect, |
| 4654 Send(new ViewHostMsg_Find_Reply(routing_id_, | 4689 final_status_update); |
| 4655 request_id, | |
| 4656 match_count, | |
| 4657 selection_rect, | |
| 4658 ordinal, | |
| 4659 final_status_update)); | |
| 4660 | 4690 |
| 4661 // Scoping effort begins, starting with the mainframe. | 4691 // Scoping effort begins, starting with the mainframe. |
| 4662 search_frame = main_frame; | 4692 search_frame = main_frame; |
| 4663 | 4693 |
| 4664 main_frame->resetMatchCount(); | 4694 main_frame->resetMatchCount(); |
| 4665 | 4695 |
| 4666 do { | 4696 do { |
| 4667 // Cancel all old scoping requests before starting a new one. | 4697 // Cancel all old scoping requests before starting a new one. |
| 4668 search_frame->cancelPendingScopingEffort(); | 4698 search_frame->cancelPendingScopingEffort(); |
| 4669 | 4699 |
| 4670 // We don't start another scoping effort unless at least one match has | 4700 // We don't start another scoping effort unless at least one match has |
| 4671 // been found. | 4701 // been found. |
| 4672 if (result) { | 4702 if (result) { |
| 4673 // Start new scoping request. If the scoping function determines that it | 4703 // Start new scoping request. If the scoping function determines that it |
| 4674 // needs to scope, it will defer until later. | 4704 // needs to scope, it will defer until later. |
| 4675 search_frame->scopeStringMatches(request_id, | 4705 search_frame->scopeStringMatches(request_id, |
| 4676 search_text, | 4706 search_text, |
| 4677 options, | 4707 options, |
| 4678 true); // reset the tickmarks | 4708 true); // reset the tickmarks |
| 4679 } | 4709 } |
| 4680 | 4710 |
| 4681 // Iterate to the next frame. The frame will not necessarily scope, for | 4711 // Iterate to the next frame. The frame will not necessarily scope, for |
| 4682 // example if it is not visible. | 4712 // example if it is not visible. |
| 4683 search_frame = search_frame->traverseNext(true); | 4713 search_frame = search_frame->traverseNext(true); |
| 4684 } while (search_frame != main_frame); | 4714 } while (search_frame != main_frame); |
| 4685 } | 4715 } |
| 4686 } | 4716 } |
| 4687 | 4717 |
| 4688 void RenderViewImpl::OnStopFinding(content::StopFindAction action) { | 4718 void RenderViewImpl::OnStopFinding(content::StopFindAction action) { |
| 4719 #if defined(OS_ANDROID) |
| 4720 // Make sure any asynchronous messages do not disrupt an ongoing synchronous |
| 4721 // find request as it might lead to deadlocks. Also, these should be safe to |
| 4722 // ignore since they would belong to a previous find request. |
| 4723 if (synchronous_find_reply_message_.get()) |
| 4724 return; |
| 4725 #endif |
| 4726 |
| 4727 StopFinding(action); |
| 4728 } |
| 4729 |
| 4730 void RenderViewImpl::StopFinding(content::StopFindAction action) { |
| 4689 WebView* view = webview(); | 4731 WebView* view = webview(); |
| 4690 if (!view) | 4732 if (!view) |
| 4691 return; | 4733 return; |
| 4692 | 4734 |
| 4693 WebDocument doc = view->mainFrame()->document(); | 4735 WebDocument doc = view->mainFrame()->document(); |
| 4694 if (doc.isPluginDocument() && GetWebPluginFromPluginDocument()) { | 4736 if (doc.isPluginDocument() && GetWebPluginFromPluginDocument()) { |
| 4695 GetWebPluginFromPluginDocument()->stopFind(); | 4737 GetWebPluginFromPluginDocument()->stopFind(); |
| 4696 return; | 4738 return; |
| 4697 } | 4739 } |
| 4698 | 4740 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 4713 if (!doc.isNull()) { | 4755 if (!doc.isNull()) { |
| 4714 WebNode node = doc.focusedNode(); | 4756 WebNode node = doc.focusedNode(); |
| 4715 if (!node.isNull()) | 4757 if (!node.isNull()) |
| 4716 node.simulateClick(); | 4758 node.simulateClick(); |
| 4717 } | 4759 } |
| 4718 } | 4760 } |
| 4719 } | 4761 } |
| 4720 } | 4762 } |
| 4721 | 4763 |
| 4722 #if defined(OS_ANDROID) | 4764 #if defined(OS_ANDROID) |
| 4765 void RenderViewImpl::OnSynchronousFind(int request_id, |
| 4766 const string16& search_string, |
| 4767 const WebFindOptions& options, |
| 4768 IPC::Message* reply_msg) { |
| 4769 // It is impossible for simultaneous blocking finds to occur. |
| 4770 CHECK(!synchronous_find_reply_message_.get()); |
| 4771 synchronous_find_reply_message_.reset(reply_msg); |
| 4772 |
| 4773 // Find next should be asynchronous in order to minimize blocking |
| 4774 // the UI thread as much as possible. |
| 4775 DCHECK(!options.findNext); |
| 4776 StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION); |
| 4777 synchronous_find_active_match_ordinal_ = -1; |
| 4778 |
| 4779 Find(request_id, search_string, options); |
| 4780 } |
| 4781 |
| 4723 void RenderViewImpl::OnActivateNearestFindResult(int request_id, | 4782 void RenderViewImpl::OnActivateNearestFindResult(int request_id, |
| 4724 float x, float y) { | 4783 float x, float y) { |
| 4725 if (!webview()) | 4784 if (!webview()) |
| 4726 return; | 4785 return; |
| 4727 | 4786 |
| 4728 WebFrame* main_frame = webview()->mainFrame(); | 4787 WebFrame* main_frame = webview()->mainFrame(); |
| 4729 WebRect selection_rect; | 4788 WebRect selection_rect; |
| 4730 int ordinal = main_frame->selectNearestFindMatch(WebFloatPoint(x, y), | 4789 int ordinal = main_frame->selectNearestFindMatch(WebFloatPoint(x, y), |
| 4731 &selection_rect); | 4790 &selection_rect); |
| 4732 if (ordinal == -1) { | 4791 if (ordinal == -1) { |
| 4733 // Something went wrong, so send a no-op reply (force the main_frame to | 4792 // Something went wrong, so send a no-op reply (force the main_frame to |
| 4734 // report the current match count) in case the host is waiting for a | 4793 // report the current match count) in case the host is waiting for a |
| 4735 // response due to rate-limiting). | 4794 // response due to rate-limiting). |
| 4736 main_frame->increaseMatchCount(0, request_id); | 4795 main_frame->increaseMatchCount(0, request_id); |
| 4737 return; | 4796 return; |
| 4738 } | 4797 } |
| 4739 | 4798 |
| 4740 Send(new ViewHostMsg_Find_Reply(routing_id_, | 4799 SendFindReply(request_id, |
| 4741 request_id, | 4800 -1 /* number_of_matches */, |
| 4742 -1 /* number_of_matches */, | 4801 ordinal, |
| 4743 selection_rect, | 4802 selection_rect, |
| 4744 ordinal, | 4803 true /* final_update */); |
| 4745 true /* final_update */)); | |
| 4746 } | 4804 } |
| 4747 | 4805 |
| 4748 void RenderViewImpl::OnFindMatchRects(int current_version) { | 4806 void RenderViewImpl::OnFindMatchRects(int current_version) { |
| 4749 if (!webview()) | 4807 if (!webview()) |
| 4750 return; | 4808 return; |
| 4751 | 4809 |
| 4752 WebFrame* main_frame = webview()->mainFrame(); | 4810 WebFrame* main_frame = webview()->mainFrame(); |
| 4753 std::vector<gfx::RectF> match_rects; | 4811 std::vector<gfx::RectF> match_rects; |
| 4754 | 4812 |
| 4755 int rects_version = main_frame->findMatchMarkersVersion(); | 4813 int rects_version = main_frame->findMatchMarkersVersion(); |
| (...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6181 | 6239 |
| 6182 updating_frame_tree_ = true; | 6240 updating_frame_tree_ = true; |
| 6183 active_frame_id_map_.clear(); | 6241 active_frame_id_map_.clear(); |
| 6184 | 6242 |
| 6185 target_process_id_ = process_id; | 6243 target_process_id_ = process_id; |
| 6186 target_routing_id_ = route_id; | 6244 target_routing_id_ = route_id; |
| 6187 CreateFrameTree(webview()->mainFrame(), frames); | 6245 CreateFrameTree(webview()->mainFrame(), frames); |
| 6188 | 6246 |
| 6189 updating_frame_tree_ = false; | 6247 updating_frame_tree_ = false; |
| 6190 } | 6248 } |
| OLD | NEW |