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

Side by Side Diff: content/browser/renderer_host/input/motion_event_android.cc

Issue 342633003: [Android] Select text when stylus first button is pressed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/renderer_host/input/motion_event_android.h" 5 #include "content/browser/renderer_host/input/motion_event_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "jni/MotionEvent_jni.h" 8 #include "jni/MotionEvent_jni.h"
9 9
10 using base::android::AttachCurrentThread; 10 using base::android::AttachCurrentThread;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 return ToDips(Java_MotionEvent_getHistoricalXF_I_I( 251 return ToDips(Java_MotionEvent_getHistoricalXF_I_I(
252 AttachCurrentThread(), event_.obj(), pointer_index, historical_index)); 252 AttachCurrentThread(), event_.obj(), pointer_index, historical_index));
253 } 253 }
254 254
255 float MotionEventAndroid::GetHistoricalY(size_t pointer_index, 255 float MotionEventAndroid::GetHistoricalY(size_t pointer_index,
256 size_t historical_index) const { 256 size_t historical_index) const {
257 return ToDips(Java_MotionEvent_getHistoricalYF_I_I( 257 return ToDips(Java_MotionEvent_getHistoricalYF_I_I(
258 AttachCurrentThread(), event_.obj(), pointer_index, historical_index)); 258 AttachCurrentThread(), event_.obj(), pointer_index, historical_index));
259 } 259 }
260 260
261 int MotionEventAndroid::GetSource() const {
262 return Java_MotionEvent_getSource(AttachCurrentThread(), event_.obj());
263 }
264
265 int MotionEventAndroid::GetButtonState() const {
266 return Java_MotionEvent_getButtonState(AttachCurrentThread(), event_.obj());
267 }
268
261 scoped_ptr<ui::MotionEvent> MotionEventAndroid::Clone() const { 269 scoped_ptr<ui::MotionEvent> MotionEventAndroid::Clone() const {
262 return scoped_ptr<MotionEvent>(new MotionEventAndroid(*this)); 270 return scoped_ptr<MotionEvent>(new MotionEventAndroid(*this));
263 } 271 }
264 272
265 scoped_ptr<ui::MotionEvent> MotionEventAndroid::Cancel() const { 273 scoped_ptr<ui::MotionEvent> MotionEventAndroid::Cancel() const {
266 // The input coordinates to |MotionEventAndroid| are always in device pixels, 274 // The input coordinates to |MotionEventAndroid| are always in device pixels,
267 // but the cached coordinates are in DIPs. 275 // but the cached coordinates are in DIPs.
268 const gfx::PointF position_pixels = 276 const gfx::PointF position_pixels =
269 gfx::ScalePoint(cached_positions_[0], 1.f / pix_to_dip_); 277 gfx::ScalePoint(cached_positions_[0], 1.f / pix_to_dip_);
270 return scoped_ptr<MotionEvent>( 278 return scoped_ptr<MotionEvent>(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 return Java_MotionEvent_obtainAVME_J_J_I_F_F_I(AttachCurrentThread(), 329 return Java_MotionEvent_obtainAVME_J_J_I_F_F_I(AttachCurrentThread(),
322 ToAndroidTime(down_time), 330 ToAndroidTime(down_time),
323 ToAndroidTime(event_time), 331 ToAndroidTime(event_time),
324 ToAndroidAction(action), 332 ToAndroidAction(action),
325 x_pixels, 333 x_pixels,
326 y_pixels, 334 y_pixels,
327 0); 335 0);
328 } 336 }
329 337
330 } // namespace content 338 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698