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

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

Issue 1205033005: Adds selection expansion support for Contextual Search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) 1347 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
1348 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) 1348 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu)
1349 // TODO(viettrungluu): Move to a separate message filter. 1349 // TODO(viettrungluu): Move to a separate message filter.
1350 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength, 1350 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength,
1351 OnSetHistoryOffsetAndLength) 1351 OnSetHistoryOffsetAndLength)
1352 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1352 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1353 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, 1353 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap,
1354 OnReleaseDisambiguationPopupBitmap) 1354 OnReleaseDisambiguationPopupBitmap)
1355 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw) 1355 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw)
1356 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) 1356 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret)
1357 IPC_MESSAGE_HANDLER(ViewMsg_MoveSelectionByCharacterOffset,
1358 OnMoveSelectionByCharacterOffset)
1357 #if defined(OS_ANDROID) 1359 #if defined(OS_ANDROID)
1358 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1360 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1359 OnActivateNearestFindResult) 1361 OnActivateNearestFindResult)
1360 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) 1362 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects)
1361 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, 1363 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState,
1362 OnUpdateTopControlsState) 1364 OnUpdateTopControlsState)
1363 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) 1365 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData)
1364 #elif defined(OS_MACOSX) 1366 #elif defined(OS_MACOSX)
1365 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, 1367 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText,
1366 OnGetRenderedText) 1368 OnGetRenderedText)
(...skipping 16 matching lines...) Expand all
1383 1385
1384 void RenderViewImpl::OnSelectWordAroundCaret() { 1386 void RenderViewImpl::OnSelectWordAroundCaret() {
1385 if (!webview()) 1387 if (!webview())
1386 return; 1388 return;
1387 1389
1388 handling_input_event_ = true; 1390 handling_input_event_ = true;
1389 webview()->focusedFrame()->selectWordAroundCaret(); 1391 webview()->focusedFrame()->selectWordAroundCaret();
1390 handling_input_event_ = false; 1392 handling_input_event_ = false;
1391 } 1393 }
1392 1394
1395 void RenderViewImpl::OnMoveSelectionByCharacterOffset(int start_adjust,
1396 int end_adjust) {
1397 if (!webview())
1398 return;
1399
1400 handling_input_event_ = true;
1401 size_t start, length;
1402 if (webview()->caretOrSelectionRange(&start, &length)) {
1403 start += start_adjust;
1404 length += end_adjust - start_adjust;
David Trainor- moved to gerrit 2015/06/25 00:34:55 Do some checks on this stuff to make sure these va
1405 WebLocalFrame* web_local_frame =
1406 webview()->focusedFrame()->toWebLocalFrame();
1407 web_local_frame->selectRange(WebRange::fromDocumentRange(web_local_frame,
1408 start,
1409 length));
1410 }
1411 handling_input_event_ = false;
1412 }
1413
1393 void RenderViewImpl::OnCopyImageAt(int x, int y) { 1414 void RenderViewImpl::OnCopyImageAt(int x, int y) {
1394 webview()->copyImageAt(WebPoint(x, y)); 1415 webview()->copyImageAt(WebPoint(x, y));
1395 } 1416 }
1396 1417
1397 void RenderViewImpl::OnSaveImageAt(int x, int y) { 1418 void RenderViewImpl::OnSaveImageAt(int x, int y) {
1398 webview()->saveImageAt(WebPoint(x, y)); 1419 webview()->saveImageAt(WebPoint(x, y));
1399 } 1420 }
1400 1421
1401 void RenderViewImpl::OnUpdateTargetURLAck() { 1422 void RenderViewImpl::OnUpdateTargetURLAck() {
1402 // Check if there is a targeturl waiting to be sent. 1423 // Check if there is a targeturl waiting to be sent.
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
3794 std::vector<gfx::Size> sizes; 3815 std::vector<gfx::Size> sizes;
3795 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3816 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3796 if (!url.isEmpty()) 3817 if (!url.isEmpty())
3797 urls.push_back( 3818 urls.push_back(
3798 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3819 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3799 } 3820 }
3800 SendUpdateFaviconURL(urls); 3821 SendUpdateFaviconURL(urls);
3801 } 3822 }
3802 3823
3803 } // namespace content 3824 } // namespace content
OLDNEW
« content/browser/renderer_host/render_view_host_impl.h ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698