Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 14487003: Add a new pair of IPC categories for messages that need handling as input events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addresses feedback Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 17 matching lines...) Expand all
28 #include "base/time.h" 28 #include "base/time.h"
29 #include "base/utf_string_conversions.h" 29 #include "base/utf_string_conversions.h"
30 #include "content/common/appcache/appcache_dispatcher.h" 30 #include "content/common/appcache/appcache_dispatcher.h"
31 #include "content/common/child_thread.h" 31 #include "content/common/child_thread.h"
32 #include "content/common/clipboard_messages.h" 32 #include "content/common/clipboard_messages.h"
33 #include "content/common/database_messages.h" 33 #include "content/common/database_messages.h"
34 #include "content/common/drag_messages.h" 34 #include "content/common/drag_messages.h"
35 #include "content/common/fileapi/file_system_dispatcher.h" 35 #include "content/common/fileapi/file_system_dispatcher.h"
36 #include "content/common/fileapi/webfilesystem_callback_dispatcher.h" 36 #include "content/common/fileapi/webfilesystem_callback_dispatcher.h"
37 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 37 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
38 #include "content/common/input_messages.h"
38 #include "content/common/java_bridge_messages.h" 39 #include "content/common/java_bridge_messages.h"
39 #include "content/common/pepper_messages.h" 40 #include "content/common/pepper_messages.h"
40 #include "content/common/pepper_plugin_registry.h" 41 #include "content/common/pepper_plugin_registry.h"
41 #include "content/common/quota_dispatcher.h" 42 #include "content/common/quota_dispatcher.h"
42 #include "content/common/request_extra_data.h" 43 #include "content/common/request_extra_data.h"
43 #include "content/common/socket_stream_handle_data.h" 44 #include "content/common/socket_stream_handle_data.h"
44 #include "content/common/ssl_status_serialization.h" 45 #include "content/common/ssl_status_serialization.h"
45 #include "content/common/view_messages.h" 46 #include "content/common/view_messages.h"
46 #include "content/common/webmessageportchannel_impl.h" 47 #include "content/common/webmessageportchannel_impl.h"
47 #include "content/public/common/bindings_policy.h" 48 #include "content/public/common/bindings_policy.h"
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 994
994 ObserverListBase<RenderViewObserver>::Iterator it(observers_); 995 ObserverListBase<RenderViewObserver>::Iterator it(observers_);
995 RenderViewObserver* observer; 996 RenderViewObserver* observer;
996 while ((observer = it.GetNext()) != NULL) 997 while ((observer = it.GetNext()) != NULL)
997 if (observer->OnMessageReceived(message)) 998 if (observer->OnMessageReceived(message))
998 return true; 999 return true;
999 1000
1000 bool handled = true; 1001 bool handled = true;
1001 bool msg_is_ok = true; 1002 bool msg_is_ok = true;
1002 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewImpl, message, msg_is_ok) 1003 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewImpl, message, msg_is_ok)
1004 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy)
1005 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut)
1006 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete)
1007 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1008 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
1009 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste)
1010 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle)
1011 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo)
1012 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace)
1013 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling)
1014 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect,
1015 OnScrollFocusedEditableNodeIntoRect)
1016 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll)
1017 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange)
1018 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent,
1019 OnSetEditCommandsForNextKeyEvent)
1020 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo)
1021 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect)
1003 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) 1022 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate)
1004 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) 1023 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop)
1005 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) 1024 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame)
1006 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo)
1007 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo)
1008 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut)
1009 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy)
1010 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste)
1011 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle)
1012 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace)
1013 IPC_MESSAGE_HANDLER(ViewMsg_ReplaceMisspelling, OnReplaceMisspelling)
1014 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete)
1015 IPC_MESSAGE_HANDLER(ViewMsg_SetName, OnSetName) 1025 IPC_MESSAGE_HANDLER(ViewMsg_SetName, OnSetName)
1016 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll)
1017 IPC_MESSAGE_HANDLER(ViewMsg_Unselect, OnUnselect)
1018 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets, 1026 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets,
1019 OnSetEditableSelectionOffsets) 1027 OnSetEditableSelectionOffsets)
1020 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText, 1028 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText,
1021 OnSetCompositionFromExistingText) 1029 OnSetCompositionFromExistingText)
1022 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete, 1030 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete,
1023 OnExtendSelectionAndDelete) 1031 OnExtendSelectionAndDelete)
1024 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange)
1025 IPC_MESSAGE_HANDLER(ViewMsg_MoveCaret, OnMoveCaret)
1026 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) 1032 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
1027 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand)
1028 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) 1033 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
1029 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) 1034 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
1030 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) 1035 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
1031 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) 1036 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel)
1032 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) 1037 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor)
1033 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, 1038 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
1034 OnSetZoomLevelForLoadingURL) 1039 OnSetZoomLevelForLoadingURL)
1035 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) 1040 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
1036 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, 1041 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
1037 OnResetPageEncodingToDefault) 1042 OnResetPageEncodingToDefault)
1038 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) 1043 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest)
1039 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) 1044 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent)
1040 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) 1045 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest)
1041 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) 1046 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter)
1042 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) 1047 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver)
1043 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) 1048 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave)
1044 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) 1049 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop)
1045 IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved) 1050 IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved)
1046 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, 1051 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded,
1047 OnDragSourceSystemDragEnded) 1052 OnDragSourceSystemDragEnded)
1048 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) 1053 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings)
1049 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) 1054 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus)
1050 IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoRect,
1051 OnScrollFocusedEditableNodeIntoRect)
1052 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) 1055 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck)
1053 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) 1056 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences)
1054 IPC_MESSAGE_HANDLER(ViewMsg_TimezoneChange, OnUpdateTimezone) 1057 IPC_MESSAGE_HANDLER(ViewMsg_TimezoneChange, OnUpdateTimezone)
1055 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) 1058 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL)
1056 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, 1059 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse,
1057 OnEnumerateDirectoryResponse) 1060 OnEnumerateDirectoryResponse)
1058 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) 1061 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse)
1059 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) 1062 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose)
1060 IPC_MESSAGE_HANDLER(ViewMsg_SwapOut, OnSwapOut) 1063 IPC_MESSAGE_HANDLER(ViewMsg_SwapOut, OnSwapOut)
1061 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) 1064 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage)
1062 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) 1065 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged)
1063 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, 1066 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount,
1064 OnDisassociateFromPopupCount) 1067 OnDisassociateFromPopupCount)
1065 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) 1068 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted)
1066 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) 1069 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode)
1067 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) 1070 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground)
1068 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, 1071 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode,
1069 OnEnablePreferredSizeChangedMode) 1072 OnEnablePreferredSizeChangedMode)
1070 IPC_MESSAGE_HANDLER(ViewMsg_EnableAutoResize, OnEnableAutoResize) 1073 IPC_MESSAGE_HANDLER(ViewMsg_EnableAutoResize, OnEnableAutoResize)
1071 IPC_MESSAGE_HANDLER(ViewMsg_DisableAutoResize, OnDisableAutoResize) 1074 IPC_MESSAGE_HANDLER(ViewMsg_DisableAutoResize, OnDisableAutoResize)
1072 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, 1075 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows,
1073 OnDisableScrollbarsForSmallWindows) 1076 OnDisableScrollbarsForSmallWindows)
1074 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) 1077 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs)
1075 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) 1078 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt)
1076 IPC_MESSAGE_HANDLER(ViewMsg_OrientationChangeEvent, 1079 IPC_MESSAGE_HANDLER(ViewMsg_OrientationChangeEvent,
1077 OnOrientationChangeEvent) 1080 OnOrientationChangeEvent)
1078 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) 1081 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt)
1079 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) 1082 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive)
1080 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent,
1081 OnSetEditCommandsForNextKeyEvent)
1082 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, 1083 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction,
1083 OnCustomContextMenuAction) 1084 OnCustomContextMenuAction)
1084 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) 1085 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened)
1085 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, 1086 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated,
1086 OnPpapiBrokerChannelCreated) 1087 OnPpapiBrokerChannelCreated)
1087 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult, 1088 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult,
1088 OnPpapiBrokerPermissionResult) 1089 OnPpapiBrokerPermissionResult)
1089 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, 1090 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
1090 OnGetAllSavableResourceLinksForCurrentPage) 1091 OnGetAllSavableResourceLinksForCurrentPage)
1091 IPC_MESSAGE_HANDLER( 1092 IPC_MESSAGE_HANDLER(
1092 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, 1093 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks,
1093 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) 1094 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
1094 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) 1095 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed)
1095 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) 1096 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu)
1096 // TODO(viettrungluu): Move to a separate message filter. 1097 // TODO(viettrungluu): Move to a separate message filter.
1097 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, 1098 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune,
1098 OnSetHistoryLengthAndPrune) 1099 OnSetHistoryLengthAndPrune)
1099 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1100 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1100 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) 1101 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit)
1101 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) 1102 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode)
1102 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) 1103 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener)
1103 #if defined(OS_ANDROID) 1104 #if defined(OS_ANDROID)
1104 IPC_MESSAGE_HANDLER(ViewMsg_ActivateNearestFindResult, 1105 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1105 OnActivateNearestFindResult) 1106 OnActivateNearestFindResult)
1106 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) 1107 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects)
1107 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) 1108 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
1108 IPC_MESSAGE_HANDLER(ViewMsg_UndoScrollFocusedEditableNodeIntoView, 1109 IPC_MESSAGE_HANDLER(ViewMsg_UndoScrollFocusedEditableNodeIntoView,
1109 OnUndoScrollFocusedEditableNodeIntoRect) 1110 OnUndoScrollFocusedEditableNodeIntoRect)
1110 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, 1111 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState,
1111 OnUpdateTopControlsState) 1112 OnUpdateTopControlsState)
1112 #elif defined(OS_MACOSX) 1113 #elif defined(OS_MACOSX)
1113 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) 1114 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard)
1114 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, 1115 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted,
1115 OnPluginImeCompositionCompleted) 1116 OnPluginImeCompositionCompleted)
1116 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 1117 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
1117 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 1118 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
1118 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) 1119 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility)
1119 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) 1120 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged)
1120 #endif 1121 #endif
1121 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB, 1122 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB,
1122 OnReleaseDisambiguationPopupDIB) 1123 OnReleaseDisambiguationPopupDIB)
1123 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, 1124 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 // TODO(evanm): perhaps we could allow shift-clicking the menu item to do 1354 // TODO(evanm): perhaps we could allow shift-clicking the menu item to do
1354 // a cache-ignoring reload of the frame. 1355 // a cache-ignoring reload of the frame.
1355 webview()->focusedFrame()->reload(false); 1356 webview()->focusedFrame()->reload(false);
1356 } 1357 }
1357 } 1358 }
1358 1359
1359 void RenderViewImpl::OnCopyImageAt(int x, int y) { 1360 void RenderViewImpl::OnCopyImageAt(int x, int y) {
1360 webview()->copyImageAt(WebPoint(x, y)); 1361 webview()->copyImageAt(WebPoint(x, y));
1361 } 1362 }
1362 1363
1363 void RenderViewImpl::OnExecuteEditCommand(const std::string& name,
1364 const std::string& value) {
1365 if (!webview() || !webview()->focusedFrame())
1366 return;
1367
1368 webview()->focusedFrame()->executeCommand(
1369 WebString::fromUTF8(name), WebString::fromUTF8(value));
1370 }
1371
1372 void RenderViewImpl::OnUpdateTargetURLAck() { 1364 void RenderViewImpl::OnUpdateTargetURLAck() {
1373 // Check if there is a targeturl waiting to be sent. 1365 // Check if there is a targeturl waiting to be sent.
1374 if (target_url_status_ == TARGET_PENDING) { 1366 if (target_url_status_ == TARGET_PENDING) {
1375 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, 1367 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_,
1376 pending_target_url_)); 1368 pending_target_url_));
1377 } 1369 }
1378 1370
1379 target_url_status_ = TARGET_NONE; 1371 target_url_status_ = TARGET_NONE;
1380 } 1372 }
1381 1373
1382 void RenderViewImpl::OnUndo() {
1383 if (!webview())
1384 return;
1385
1386 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Undo"));
1387 }
1388
1389 void RenderViewImpl::OnRedo() {
1390 if (!webview())
1391 return;
1392
1393 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Redo"));
1394 }
1395
1396 void RenderViewImpl::OnCut() {
1397 if (!webview())
1398 return;
1399
1400 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1401 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Cut"));
1402 }
1403
1404 void RenderViewImpl::OnCopy() { 1374 void RenderViewImpl::OnCopy() {
1405 if (!webview()) 1375 if (!webview())
1406 return; 1376 return;
1407 1377
1408 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1378 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1409 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy"), 1379 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy"),
1410 context_menu_node_); 1380 context_menu_node_);
1411 } 1381 }
1412 1382
1413 #if defined(OS_MACOSX) 1383 void RenderViewImpl::OnCut() {
1414 void RenderViewImpl::OnCopyToFindPboard() {
1415 if (!webview()) 1384 if (!webview())
1416 return; 1385 return;
1417 1386
1418 // Since the find pasteboard supports only plain text, this can be simpler 1387 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1419 // than the |OnCopy()| case. 1388 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Cut"));
1420 WebFrame* frame = webview()->focusedFrame();
1421 if (frame->hasSelection()) {
1422 string16 selection = frame->selectionAsText();
1423 RenderThread::Get()->Send(
1424 new ClipboardHostMsg_FindPboardWriteStringAsync(selection));
1425 }
1426 } 1389 }
1427 #endif 1390
1391 void RenderViewImpl::OnDelete() {
1392 if (!webview())
1393 return;
1394
1395 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete"));
1396 }
1397
1398 void RenderViewImpl::OnExecuteEditCommand(const std::string& name,
1399 const std::string& value) {
1400 if (!webview() || !webview()->focusedFrame())
1401 return;
1402
1403 webview()->focusedFrame()->executeCommand(
1404 WebString::fromUTF8(name), WebString::fromUTF8(value));
1405 }
1406
1407 void RenderViewImpl::OnMoveCaret(const gfx::Point& point) {
1408 if (!webview())
1409 return;
1410
1411 Send(new ViewHostMsg_MoveCaret_ACK(routing_id_));
1412
1413 webview()->focusedFrame()->moveCaretSelectionTowardsWindowPoint(point);
1414 }
1428 1415
1429 void RenderViewImpl::OnPaste() { 1416 void RenderViewImpl::OnPaste() {
1430 if (!webview()) 1417 if (!webview())
1431 return; 1418 return;
1432 1419
1433 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1420 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1434 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste")); 1421 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste"));
1435 } 1422 }
1436 1423
1437 void RenderViewImpl::OnPasteAndMatchStyle() { 1424 void RenderViewImpl::OnPasteAndMatchStyle() {
1438 if (!webview()) 1425 if (!webview())
1439 return; 1426 return;
1440 1427
1441 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1428 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1442 webview()->focusedFrame()->executeCommand( 1429 webview()->focusedFrame()->executeCommand(
1443 WebString::fromUTF8("PasteAndMatchStyle")); 1430 WebString::fromUTF8("PasteAndMatchStyle"));
1444 } 1431 }
1445 1432
1433 void RenderViewImpl::OnRedo() {
1434 if (!webview())
1435 return;
1436
1437 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Redo"));
1438 }
1439
1446 void RenderViewImpl::OnReplace(const string16& text) { 1440 void RenderViewImpl::OnReplace(const string16& text) {
1447 if (!webview()) 1441 if (!webview())
1448 return; 1442 return;
1449 1443
1450 WebFrame* frame = webview()->focusedFrame(); 1444 WebFrame* frame = webview()->focusedFrame();
1451 if (!frame->hasSelection()) 1445 if (!frame->hasSelection())
1452 frame->selectWordAroundCaret(); 1446 frame->selectWordAroundCaret();
1453 1447
1454 frame->replaceSelection(text); 1448 frame->replaceSelection(text);
1455 } 1449 }
1456 1450
1457 void RenderViewImpl::OnReplaceMisspelling(const string16& text) { 1451 void RenderViewImpl::OnReplaceMisspelling(const string16& text) {
1458 if (!webview()) 1452 if (!webview())
1459 return; 1453 return;
1460 1454
1461 WebFrame* frame = webview()->focusedFrame(); 1455 WebFrame* frame = webview()->focusedFrame();
1462 if (!frame->hasSelection()) 1456 if (!frame->hasSelection())
1463 return; 1457 return;
1464 1458
1465 frame->replaceMisspelledRange(text); 1459 frame->replaceMisspelledRange(text);
1466 } 1460 }
1467 1461
1468 void RenderViewImpl::OnDelete() { 1462 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect(
1469 if (!webview()) 1463 const gfx::Rect& rect) {
1470 return; 1464 WebKit::WebNode node = GetFocusedNode();
1471 1465 if (!node.isNull()) {
1472 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete")); 1466 if (IsEditableNode(node)) {
1473 } 1467 webview()->saveScrollAndScaleState();
1474 1468 webview()->scrollFocusedNodeIntoRect(rect);
1475 void RenderViewImpl::OnSetName(const std::string& name) { 1469 }
1476 if (!webview()) 1470 }
1477 return;
1478
1479 webview()->mainFrame()->setName(WebString::fromUTF8(name));
1480 } 1471 }
1481 1472
1482 void RenderViewImpl::OnSelectAll() { 1473 void RenderViewImpl::OnSelectAll() {
1483 if (!webview()) 1474 if (!webview())
1484 return; 1475 return;
1485 1476
1486 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1477 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1487 webview()->focusedFrame()->executeCommand( 1478 webview()->focusedFrame()->executeCommand(
1488 WebString::fromUTF8("SelectAll")); 1479 WebString::fromUTF8("SelectAll"));
1489 } 1480 }
1490 1481
1482 void RenderViewImpl::OnSelectRange(const gfx::Point& start,
1483 const gfx::Point& end) {
1484 if (!webview())
1485 return;
1486
1487 Send(new ViewHostMsg_SelectRange_ACK(routing_id_));
1488
1489 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1490 webview()->focusedFrame()->selectRange(start, end);
1491 }
1492
1493 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent(
1494 const EditCommands& edit_commands) {
1495 edit_commands_ = edit_commands;
1496 }
1497
1498 void RenderViewImpl::OnUndo() {
1499 if (!webview())
1500 return;
1501
1502 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Undo"));
1503 }
1504
1491 void RenderViewImpl::OnUnselect() { 1505 void RenderViewImpl::OnUnselect() {
1492 if (!webview()) 1506 if (!webview())
1493 return; 1507 return;
1494 1508
1495 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1509 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1496 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); 1510 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect"));
1497 } 1511 }
1498 1512
1513 #if defined(OS_MACOSX)
1514 void RenderViewImpl::OnCopyToFindPboard() {
1515 if (!webview())
1516 return;
1517
1518 // Since the find pasteboard supports only plain text, this can be simpler
1519 // than the |OnCopy()| case.
1520 WebFrame* frame = webview()->focusedFrame();
1521 if (frame->hasSelection()) {
1522 string16 selection = frame->selectionAsText();
1523 RenderThread::Get()->Send(
1524 new ClipboardHostMsg_FindPboardWriteStringAsync(selection));
1525 }
1526 }
1527 #endif
1528
1529 void RenderViewImpl::OnSetName(const std::string& name) {
1530 if (!webview())
1531 return;
1532
1533 webview()->mainFrame()->setName(WebString::fromUTF8(name));
1534 }
1535
1499 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) { 1536 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) {
1500 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1537 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1501 DCHECK(!handling_ime_event_); 1538 DCHECK(!handling_ime_event_);
1502 handling_ime_event_ = true; 1539 handling_ime_event_ = true;
1503 webview()->setEditableSelectionOffsets(start, end); 1540 webview()->setEditableSelectionOffsets(start, end);
1504 handling_ime_event_ = false; 1541 handling_ime_event_ = false;
1505 UpdateTextInputState(DO_NOT_SHOW_IME); 1542 UpdateTextInputState(DO_NOT_SHOW_IME);
1506 } 1543 }
1507 1544
1508 void RenderViewImpl::OnSetCompositionFromExistingText( 1545 void RenderViewImpl::OnSetCompositionFromExistingText(
(...skipping 11 matching lines...) Expand all
1520 void RenderViewImpl::OnExtendSelectionAndDelete(int before, int after) { 1557 void RenderViewImpl::OnExtendSelectionAndDelete(int before, int after) {
1521 if (!webview()) 1558 if (!webview())
1522 return; 1559 return;
1523 DCHECK(!handling_ime_event_); 1560 DCHECK(!handling_ime_event_);
1524 handling_ime_event_ = true; 1561 handling_ime_event_ = true;
1525 webview()->extendSelectionAndDelete(before, after); 1562 webview()->extendSelectionAndDelete(before, after);
1526 handling_ime_event_ = false; 1563 handling_ime_event_ = false;
1527 UpdateTextInputState(DO_NOT_SHOW_IME); 1564 UpdateTextInputState(DO_NOT_SHOW_IME);
1528 } 1565 }
1529 1566
1530 void RenderViewImpl::OnSelectRange(const gfx::Point& start,
1531 const gfx::Point& end) {
1532 if (!webview())
1533 return;
1534
1535 Send(new ViewHostMsg_SelectRange_ACK(routing_id_));
1536
1537 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1538 webview()->focusedFrame()->selectRange(start, end);
1539 }
1540
1541 void RenderViewImpl::OnMoveCaret(const gfx::Point& point) {
1542 if (!webview())
1543 return;
1544
1545 Send(new ViewHostMsg_MoveCaret_ACK(routing_id_));
1546
1547 webview()->focusedFrame()->moveCaretSelectionTowardsWindowPoint(point);
1548 }
1549
1550 void RenderViewImpl::OnSetHistoryLengthAndPrune(int history_length, 1567 void RenderViewImpl::OnSetHistoryLengthAndPrune(int history_length,
1551 int32 minimum_page_id) { 1568 int32 minimum_page_id) {
1552 DCHECK_GE(history_length, 0); 1569 DCHECK_GE(history_length, 0);
1553 DCHECK(history_list_offset_ == history_list_length_ - 1); 1570 DCHECK(history_list_offset_ == history_list_length_ - 1);
1554 DCHECK_GE(minimum_page_id, -1); 1571 DCHECK_GE(minimum_page_id, -1);
1555 1572
1556 // Generate the new list. 1573 // Generate the new list.
1557 std::vector<int32> new_history_page_ids(history_length, -1); 1574 std::vector<int32> new_history_page_ids(history_length, -1);
1558 for (size_t i = 0; i < history_page_ids_.size(); ++i) { 1575 for (size_t i = 0; i < history_page_ids_.size(); ++i) {
1559 if (minimum_page_id >= 0 && history_page_ids_[i] < minimum_page_id) 1576 if (minimum_page_id >= 0 && history_page_ids_[i] < minimum_page_id)
(...skipping 18 matching lines...) Expand all
1578 void RenderViewImpl::OnSetInLiveResize(bool in_live_resize) { 1595 void RenderViewImpl::OnSetInLiveResize(bool in_live_resize) {
1579 if (!webview()) 1596 if (!webview())
1580 return; 1597 return;
1581 if (in_live_resize) 1598 if (in_live_resize)
1582 webview()->willStartLiveResize(); 1599 webview()->willStartLiveResize();
1583 else 1600 else
1584 webview()->willEndLiveResize(); 1601 webview()->willEndLiveResize();
1585 } 1602 }
1586 #endif 1603 #endif
1587 1604
1588 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect(
1589 const gfx::Rect& rect) {
1590 WebKit::WebNode node = GetFocusedNode();
1591 if (!node.isNull()) {
1592 if (IsEditableNode(node)) {
1593 webview()->saveScrollAndScaleState();
1594 webview()->scrollFocusedNodeIntoRect(rect);
1595 }
1596 }
1597 }
1598
1599 #if defined(OS_ANDROID) 1605 #if defined(OS_ANDROID)
1600 void RenderViewImpl::OnUndoScrollFocusedEditableNodeIntoRect() { 1606 void RenderViewImpl::OnUndoScrollFocusedEditableNodeIntoRect() {
1601 const WebNode node = GetFocusedNode(); 1607 const WebNode node = GetFocusedNode();
1602 if (!node.isNull() && IsEditableNode(node)) 1608 if (!node.isNull() && IsEditableNode(node))
1603 webview()->restoreScrollAndScaleState(); 1609 webview()->restoreScrollAndScaleState();
1604 } 1610 }
1605 #endif 1611 #endif
1606 1612
1607 /////////////////////////////////////////////////////////////////////////////// 1613 ///////////////////////////////////////////////////////////////////////////////
1608 1614
(...skipping 4092 matching lines...) Expand 10 before | Expand all | Expand 10 after
5701 // WebPluginDelegateProxy is responsible for figuring out if this event 5707 // WebPluginDelegateProxy is responsible for figuring out if this event
5702 // applies to it or not, so inform all the delegates. 5708 // applies to it or not, so inform all the delegates.
5703 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 5709 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
5704 for (plugin_it = plugin_delegates_.begin(); 5710 for (plugin_it = plugin_delegates_.begin();
5705 plugin_it != plugin_delegates_.end(); ++plugin_it) { 5711 plugin_it != plugin_delegates_.end(); ++plugin_it) {
5706 (*plugin_it)->ImeCompositionCompleted(text, plugin_id); 5712 (*plugin_it)->ImeCompositionCompleted(text, plugin_id);
5707 } 5713 }
5708 } 5714 }
5709 #endif // OS_MACOSX 5715 #endif // OS_MACOSX
5710 5716
5711 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent(
5712 const EditCommands& edit_commands) {
5713 edit_commands_ = edit_commands;
5714 }
5715
5716 void RenderViewImpl::Close() { 5717 void RenderViewImpl::Close() {
5717 // We need to grab a pointer to the doomed WebView before we destroy it. 5718 // We need to grab a pointer to the doomed WebView before we destroy it.
5718 WebView* doomed = webview(); 5719 WebView* doomed = webview();
5719 RenderWidget::Close(); 5720 RenderWidget::Close();
5720 g_view_map.Get().erase(doomed); 5721 g_view_map.Get().erase(doomed);
5721 g_routing_id_view_map.Get().erase(routing_id_); 5722 g_routing_id_view_map.Get().erase(routing_id_);
5722 } 5723 }
5723 5724
5724 void RenderViewImpl::DidHandleKeyEvent() { 5725 void RenderViewImpl::DidHandleKeyEvent() {
5725 ClearEditCommands(); 5726 ClearEditCommands();
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
6503 WebURL url = icon_urls[i].iconURL(); 6504 WebURL url = icon_urls[i].iconURL();
6504 if (!url.isEmpty()) 6505 if (!url.isEmpty())
6505 urls.push_back(FaviconURL(url, 6506 urls.push_back(FaviconURL(url,
6506 ToFaviconType(icon_urls[i].iconType()))); 6507 ToFaviconType(icon_urls[i].iconType())));
6507 } 6508 }
6508 SendUpdateFaviconURL(urls); 6509 SendUpdateFaviconURL(urls);
6509 } 6510 }
6510 6511
6511 6512
6512 } // namespace content 6513 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698