Add support for CefDragHandler::OnDragEnter (issue #601).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1282 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-06-24 15:45:58 +00:00
parent 2fc9788311
commit 828e6ffe46
27 changed files with 1175 additions and 0 deletions

View File

@ -917,6 +917,8 @@
'libcef/common/command_line_impl.h',
'libcef/common/content_client.cc',
'libcef/common/content_client.h',
'libcef/common/drag_data_impl.cc',
'libcef/common/drag_data_impl.h',
'libcef/common/http_header_utils.cc',
'libcef/common/http_header_utils.h',
'libcef/common/main_delegate.cc',

View File

@ -25,6 +25,8 @@
'include/cef_dom.h',
'include/cef_download_handler.h',
'include/cef_download_item.h',
'include/cef_drag_data.h',
'include/cef_drag_handler.h',
'include/cef_focus_handler.h',
'include/cef_frame.h',
'include/cef_geolocation.h',
@ -72,6 +74,8 @@
'include/capi/cef_dom_capi.h',
'include/capi/cef_download_handler_capi.h',
'include/capi/cef_download_item_capi.h',
'include/capi/cef_drag_data_capi.h',
'include/capi/cef_drag_handler_capi.h',
'include/capi/cef_focus_handler_capi.h',
'include/capi/cef_frame_capi.h',
'include/capi/cef_geolocation_capi.h',
@ -160,6 +164,10 @@
'libcef_dll/cpptoc/download_item_cpptoc.h',
'libcef_dll/cpptoc/download_item_callback_cpptoc.cc',
'libcef_dll/cpptoc/download_item_callback_cpptoc.h',
'libcef_dll/cpptoc/drag_data_cpptoc.cc',
'libcef_dll/cpptoc/drag_data_cpptoc.h',
'libcef_dll/ctocpp/drag_handler_ctocpp.cc',
'libcef_dll/ctocpp/drag_handler_ctocpp.h',
'libcef_dll/cpptoc/file_dialog_callback_cpptoc.cc',
'libcef_dll/cpptoc/file_dialog_callback_cpptoc.h',
'libcef_dll/ctocpp/focus_handler_ctocpp.cc',
@ -314,6 +322,10 @@
'libcef_dll/ctocpp/download_item_ctocpp.h',
'libcef_dll/ctocpp/download_item_callback_ctocpp.cc',
'libcef_dll/ctocpp/download_item_callback_ctocpp.h',
'libcef_dll/ctocpp/drag_data_ctocpp.cc',
'libcef_dll/ctocpp/drag_data_ctocpp.h',
'libcef_dll/cpptoc/drag_handler_cpptoc.cc',
'libcef_dll/cpptoc/drag_handler_cpptoc.h',
'libcef_dll/ctocpp/file_dialog_callback_ctocpp.cc',
'libcef_dll/ctocpp/file_dialog_callback_ctocpp.h',
'libcef_dll/cpptoc/focus_handler_cpptoc.cc',

View File

@ -81,6 +81,12 @@ typedef struct _cef_client_t {
struct _cef_download_handler_t* (CEF_CALLBACK *get_download_handler)(
struct _cef_client_t* self);
///
// Return the handler for drag events.
///
struct _cef_drag_handler_t* (CEF_CALLBACK *get_drag_handler)(
struct _cef_client_t* self);
///
// Return the handler for focus events.
///

View File

@ -0,0 +1,74 @@
// Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "include/capi/cef_base_capi.h"
///
// Implement this structure to handle events related to dragging. The functions
// of this structure will be called on the UI thread.
///
typedef struct _cef_drag_handler_t {
///
// Base structure.
///
cef_base_t base;
///
// Called when an external drag event enters the browser window. |dragData|
// contains the drag event data and |mask| represents the type of drag
// operation. Return false (0) for default drag handling behavior or true (1)
// to cancel the drag event.
///
int (CEF_CALLBACK *on_drag_enter)(struct _cef_drag_handler_t* self,
struct _cef_browser_t* browser, struct _cef_drag_data_t* dragData,
enum cef_drag_operations_mask_t mask);
} cef_drag_handler_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_

View File

@ -43,6 +43,7 @@
#include "include/cef_dialog_handler.h"
#include "include/cef_display_handler.h"
#include "include/cef_download_handler.h"
#include "include/cef_drag_handler.h"
#include "include/cef_focus_handler.h"
#include "include/cef_geolocation_handler.h"
#include "include/cef_jsdialog_handler.h"
@ -94,6 +95,14 @@ class CefClient : public virtual CefBase {
return NULL;
}
///
// Return the handler for drag events.
///
/*--cef()--*/
virtual CefRefPtr<CefDragHandler> GetDragHandler() {
return NULL;
}
///
// Return the handler for focus events.
///

120
include/cef_drag_data.h Normal file
View File

@ -0,0 +1,120 @@
// Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_DRAG_DATA_H_
#define CEF_INCLUDE_CEF_DRAG_DATA_H_
#pragma once
#include "include/cef_base.h"
#include <vector>
///
// Class used to represent drag data. The methods of this class may be called
// on any thread.
///
/*--cef(source=library)--*/
class CefDragData : public virtual CefBase {
public:
///
// Returns true if the drag data is a link.
///
/*--cef()--*/
virtual bool IsLink() =0;
///
// Returns true if the drag data is a text or html fragment.
///
/*--cef()--*/
virtual bool IsFragment() =0;
///
// Returns true if the drag data is a file.
///
/*--cef()--*/
virtual bool IsFile() =0;
///
// Return the link URL that is being dragged.
///
/*--cef()--*/
virtual CefString GetLinkURL() =0;
///
// Return the title associated with the link being dragged.
///
/*--cef()--*/
virtual CefString GetLinkTitle() =0;
///
// Return the metadata, if any, associated with the link being dragged.
///
/*--cef()--*/
virtual CefString GetLinkMetadata() =0;
///
// Return the plain text fragment that is being dragged.
///
/*--cef()--*/
virtual CefString GetFragmentText() =0;
///
// Return the text/html fragment that is being dragged.
///
/*--cef()--*/
virtual CefString GetFragmentHtml() =0;
///
// Return the base URL that the fragment came from. This value is used for
// resolving relative URLs and may be empty.
///
/*--cef()--*/
virtual CefString GetFragmentBaseURL() =0;
///
// Return the name of the file being dragged out of the browser window.
///
/*--cef()--*/
virtual CefString GetFileName() =0;
///
// Retrieve the list of file names that are being dragged into the browser
// window.
///
/*--cef()--*/
virtual bool GetFileNames(std::vector<CefString>& names) =0;
};
#endif // CEF_INCLUDE_CEF_DRAG_DATA_H_

View File

@ -0,0 +1,66 @@
// Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_DRAG_HANDLER_H_
#define CEF_INCLUDE_CEF_DRAG_HANDLER_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_drag_data.h"
#include "include/cef_browser.h"
///
// Implement this interface to handle events related to dragging. The methods of
// this class will be called on the UI thread.
///
/*--cef(source=client)--*/
class CefDragHandler : public virtual CefBase {
public:
typedef cef_drag_operations_mask_t DragOperationsMask;
///
// Called when an external drag event enters the browser window. |dragData|
// contains the drag event data and |mask| represents the type of drag
// operation. Return false for default drag handling behavior or true to
// cancel the drag event.
///
/*--cef()--*/
virtual bool OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask) { return false; }
};
#endif // CEF_INCLUDE_CEF_DRAG_HANDLER_H_

View File

@ -746,6 +746,22 @@ enum cef_errorcode_t {
ERR_INSECURE_RESPONSE = -501,
};
///
// "Verb" of a drag-and-drop operation as negotiated between the source and
// destination. These constants match their equivalents in WebCore's
// DragActions.h and should not be renumbered.
///
enum cef_drag_operations_mask_t {
DRAG_OPERATION_NONE = 0,
DRAG_OPERATION_COPY = 1,
DRAG_OPERATION_LINK = 2,
DRAG_OPERATION_GENERIC = 4,
DRAG_OPERATION_PRIVATE = 8,
DRAG_OPERATION_MOVE = 16,
DRAG_OPERATION_DELETE = 32,
DRAG_OPERATION_EVERY = UINT_MAX
};
///
// V8 access control values.
///

View File

@ -23,6 +23,7 @@
#include "libcef/browser/url_request_context_getter_proxy.h"
#include "libcef/common/cef_messages.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/drag_data_impl.h"
#include "libcef/common/http_header_utils.h"
#include "libcef/common/main_delegate.h"
#include "libcef/common/process_message_impl.h"
@ -1668,6 +1669,21 @@ void CefBrowserHostImpl::HandleKeyboardEvent(
PlatformHandleKeyboardEvent(event);
}
bool CefBrowserHostImpl::CanDragEnter(
content::WebContents* source,
const WebDropData& data,
WebKit::WebDragOperationsMask mask) {
CefRefPtr<CefDragHandler> handler = client_->GetDragHandler();
if (handler.get()) {
CefRefPtr<CefDragData> drag_data(new CefDragDataImpl(data));
if (handler->OnDragEnter(this, drag_data,
static_cast<CefDragHandler::DragOperationsMask>(mask))) {
return false;
}
}
return true;
}
bool CefBrowserHostImpl::ShouldCreateWebContents(
content::WebContents* web_contents,
int route_id,

View File

@ -299,6 +299,10 @@ class CefBrowserHostImpl : public CefBrowserHost,
virtual void HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) OVERRIDE;
virtual bool CanDragEnter(
content::WebContents* source,
const WebDropData& data,
WebKit::WebDragOperationsMask operations_allowed) OVERRIDE;
virtual bool ShouldCreateWebContents(
content::WebContents* web_contents,
int route_id,

View File

@ -0,0 +1,63 @@
// Copyright (c) 2013 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 "libcef/common/drag_data_impl.h"
#include "base/files/file_path.h"
CefDragDataImpl::CefDragDataImpl(const WebDropData& data)
: data_(data) {
}
bool CefDragDataImpl::IsLink() {
return (data_.url.is_valid() && data_.file_description_filename.empty());
}
bool CefDragDataImpl::IsFragment() {
return (!data_.url.is_valid() && data_.file_description_filename.empty() &&
data_.filenames.empty());
}
bool CefDragDataImpl::IsFile() {
return (!data_.file_description_filename.empty() || !data_.filenames.empty());
}
CefString CefDragDataImpl::GetLinkURL() {
return data_.url.spec();
}
CefString CefDragDataImpl::GetLinkTitle() {
return data_.url_title;
}
CefString CefDragDataImpl::GetLinkMetadata() {
return data_.download_metadata;
}
CefString CefDragDataImpl::GetFragmentText() {
return data_.text.is_null() ? CefString() : CefString(data_.text.string());
}
CefString CefDragDataImpl::GetFragmentHtml() {
return data_.html.is_null() ? CefString() : CefString(data_.html.string());
}
CefString CefDragDataImpl::GetFragmentBaseURL() {
return data_.html_base_url.spec();
}
CefString CefDragDataImpl::GetFileName() {
return data_.file_description_filename;
}
bool CefDragDataImpl::GetFileNames(std::vector<CefString>& names) {
if (data_.filenames.empty())
return false;
std::vector<WebDropData::FileInfo>::const_iterator it =
data_.filenames.begin();
for (; it != data_.filenames.end(); ++it)
names.push_back(it->path);
return true;
}

View File

@ -0,0 +1,37 @@
// Copyright (c) 2013 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.
#ifndef CEF_LIBCEF_COMMON_DRAG_DATA_IMPL_H_
#define CEF_LIBCEF_COMMON_DRAG_DATA_IMPL_H_
#pragma once
#include <vector>
#include "include/cef_drag_data.h"
#include "webkit/common/webdropdata.h"
// Implementation of CefDragData.
class CefDragDataImpl : public CefDragData {
public:
explicit CefDragDataImpl(const WebDropData& data);
virtual bool IsLink();
virtual bool IsFragment();
virtual bool IsFile();
virtual CefString GetLinkURL();
virtual CefString GetLinkTitle();
virtual CefString GetLinkMetadata();
virtual CefString GetFragmentText();
virtual CefString GetFragmentHtml();
virtual CefString GetFragmentBaseURL();
virtual CefString GetFileName();
virtual bool GetFileNames(std::vector<CefString>& names);
protected:
WebDropData data_;
IMPLEMENT_REFCOUNTING(CefDragDataImpl);
};
#endif // CEF_LIBCEF_COMMON_DRAG_DATA_IMPL_H_

View File

@ -15,6 +15,7 @@
#include "libcef_dll/cpptoc/dialog_handler_cpptoc.h"
#include "libcef_dll/cpptoc/display_handler_cpptoc.h"
#include "libcef_dll/cpptoc/download_handler_cpptoc.h"
#include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h"
#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h"
@ -93,6 +94,22 @@ struct _cef_download_handler_t* CEF_CALLBACK client_get_download_handler(
return CefDownloadHandlerCppToC::Wrap(_retval);
}
struct _cef_drag_handler_t* CEF_CALLBACK client_get_drag_handler(
struct _cef_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefDragHandler> _retval = CefClientCppToC::Get(
self)->GetDragHandler();
// Return type: refptr_same
return CefDragHandlerCppToC::Wrap(_retval);
}
struct _cef_focus_handler_t* CEF_CALLBACK client_get_focus_handler(
struct _cef_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -257,6 +274,7 @@ CefClientCppToC::CefClientCppToC(CefClient* cls)
struct_.struct_.get_dialog_handler = client_get_dialog_handler;
struct_.struct_.get_display_handler = client_get_display_handler;
struct_.struct_.get_download_handler = client_get_download_handler;
struct_.struct_.get_drag_handler = client_get_drag_handler;
struct_.struct_.get_focus_handler = client_get_focus_handler;
struct_.struct_.get_geolocation_handler = client_get_geolocation_handler;
struct_.struct_.get_jsdialog_handler = client_get_jsdialog_handler;

View File

@ -0,0 +1,216 @@
// Copyright (c) 2013 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
#include "libcef_dll/transfer_util.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK drag_data_is_link(struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefDragDataCppToC::Get(self)->IsLink();
// Return type: bool
return _retval;
}
int CEF_CALLBACK drag_data_is_fragment(struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefDragDataCppToC::Get(self)->IsFragment();
// Return type: bool
return _retval;
}
int CEF_CALLBACK drag_data_is_file(struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefDragDataCppToC::Get(self)->IsFile();
// Return type: bool
return _retval;
}
cef_string_userfree_t CEF_CALLBACK drag_data_get_link_url(
struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefDragDataCppToC::Get(self)->GetLinkURL();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK drag_data_get_link_title(
struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefDragDataCppToC::Get(self)->GetLinkTitle();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK drag_data_get_link_metadata(
struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefDragDataCppToC::Get(self)->GetLinkMetadata();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK drag_data_get_fragment_text(
struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefDragDataCppToC::Get(self)->GetFragmentText();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK drag_data_get_fragment_html(
struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefDragDataCppToC::Get(self)->GetFragmentHtml();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK drag_data_get_fragment_base_url(
struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefDragDataCppToC::Get(self)->GetFragmentBaseURL();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK drag_data_get_file_name(
struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefDragDataCppToC::Get(self)->GetFileName();
// Return type: string
return _retval.DetachToUserFree();
}
int CEF_CALLBACK drag_data_get_file_names(struct _cef_drag_data_t* self,
cef_string_list_t names) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: names; type: string_vec_byref
DCHECK(names);
if (!names)
return 0;
// Translate param: names; type: string_vec_byref
std::vector<CefString> namesList;
transfer_string_list_contents(names, namesList);
// Execute
bool _retval = CefDragDataCppToC::Get(self)->GetFileNames(
namesList);
// Restore param: names; type: string_vec_byref
cef_string_list_clear(names);
transfer_string_list_contents(namesList, names);
// Return type: bool
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefDragDataCppToC::CefDragDataCppToC(CefDragData* cls)
: CefCppToC<CefDragDataCppToC, CefDragData, cef_drag_data_t>(cls) {
struct_.struct_.is_link = drag_data_is_link;
struct_.struct_.is_fragment = drag_data_is_fragment;
struct_.struct_.is_file = drag_data_is_file;
struct_.struct_.get_link_url = drag_data_get_link_url;
struct_.struct_.get_link_title = drag_data_get_link_title;
struct_.struct_.get_link_metadata = drag_data_get_link_metadata;
struct_.struct_.get_fragment_text = drag_data_get_fragment_text;
struct_.struct_.get_fragment_html = drag_data_get_fragment_html;
struct_.struct_.get_fragment_base_url = drag_data_get_fragment_base_url;
struct_.struct_.get_file_name = drag_data_get_file_name;
struct_.struct_.get_file_names = drag_data_get_file_names;
}
#ifndef NDEBUG
template<> long CefCppToC<CefDragDataCppToC, CefDragData,
cef_drag_data_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,36 @@
// Copyright (c) 2013 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_DRAG_DATA_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_DRAG_DATA_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_drag_data.h"
#include "include/capi/cef_drag_data_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefDragDataCppToC
: public CefCppToC<CefDragDataCppToC, CefDragData, cef_drag_data_t> {
public:
explicit CefDragDataCppToC(CefDragData* cls);
virtual ~CefDragDataCppToC() {}
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_DRAG_DATA_CPPTOC_H_

View File

@ -0,0 +1,59 @@
// Copyright (c) 2013 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK drag_handler_on_drag_enter(struct _cef_drag_handler_t* self,
cef_browser_t* browser, cef_drag_data_t* dragData,
enum cef_drag_operations_mask_t mask) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: dragData; type: refptr_diff
DCHECK(dragData);
if (!dragData)
return 0;
// Execute
bool _retval = CefDragHandlerCppToC::Get(self)->OnDragEnter(
CefBrowserCToCpp::Wrap(browser),
CefDragDataCToCpp::Wrap(dragData),
mask);
// Return type: bool
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefDragHandlerCppToC::CefDragHandlerCppToC(CefDragHandler* cls)
: CefCppToC<CefDragHandlerCppToC, CefDragHandler, cef_drag_handler_t>(cls) {
struct_.struct_.on_drag_enter = drag_handler_on_drag_enter;
}
#ifndef NDEBUG
template<> long CefCppToC<CefDragHandlerCppToC, CefDragHandler,
cef_drag_handler_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,37 @@
// Copyright (c) 2013 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_DRAG_HANDLER_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_DRAG_HANDLER_CPPTOC_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_drag_handler.h"
#include "include/capi/cef_drag_handler_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefDragHandlerCppToC
: public CefCppToC<CefDragHandlerCppToC, CefDragHandler,
cef_drag_handler_t> {
public:
explicit CefDragHandlerCppToC(CefDragHandler* cls);
virtual ~CefDragHandlerCppToC() {}
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_DRAG_HANDLER_CPPTOC_H_

View File

@ -17,6 +17,7 @@
#include "libcef_dll/ctocpp/dialog_handler_ctocpp.h"
#include "libcef_dll/ctocpp/display_handler_ctocpp.h"
#include "libcef_dll/ctocpp/download_handler_ctocpp.h"
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
#include "libcef_dll/ctocpp/focus_handler_ctocpp.h"
#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h"
#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h"
@ -82,6 +83,19 @@ CefRefPtr<CefDownloadHandler> CefClientCToCpp::GetDownloadHandler() {
return CefDownloadHandlerCToCpp::Wrap(_retval);
}
CefRefPtr<CefDragHandler> CefClientCToCpp::GetDragHandler() {
if (CEF_MEMBER_MISSING(struct_, get_drag_handler))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_drag_handler_t* _retval = struct_->get_drag_handler(struct_);
// Return type: refptr_same
return CefDragHandlerCToCpp::Wrap(_retval);
}
CefRefPtr<CefFocusHandler> CefClientCToCpp::GetFocusHandler() {
if (CEF_MEMBER_MISSING(struct_, get_focus_handler))
return NULL;

View File

@ -36,6 +36,7 @@ class CefClientCToCpp
virtual CefRefPtr<CefDialogHandler> GetDialogHandler() OVERRIDE;
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE;
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() OVERRIDE;
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE;
virtual CefRefPtr<CefFocusHandler> GetFocusHandler() OVERRIDE;
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE;
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() OVERRIDE;

View File

@ -0,0 +1,195 @@
// Copyright (c) 2013 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// VIRTUAL METHODS - Body may be edited by hand.
bool CefDragDataCToCpp::IsLink() {
if (CEF_MEMBER_MISSING(struct_, is_link))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_link(struct_);
// Return type: bool
return _retval?true:false;
}
bool CefDragDataCToCpp::IsFragment() {
if (CEF_MEMBER_MISSING(struct_, is_fragment))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_fragment(struct_);
// Return type: bool
return _retval?true:false;
}
bool CefDragDataCToCpp::IsFile() {
if (CEF_MEMBER_MISSING(struct_, is_file))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_file(struct_);
// Return type: bool
return _retval?true:false;
}
CefString CefDragDataCToCpp::GetLinkURL() {
if (CEF_MEMBER_MISSING(struct_, get_link_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_link_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefDragDataCToCpp::GetLinkTitle() {
if (CEF_MEMBER_MISSING(struct_, get_link_title))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_link_title(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefDragDataCToCpp::GetLinkMetadata() {
if (CEF_MEMBER_MISSING(struct_, get_link_metadata))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_link_metadata(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefDragDataCToCpp::GetFragmentText() {
if (CEF_MEMBER_MISSING(struct_, get_fragment_text))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_fragment_text(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefDragDataCToCpp::GetFragmentHtml() {
if (CEF_MEMBER_MISSING(struct_, get_fragment_html))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_fragment_html(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefDragDataCToCpp::GetFragmentBaseURL() {
if (CEF_MEMBER_MISSING(struct_, get_fragment_base_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_fragment_base_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefDragDataCToCpp::GetFileName() {
if (CEF_MEMBER_MISSING(struct_, get_file_name))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_file_name(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
bool CefDragDataCToCpp::GetFileNames(std::vector<CefString>& names) {
if (CEF_MEMBER_MISSING(struct_, get_file_names))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: names; type: string_vec_byref
cef_string_list_t namesList = cef_string_list_alloc();
DCHECK(namesList);
if (namesList)
transfer_string_list_contents(names, namesList);
// Execute
int _retval = struct_->get_file_names(struct_,
namesList);
// Restore param:names; type: string_vec_byref
if (namesList) {
names.clear();
transfer_string_list_contents(namesList, names);
cef_string_list_free(namesList);
}
// Return type: bool
return _retval?true:false;
}
#ifndef NDEBUG
template<> long CefCToCpp<CefDragDataCToCpp, CefDragData,
cef_drag_data_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,51 @@
// Copyright (c) 2013 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include <vector>
#include "include/cef_drag_data.h"
#include "include/capi/cef_drag_data_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefDragDataCToCpp
: public CefCToCpp<CefDragDataCToCpp, CefDragData, cef_drag_data_t> {
public:
explicit CefDragDataCToCpp(cef_drag_data_t* str)
: CefCToCpp<CefDragDataCToCpp, CefDragData, cef_drag_data_t>(str) {}
virtual ~CefDragDataCToCpp() {}
// CefDragData methods
virtual bool IsLink() OVERRIDE;
virtual bool IsFragment() OVERRIDE;
virtual bool IsFile() OVERRIDE;
virtual CefString GetLinkURL() OVERRIDE;
virtual CefString GetLinkTitle() OVERRIDE;
virtual CefString GetLinkMetadata() OVERRIDE;
virtual CefString GetFragmentText() OVERRIDE;
virtual CefString GetFragmentHtml() OVERRIDE;
virtual CefString GetFragmentBaseURL() OVERRIDE;
virtual CefString GetFileName() OVERRIDE;
virtual bool GetFileNames(std::vector<CefString>& names) OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_

View File

@ -0,0 +1,51 @@
// Copyright (c) 2013 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
bool CefDragHandlerCToCpp::OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData, DragOperationsMask mask) {
if (CEF_MEMBER_MISSING(struct_, on_drag_enter))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: dragData; type: refptr_diff
DCHECK(dragData.get());
if (!dragData.get())
return false;
// Execute
int _retval = struct_->on_drag_enter(struct_,
CefBrowserCppToC::Wrap(browser),
CefDragDataCppToC::Wrap(dragData),
mask);
// Return type: bool
return _retval?true:false;
}
#ifndef NDEBUG
template<> long CefCToCpp<CefDragHandlerCToCpp, CefDragHandler,
cef_drag_handler_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,43 @@
// Copyright (c) 2013 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_DRAG_HANDLER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_DRAG_HANDLER_CTOCPP_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_drag_handler.h"
#include "include/capi/cef_drag_handler_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefDragHandlerCToCpp
: public CefCToCpp<CefDragHandlerCToCpp, CefDragHandler,
cef_drag_handler_t> {
public:
explicit CefDragHandlerCToCpp(cef_drag_handler_t* str)
: CefCToCpp<CefDragHandlerCToCpp, CefDragHandler, cef_drag_handler_t>(
str) {}
virtual ~CefDragHandlerCToCpp() {}
// CefDragHandler methods
virtual bool OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData, DragOperationsMask mask) OVERRIDE;
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_DRAG_HANDLER_CTOCPP_H_

View File

@ -48,6 +48,7 @@
#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h"
#include "libcef_dll/cpptoc/download_item_cpptoc.h"
#include "libcef_dll/cpptoc/download_item_callback_cpptoc.h"
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
#include "libcef_dll/cpptoc/file_dialog_callback_cpptoc.h"
#include "libcef_dll/cpptoc/frame_cpptoc.h"
#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h"
@ -79,6 +80,7 @@
#include "libcef_dll/ctocpp/dialog_handler_ctocpp.h"
#include "libcef_dll/ctocpp/display_handler_ctocpp.h"
#include "libcef_dll/ctocpp/download_handler_ctocpp.h"
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
#include "libcef_dll/ctocpp/focus_handler_ctocpp.h"
#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h"
#include "libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h"
@ -196,6 +198,8 @@ CEF_EXPORT void cef_shutdown() {
DCHECK_EQ(CefDownloadHandlerCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefDownloadItemCallbackCppToC::DebugObjCt, 0);
DCHECK_EQ(CefDownloadItemCppToC::DebugObjCt, 0);
DCHECK_EQ(CefDragDataCppToC::DebugObjCt, 0);
DCHECK_EQ(CefDragHandlerCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefFileDialogCallbackCppToC::DebugObjCt, 0);
DCHECK_EQ(CefFocusHandlerCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefFrameCppToC::DebugObjCt, 0);

View File

@ -43,6 +43,7 @@
#include "libcef_dll/cpptoc/dialog_handler_cpptoc.h"
#include "libcef_dll/cpptoc/display_handler_cpptoc.h"
#include "libcef_dll/cpptoc/download_handler_cpptoc.h"
#include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h"
#include "libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h"
@ -83,6 +84,7 @@
#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h"
#include "libcef_dll/ctocpp/download_item_ctocpp.h"
#include "libcef_dll/ctocpp/download_item_callback_ctocpp.h"
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
#include "libcef_dll/ctocpp/file_dialog_callback_ctocpp.h"
#include "libcef_dll/ctocpp/frame_ctocpp.h"
#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h"
@ -188,6 +190,8 @@ CEF_GLOBAL void CefShutdown() {
DCHECK_EQ(CefDownloadHandlerCppToC::DebugObjCt, 0);
DCHECK_EQ(CefDownloadItemCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefDownloadItemCallbackCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefDragDataCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefDragHandlerCppToC::DebugObjCt, 0);
DCHECK_EQ(CefFileDialogCallbackCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefFocusHandlerCppToC::DebugObjCt, 0);
DCHECK_EQ(CefFrameCToCpp::DebugObjCt, 0);

View File

@ -262,6 +262,18 @@ void ClientHandler::OnDownloadUpdated(
}
}
bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask) {
REQUIRE_UI_THREAD();
// Forbid dragging of link URLs.
if (dragData->IsLink())
return true;
return false;
}
void ClientHandler::OnRequestGeolocationPermission(
CefRefPtr<CefBrowser> browser,
const CefString& requesting_url,

View File

@ -24,6 +24,7 @@ class ClientHandler : public CefClient,
public CefContextMenuHandler,
public CefDisplayHandler,
public CefDownloadHandler,
public CefDragHandler,
public CefGeolocationHandler,
public CefKeyboardHandler,
public CefLifeSpanHandler,
@ -70,6 +71,9 @@ class ClientHandler : public CefClient,
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() OVERRIDE {
return this;
}
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE {
return this;
}
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE {
return this;
}
@ -130,6 +134,11 @@ class ClientHandler : public CefClient,
CefRefPtr<CefDownloadItem> download_item,
CefRefPtr<CefDownloadItemCallback> callback) OVERRIDE;
// CefDragHandler methods
virtual bool OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask) OVERRIDE;
// CefGeolocationHandler methods
virtual void OnRequestGeolocationPermission(
CefRefPtr<CefBrowser> browser,