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

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

Issue 2703643004: [TTS] Add an ACK message to SelectWordAroundCaret. (Closed)
Patch Set: Clean up the logic in render_view_impl.cc Created 3 years, 10 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 #include <memory> 9 #include <memory>
10 10
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 IPC_END_MESSAGE_MAP() 1287 IPC_END_MESSAGE_MAP()
1288 1288
1289 return handled; 1289 return handled;
1290 } 1290 }
1291 1291
1292 void RenderViewImpl::OnSelectWordAroundCaret() { 1292 void RenderViewImpl::OnSelectWordAroundCaret() {
1293 if (!webview()) 1293 if (!webview())
1294 return; 1294 return;
1295 1295
1296 input_handler_->set_handling_input_event(true); 1296 input_handler_->set_handling_input_event(true);
1297 #if defined(OS_ANDROID)
1298 int start_adjust = 0;
1299 int end_adjust = 0;
1300 blink::WebRange initial_range = webview()->focusedFrame()->selectionRange();
1301 bool did_select = webview()->focusedFrame()->selectWordAroundCaret();
1302 if (did_select) {
1303 blink::WebRange adjusted_range =
1304 webview()->focusedFrame()->selectionRange();
1305 start_adjust = adjusted_range.startOffset() - initial_range.startOffset();
1306 end_adjust = adjusted_range.endOffset() - initial_range.endOffset();
1307 }
1308 Send(new ViewHostMsg_SelectWordAroundCaret_ACK(GetRoutingID(), did_select,
1309 start_adjust, end_adjust));
1310 #else
1297 webview()->focusedFrame()->selectWordAroundCaret(); 1311 webview()->focusedFrame()->selectWordAroundCaret();
1312 #endif
1298 input_handler_->set_handling_input_event(false); 1313 input_handler_->set_handling_input_event(false);
1299 } 1314 }
1300 1315
1301 void RenderViewImpl::OnUpdateTargetURLAck() { 1316 void RenderViewImpl::OnUpdateTargetURLAck() {
1302 // Check if there is a targeturl waiting to be sent. 1317 // Check if there is a targeturl waiting to be sent.
1303 if (target_url_status_ == TARGET_PENDING) 1318 if (target_url_status_ == TARGET_PENDING)
1304 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); 1319 Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_));
1305 1320
1306 target_url_status_ = TARGET_NONE; 1321 target_url_status_ = TARGET_NONE;
1307 } 1322 }
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 2735 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
2721 } 2736 }
2722 2737
2723 std::unique_ptr<InputEventAck> ack( 2738 std::unique_ptr<InputEventAck> ack(
2724 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), 2739 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(),
2725 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); 2740 INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
2726 OnInputEventAck(std::move(ack)); 2741 OnInputEventAck(std::move(ack));
2727 } 2742 }
2728 2743
2729 } // namespace content 2744 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698