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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 // TODO(viettrungluu): Move to a separate message filter. | 1127 // TODO(viettrungluu): Move to a separate message filter. |
1128 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 1128 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
1129 OnSetHistoryLengthAndPrune) | 1129 OnSetHistoryLengthAndPrune) |
1130 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1130 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1131 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) | 1131 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) |
1132 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) | 1132 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) |
1133 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, | 1133 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, |
1134 OnReleaseDisambiguationPopupBitmap) | 1134 OnReleaseDisambiguationPopupBitmap) |
1135 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, | 1135 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, |
1136 OnWindowSnapshotCompleted) | 1136 OnWindowSnapshotCompleted) |
| 1137 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) |
1137 #if defined(OS_ANDROID) | 1138 #if defined(OS_ANDROID) |
1138 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, | 1139 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, |
1139 OnActivateNearestFindResult) | 1140 OnActivateNearestFindResult) |
1140 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) | 1141 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) |
1141 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1142 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1142 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, | 1143 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, |
1143 OnUpdateTopControlsState) | 1144 OnUpdateTopControlsState) |
1144 IPC_MESSAGE_HANDLER(ViewMsg_PauseVideo, OnPauseVideo) | 1145 IPC_MESSAGE_HANDLER(ViewMsg_PauseVideo, OnPauseVideo) |
1145 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) | 1146 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) |
1146 #elif defined(OS_MACOSX) | 1147 #elif defined(OS_MACOSX) |
(...skipping 13 matching lines...) Expand all Loading... |
1160 | 1161 |
1161 if (!msg_is_ok) { | 1162 if (!msg_is_ok) { |
1162 // The message had a handler, but its deserialization failed. | 1163 // The message had a handler, but its deserialization failed. |
1163 // Kill the renderer to avoid potential spoofing attacks. | 1164 // Kill the renderer to avoid potential spoofing attacks. |
1164 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | 1165 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
1165 } | 1166 } |
1166 | 1167 |
1167 return handled; | 1168 return handled; |
1168 } | 1169 } |
1169 | 1170 |
| 1171 void RenderViewImpl::OnSelectWordAroundCaret() { |
| 1172 if (!webview()) |
| 1173 return; |
| 1174 |
| 1175 handling_input_event_ = true; |
| 1176 webview()->focusedFrame()->selectWordAroundCaret(); |
| 1177 handling_input_event_ = false; |
| 1178 } |
| 1179 |
1170 void RenderViewImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { | 1180 void RenderViewImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
1171 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); | 1181 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); |
1172 } | 1182 } |
1173 | 1183 |
1174 bool RenderViewImpl::IsBackForwardToStaleEntry( | 1184 bool RenderViewImpl::IsBackForwardToStaleEntry( |
1175 const FrameMsg_Navigate_Params& params, | 1185 const FrameMsg_Navigate_Params& params, |
1176 bool is_reload) { | 1186 bool is_reload) { |
1177 // Make sure this isn't a back/forward to an entry we have already cropped | 1187 // Make sure this isn't a back/forward to an entry we have already cropped |
1178 // or replaced from our history, before the browser knew about it. If so, | 1188 // or replaced from our history, before the browser knew about it. If so, |
1179 // a new navigation has committed in the mean time, and we can ignore this. | 1189 // a new navigation has committed in the mean time, and we can ignore this. |
(...skipping 2968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4148 std::vector<gfx::Size> sizes; | 4158 std::vector<gfx::Size> sizes; |
4149 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4159 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4150 if (!url.isEmpty()) | 4160 if (!url.isEmpty()) |
4151 urls.push_back( | 4161 urls.push_back( |
4152 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4162 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4153 } | 4163 } |
4154 SendUpdateFaviconURL(urls); | 4164 SendUpdateFaviconURL(urls); |
4155 } | 4165 } |
4156 | 4166 |
4157 } // namespace content | 4167 } // namespace content |
OLD | NEW |