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

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

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/BUILD.gn ('k') | ui/events/android/drag_event_android.cc » ('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 #ifndef UI_EVENTS_ANDROID_DRAG_EVENT_ANDROID_H_
6 #define UI_EVENTS_ANDROID_DRAG_EVENT_ANDROID_H_
7
8 #include <jni.h>
9 #include <vector>
10
11 #include "base/android/scoped_java_ref.h"
12 #include "base/macros.h"
13 #include "base/strings/string16.h"
14 #include "ui/events/events_export.h"
15 #include "ui/gfx/geometry/point_conversions.h"
16
17 namespace gfx {
18 class PointF;
19 }
20
21 namespace ui {
22
23 // Event class used to carry the info from Java DragEvent through native.
24 // All coordinates are in DIPs.
25 class EVENTS_EXPORT DragEventAndroid {
26 public:
27 DragEventAndroid(JNIEnv* env,
28 int action,
29 const gfx::PointF& location,
30 const gfx::PointF& screen_location,
31 const std::vector<base::string16>& mime_types,
32 jstring content);
33 ~DragEventAndroid();
34
35 int action() const { return action_; }
36 const gfx::PointF& location_f() const { return location_; }
37 const gfx::PointF& screen_location_f() const { return screen_location_; }
38 const std::vector<base::string16>& mime_types() const { return mime_types_; }
39
40 const gfx::Point GetLocation() const;
41 const gfx::Point GetScreenLocation() const;
42 base::android::ScopedJavaLocalRef<jstring> GetJavaContent() const;
43
44 // Creates a new DragEventAndroid instance different from |this| only by
45 // its location.
46 std::unique_ptr<DragEventAndroid> CreateFor(
47 const gfx::PointF& new_location) const;
48
49 private:
50 int action_;
51 // Location relative to the view which the event is targeted.
52 gfx::PointF location_;
53 // Location relative to the screen coordinate.
54 gfx::PointF screen_location_;
55 const std::vector<base::string16>& mime_types_;
56 // The Java reference to the drop content to avoid unnecessary copying.
57 base::android::ScopedJavaGlobalRef<jstring> content_;
58
59 DISALLOW_COPY_AND_ASSIGN(DragEventAndroid);
60 };
61
62 } // namespace ui
63
64 #endif // UI_EVENTS_ANDROID_DRAG_EVENT_ANDROID_H_
OLDNEW
« no previous file with comments | « ui/events/BUILD.gn ('k') | ui/events/android/drag_event_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698