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

Side by Side Diff: ui/events/android/drag_event_android.cc

Issue 2896993002: Route OnDragEvent through ViewAndroid tree (Closed)
Patch Set: +ui/base Created 3 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
« no previous file with comments | « ui/events/android/drag_event_android.h ('k') | ui/events/android/motion_event_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/events/android/drag_event_android.h"
6 #include "base/android/jni_android.h"
7
8 using base::android::ScopedJavaLocalRef;
9 using base::android::AttachCurrentThread;
10
11 namespace ui {
12
13 DragEventAndroid::DragEventAndroid(
14 JNIEnv* env,
15 int action,
16 const gfx::PointF& location,
17 const gfx::PointF& screen_location,
18 const std::vector<base::string16>& mime_types,
19 jstring content)
20 : action_(action),
21 location_(location),
22 screen_location_(screen_location),
23 mime_types_(mime_types) {
24 content_.Reset(env, content);
25 }
26
27 DragEventAndroid::~DragEventAndroid() {}
28
29 const gfx::Point DragEventAndroid::GetLocation() const {
30 return gfx::ToFlooredPoint(location_);
31 }
32
33 const gfx::Point DragEventAndroid::GetScreenLocation() const {
34 return gfx::ToFlooredPoint(screen_location_);
35 }
36
37 ScopedJavaLocalRef<jstring> DragEventAndroid::GetJavaContent() const {
38 return ScopedJavaLocalRef<jstring>(content_);
39 }
40
41 std::unique_ptr<DragEventAndroid> DragEventAndroid::CreateFor(
42 const gfx::PointF& new_location) const {
43 gfx::PointF new_screen_location =
44 new_location + (screen_location_f() - location_f());
45 JNIEnv* env = AttachCurrentThread();
46 return std::unique_ptr<DragEventAndroid>(
47 new DragEventAndroid(env, action_, new_location, new_screen_location,
48 mime_types_, content_.obj()));
49 }
50
51 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/android/drag_event_android.h ('k') | ui/events/android/motion_event_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698