-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathdrag_handler.cpp
30 lines (23 loc) · 953 Bytes
/
drag_handler.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "drag_handler.h"
#include "jni_util.h"
DragHandler::DragHandler(JNIEnv* env, jobject handler)
: handle_(env, handler) {}
bool DragHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
CefDragHandler::DragOperationsMask mask) {
ScopedJNIEnv env;
if (!env)
return false;
ScopedJNIBrowser jbrowser(env, browser);
ScopedJNIDragData jdragData(env, dragData);
jdragData.SetTemporary();
jboolean result = JNI_FALSE;
JNI_CALL_METHOD(
env, handle_, "onDragEnter",
"(Lorg/cef/browser/CefBrowser;Lorg/cef/callback/CefDragData;I)Z", Boolean,
result, jbrowser.get(), jdragData.get(), (jint)mask);
return (result != JNI_FALSE);
}