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

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

Issue 2703643004: [TTS] Add an ACK message to SelectWordAroundCaret. (Closed)
Patch Set: Update the other test in ContextualSearchTapEventTest.java to know about the ACK. Created 3 years, 7 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
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/SmartSelectionClient.java ('k') | no next file » | 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 #include <memory> 9 #include <memory>
10 10
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 // platform specific ones at the end. 1266 // platform specific ones at the end.
1267 1267
1268 // Have the super handle all other messages. 1268 // Have the super handle all other messages.
1269 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) 1269 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message))
1270 IPC_END_MESSAGE_MAP() 1270 IPC_END_MESSAGE_MAP()
1271 1271
1272 return handled; 1272 return handled;
1273 } 1273 }
1274 1274
1275 void RenderViewImpl::OnSelectWordAroundCaret() { 1275 void RenderViewImpl::OnSelectWordAroundCaret() {
1276 if (!webview()) 1276 // Set default values for the ACK
1277 return; 1277 bool did_select = false;
1278 int start_adjust = 0;
1279 int end_adjust = 0;
1278 1280
1279 input_handler_->set_handling_input_event(true); 1281 if (webview()) {
1280 webview()->FocusedFrame()->SelectWordAroundCaret(); 1282 WebLocalFrame* focused_frame = GetWebView()->FocusedFrame();
1281 input_handler_->set_handling_input_event(false); 1283 if (focused_frame) {
1284 input_handler_->set_handling_input_event(true);
1285 blink::WebRange initial_range = focused_frame->SelectionRange();
1286 did_select = focused_frame->SelectWordAroundCaret();
1287 if (did_select) {
1288 blink::WebRange adjusted_range = focused_frame->SelectionRange();
1289 start_adjust =
1290 adjusted_range.StartOffset() - initial_range.StartOffset();
1291 end_adjust = adjusted_range.EndOffset() - initial_range.EndOffset();
1292 }
1293 input_handler_->set_handling_input_event(false);
1294 }
1295 }
1296 Send(new ViewHostMsg_SelectWordAroundCaretAck(GetRoutingID(), did_select,
1297 start_adjust, end_adjust));
1282 } 1298 }
1283 1299
1284 void RenderViewImpl::OnUpdateTargetURLAck() { 1300 void RenderViewImpl::OnUpdateTargetURLAck() {
1285 // Check if there is a targeturl waiting to be sent. 1301 // Check if there is a targeturl waiting to be sent.
1286 if (target_url_status_ == TARGET_PENDING) 1302 if (target_url_status_ == TARGET_PENDING)
1287 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); 1303 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_));
1288 1304
1289 target_url_status_ = TARGET_NONE; 1305 target_url_status_ = TARGET_NONE;
1290 } 1306 }
1291 1307
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2658 input_event.GetCoalescedEventsPointers(), latency_info, 2674 input_event.GetCoalescedEventsPointers(), latency_info,
2659 dispatch_type); 2675 dispatch_type);
2660 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 2676 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
2661 } 2677 }
2662 idle_user_detector_->ActivityDetected(); 2678 idle_user_detector_->ActivityDetected();
2663 return RenderWidget::HandleInputEvent(input_event, latency_info, 2679 return RenderWidget::HandleInputEvent(input_event, latency_info,
2664 dispatch_type); 2680 dispatch_type);
2665 } 2681 }
2666 2682
2667 } // namespace content 2683 } // namespace content
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/SmartSelectionClient.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698