mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-23 15:37:51 +01:00
Add support for CefDragHandler::OnDragEnter (issue #601).
git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1453@1274 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
2ec8891fe2
commit
12e125b5c2
@ -920,6 +920,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',
|
||||
|
@ -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',
|
||||
|
@ -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.
|
||||
///
|
||||
|
136
cef3/include/capi/cef_drag_data_capi.h
Normal file
136
cef3/include/capi/cef_drag_data_capi.h
Normal file
@ -0,0 +1,136 @@
|
||||
// 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_DATA_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
|
||||
///
|
||||
// Structure used to represent drag data. The functions of this structure may be
|
||||
// called on any thread.
|
||||
///
|
||||
typedef struct _cef_drag_data_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Returns true (1) if the drag data is a link.
|
||||
///
|
||||
int (CEF_CALLBACK *is_link)(struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the drag data is a text or html fragment.
|
||||
///
|
||||
int (CEF_CALLBACK *is_fragment)(struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the drag data is a file.
|
||||
///
|
||||
int (CEF_CALLBACK *is_file)(struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Return the link URL that is being dragged.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_link_url)(
|
||||
struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Return the title associated with the link being dragged.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_link_title)(
|
||||
struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Return the metadata, if any, associated with the link being dragged.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_link_metadata)(
|
||||
struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Return the plain text fragment that is being dragged.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_fragment_text)(
|
||||
struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Return the text/html fragment that is being dragged.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_fragment_html)(
|
||||
struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Return the base URL that the fragment came from. This value is used for
|
||||
// resolving relative URLs and may be NULL.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_fragment_base_url)(
|
||||
struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Return the name of the file being dragged out of the browser window.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_file_name)(
|
||||
struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
// Retrieve the list of file names that are being dragged into the browser
|
||||
// window.
|
||||
///
|
||||
int (CEF_CALLBACK *get_file_names)(struct _cef_drag_data_t* self,
|
||||
cef_string_list_t names);
|
||||
} cef_drag_data_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_
|
74
cef3/include/capi/cef_drag_handler_capi.h
Normal file
74
cef3/include/capi/cef_drag_handler_capi.h
Normal 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_
|
@ -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
cef3/include/cef_drag_data.h
Normal file
120
cef3/include/cef_drag_data.h
Normal 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_
|
66
cef3/include/cef_drag_handler.h
Normal file
66
cef3/include/cef_drag_handler.h
Normal 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_
|
@ -758,6 +758,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.
|
||||
///
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
63
cef3/libcef/common/drag_data_impl.cc
Normal file
63
cef3/libcef/common/drag_data_impl.cc
Normal 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;
|
||||
}
|
37
cef3/libcef/common/drag_data_impl.h
Normal file
37
cef3/libcef/common/drag_data_impl.h
Normal 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/glue/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_
|
@ -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;
|
||||
|
216
cef3/libcef_dll/cpptoc/drag_data_cpptoc.cc
Normal file
216
cef3/libcef_dll/cpptoc/drag_data_cpptoc.cc
Normal 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
|
||||
|
36
cef3/libcef_dll/cpptoc/drag_data_cpptoc.h
Normal file
36
cef3/libcef_dll/cpptoc/drag_data_cpptoc.h
Normal 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_
|
||||
|
59
cef3/libcef_dll/cpptoc/drag_handler_cpptoc.cc
Normal file
59
cef3/libcef_dll/cpptoc/drag_handler_cpptoc.cc
Normal 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
|
||||
|
37
cef3/libcef_dll/cpptoc/drag_handler_cpptoc.h
Normal file
37
cef3/libcef_dll/cpptoc/drag_handler_cpptoc.h
Normal 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_
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
195
cef3/libcef_dll/ctocpp/drag_data_ctocpp.cc
Normal file
195
cef3/libcef_dll/ctocpp/drag_data_ctocpp.cc
Normal 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
|
||||
|
51
cef3/libcef_dll/ctocpp/drag_data_ctocpp.h
Normal file
51
cef3/libcef_dll/ctocpp/drag_data_ctocpp.h
Normal 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_
|
||||
|
51
cef3/libcef_dll/ctocpp/drag_handler_ctocpp.cc
Normal file
51
cef3/libcef_dll/ctocpp/drag_handler_ctocpp.cc
Normal 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
|
||||
|
43
cef3/libcef_dll/ctocpp/drag_handler_ctocpp.h
Normal file
43
cef3/libcef_dll/ctocpp/drag_handler_ctocpp.h
Normal 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_
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -56,6 +56,11 @@ patches = [
|
||||
'name': 'renderer_main_642',
|
||||
'path': '../content/renderer/',
|
||||
},
|
||||
{
|
||||
# http://code.google.com/p/chromiumembedded/issues/detail?id=601
|
||||
'name': 'drag_handler_601',
|
||||
'path': '../content/',
|
||||
},
|
||||
{
|
||||
# http://code.google.com/p/chromiumembedded/issues/detail?id=364
|
||||
'name': 'spi_webcore_364',
|
||||
|
319
cef3/patch/patches/drag_handler_601.patch
Normal file
319
cef3/patch/patches/drag_handler_601.patch
Normal file
@ -0,0 +1,319 @@
|
||||
Index: browser/web_contents/web_drag_dest_gtk.cc
|
||||
===================================================================
|
||||
--- browser/web_contents/web_drag_dest_gtk.cc (revision 202711)
|
||||
+++ browser/web_contents/web_drag_dest_gtk.cc (working copy)
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "content/browser/renderer_host/render_view_host_impl.h"
|
||||
#include "content/browser/web_contents/drag_utils_gtk.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
+#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "content/public/browser/web_drag_dest_delegate.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "net/base/net_util.h"
|
||||
@@ -53,6 +54,7 @@
|
||||
context_(NULL),
|
||||
data_requests_(0),
|
||||
delegate_(NULL),
|
||||
+ canceled_(false),
|
||||
method_factory_(this) {
|
||||
gtk_drag_dest_set(widget, static_cast<GtkDestDefaults>(0),
|
||||
NULL, 0,
|
||||
@@ -143,6 +145,9 @@
|
||||
time);
|
||||
}
|
||||
} else if (data_requests_ == 0) {
|
||||
+ if (canceled_)
|
||||
+ return FALSE;
|
||||
+
|
||||
GetRenderViewHost()->DragTargetDragOver(
|
||||
ui::ClientPoint(widget_),
|
||||
ui::ScreenPoint(widget_),
|
||||
@@ -236,6 +241,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ if (data_requests_ == 0) {
|
||||
+ // Give the delegate an opportunity to cancel the drag.
|
||||
+ canceled_ = !web_contents_->GetDelegate()->CanDragEnter(
|
||||
+ web_contents_,
|
||||
+ *drop_data_,
|
||||
+ GdkDragActionToWebDragOp(context->actions));
|
||||
+ if (canceled_) {
|
||||
+ drag_over_time_ = time;
|
||||
+ UpdateDragStatus(WebDragOperationNone);
|
||||
+ drop_data_.reset();
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// For CHROME_BOOKMARK_ITEM, we have to handle the case where the drag source
|
||||
// doesn't have any data available for us. In this case we try to synthesize a
|
||||
// URL bookmark.
|
||||
@@ -274,6 +293,9 @@
|
||||
// as an enter.
|
||||
context_ = NULL;
|
||||
|
||||
+ if (canceled_)
|
||||
+ return;
|
||||
+
|
||||
// Sometimes we get a drag-leave event before getting a drag-data-received
|
||||
// event. In that case, we don't want to bother the renderer with a
|
||||
// DragLeave event.
|
||||
Index: browser/web_contents/web_drag_dest_gtk.h
|
||||
===================================================================
|
||||
--- browser/web_contents/web_drag_dest_gtk.h (revision 202711)
|
||||
+++ browser/web_contents/web_drag_dest_gtk.h (working copy)
|
||||
@@ -101,6 +101,9 @@
|
||||
// A delegate that can receive drag information about drag events.
|
||||
WebDragDestDelegate* delegate_;
|
||||
|
||||
+ // True if the drag has been canceled.
|
||||
+ bool canceled_;
|
||||
+
|
||||
base::WeakPtrFactory<WebDragDestGtk> method_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebDragDestGtk);
|
||||
Index: browser/web_contents/web_drag_dest_mac.h
|
||||
===================================================================
|
||||
--- browser/web_contents/web_drag_dest_mac.h (revision 202711)
|
||||
+++ browser/web_contents/web_drag_dest_mac.h (working copy)
|
||||
@@ -40,6 +40,9 @@
|
||||
|
||||
// The data for the current drag, or NULL if none is in progress.
|
||||
scoped_ptr<WebDropData> dropData_;
|
||||
+
|
||||
+ // True if the drag has been canceled.
|
||||
+ bool canceled_;
|
||||
}
|
||||
|
||||
// |contents| is the WebContentsImpl representing this tab, used to communicate
|
||||
Index: browser/web_contents/web_drag_dest_mac.mm
|
||||
===================================================================
|
||||
--- browser/web_contents/web_drag_dest_mac.mm (revision 202711)
|
||||
+++ browser/web_contents/web_drag_dest_mac.mm (working copy)
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "base/sys_string_conversions.h"
|
||||
#include "content/browser/renderer_host/render_view_host_impl.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
+#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "content/public/browser/web_drag_dest_delegate.h"
|
||||
#import "third_party/mozilla/NSPasteboard+Utils.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
|
||||
@@ -44,6 +45,7 @@
|
||||
- (id)initWithWebContentsImpl:(WebContentsImpl*)contents {
|
||||
if ((self = [super init])) {
|
||||
webContents_ = contents;
|
||||
+ canceled_ = false;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -103,6 +105,22 @@
|
||||
// we need to send a new enter message in draggingUpdated:.
|
||||
currentRVH_ = webContents_->GetRenderViewHost();
|
||||
|
||||
+ // Fill out a WebDropData from pasteboard.
|
||||
+ scoped_ptr<WebDropData> dropData;
|
||||
+ dropData.reset(new WebDropData());
|
||||
+ [self populateWebDropData:dropData.get()
|
||||
+ fromPasteboard:[info draggingPasteboard]];
|
||||
+
|
||||
+ NSDragOperation mask = [info draggingSourceOperationMask];
|
||||
+
|
||||
+ // Give the delegate an opportunity to cancel the drag.
|
||||
+ canceled_ = !webContents_->GetDelegate()->CanDragEnter(
|
||||
+ webContents_,
|
||||
+ *dropData,
|
||||
+ static_cast<WebDragOperationsMask>(mask));
|
||||
+ if (canceled_)
|
||||
+ return NSDragOperationNone;
|
||||
+
|
||||
if ([self onlyAllowsNavigation]) {
|
||||
if ([[info draggingPasteboard] containsURLData])
|
||||
return NSDragOperationCopy;
|
||||
@@ -114,17 +132,13 @@
|
||||
delegate_->OnDragEnter();
|
||||
}
|
||||
|
||||
- // Fill out a WebDropData from pasteboard.
|
||||
- dropData_.reset(new WebDropData());
|
||||
- [self populateWebDropData:dropData_.get()
|
||||
- fromPasteboard:[info draggingPasteboard]];
|
||||
+ dropData_.swap(dropData);
|
||||
|
||||
// Create the appropriate mouse locations for WebCore. The draggingLocation
|
||||
// is in window coordinates. Both need to be flipped.
|
||||
NSPoint windowPoint = [info draggingLocation];
|
||||
NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view];
|
||||
NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view];
|
||||
- NSDragOperation mask = [info draggingSourceOperationMask];
|
||||
webContents_->GetRenderViewHost()->DragTargetDragEnter(
|
||||
*dropData_,
|
||||
gfx::Point(viewPoint.x, viewPoint.y),
|
||||
@@ -143,6 +157,9 @@
|
||||
if (currentRVH_ != webContents_->GetRenderViewHost())
|
||||
return;
|
||||
|
||||
+ if (canceled_)
|
||||
+ return;
|
||||
+
|
||||
if ([self onlyAllowsNavigation])
|
||||
return;
|
||||
|
||||
@@ -159,6 +176,9 @@
|
||||
if (currentRVH_ != webContents_->GetRenderViewHost())
|
||||
[self draggingEntered:info view:view];
|
||||
|
||||
+ if (canceled_)
|
||||
+ return NSDragOperationNone;
|
||||
+
|
||||
if ([self onlyAllowsNavigation]) {
|
||||
if ([[info draggingPasteboard] containsURLData])
|
||||
return NSDragOperationCopy;
|
||||
Index: browser/web_contents/web_drag_dest_win.cc
|
||||
===================================================================
|
||||
--- browser/web_contents/web_drag_dest_win.cc (revision 202711)
|
||||
+++ browser/web_contents/web_drag_dest_win.cc (working copy)
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "content/browser/renderer_host/render_view_host_impl.h"
|
||||
#include "content/browser/web_contents/web_drag_utils_win.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
+#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "content/public/browser/web_drag_dest_delegate.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "net/base/net_util.h"
|
||||
@@ -108,7 +109,8 @@
|
||||
current_rvh_(NULL),
|
||||
drag_cursor_(WebDragOperationNone),
|
||||
interstitial_drop_target_(new InterstitialDropTarget(web_contents)),
|
||||
- delegate_(NULL) {
|
||||
+ delegate_(NULL),
|
||||
+ canceled_(false) {
|
||||
}
|
||||
|
||||
WebDragDest::~WebDragDest() {
|
||||
@@ -120,6 +122,24 @@
|
||||
DWORD effects) {
|
||||
current_rvh_ = web_contents_->GetRenderViewHost();
|
||||
|
||||
+ // TODO(tc): PopulateWebDropData can be slow depending on what is in the
|
||||
+ // IDataObject. Maybe we can do this in a background thread.
|
||||
+ scoped_ptr<WebDropData> drop_data;
|
||||
+ drop_data.reset(new WebDropData());
|
||||
+ WebDropData::PopulateWebDropData(data_object, drop_data.get());
|
||||
+
|
||||
+ if (drop_data->url.is_empty())
|
||||
+ ui::OSExchangeDataProviderWin::GetPlainTextURL(data_object,
|
||||
+ &drop_data->url);
|
||||
+
|
||||
+ // Give the delegate an opportunity to cancel the drag.
|
||||
+ canceled_ = !web_contents_->GetDelegate()->CanDragEnter(
|
||||
+ web_contents_,
|
||||
+ *drop_data,
|
||||
+ WinDragOpMaskToWebDragOpMask(effects));
|
||||
+ if (canceled_)
|
||||
+ return DROPEFFECT_NONE;
|
||||
+
|
||||
if (delegate_)
|
||||
delegate_->DragInitialize(web_contents_);
|
||||
|
||||
@@ -129,15 +149,7 @@
|
||||
if (web_contents_->ShowingInterstitialPage())
|
||||
return interstitial_drop_target_->OnDragEnter(data_object, effects);
|
||||
|
||||
- // TODO(tc): PopulateWebDropData can be slow depending on what is in the
|
||||
- // IDataObject. Maybe we can do this in a background thread.
|
||||
- drop_data_.reset(new WebDropData());
|
||||
- WebDropData::PopulateWebDropData(data_object, drop_data_.get());
|
||||
-
|
||||
- if (drop_data_->url.is_empty())
|
||||
- ui::OSExchangeDataProviderWin::GetPlainTextURL(data_object,
|
||||
- &drop_data_->url);
|
||||
-
|
||||
+ drop_data_.swap(drop_data);
|
||||
drag_cursor_ = WebDragOperationNone;
|
||||
|
||||
POINT client_pt = cursor_position;
|
||||
@@ -164,6 +176,9 @@
|
||||
if (current_rvh_ != web_contents_->GetRenderViewHost())
|
||||
OnDragEnter(data_object, key_state, cursor_position, effects);
|
||||
|
||||
+ if (canceled_)
|
||||
+ return DROPEFFECT_NONE;
|
||||
+
|
||||
if (web_contents_->ShowingInterstitialPage())
|
||||
return interstitial_drop_target_->OnDragOver(data_object, effects);
|
||||
|
||||
@@ -186,6 +201,9 @@
|
||||
if (current_rvh_ != web_contents_->GetRenderViewHost())
|
||||
return;
|
||||
|
||||
+ if (canceled_)
|
||||
+ return;
|
||||
+
|
||||
if (web_contents_->ShowingInterstitialPage()) {
|
||||
interstitial_drop_target_->OnDragLeave(data_object);
|
||||
} else {
|
||||
Index: browser/web_contents/web_drag_dest_win.h
|
||||
===================================================================
|
||||
--- browser/web_contents/web_drag_dest_win.h (revision 202711)
|
||||
+++ browser/web_contents/web_drag_dest_win.h (working copy)
|
||||
@@ -78,6 +78,9 @@
|
||||
// The data for the current drag, or NULL if |context_| is NULL.
|
||||
scoped_ptr<WebDropData> drop_data_;
|
||||
|
||||
+ // True if the drag has been canceled.
|
||||
+ bool canceled_;
|
||||
+
|
||||
DISALLOW_COPY_AND_ASSIGN(WebDragDest);
|
||||
};
|
||||
|
||||
Index: public/browser/web_contents_delegate.cc
|
||||
===================================================================
|
||||
--- public/browser/web_contents_delegate.cc (revision 202711)
|
||||
+++ public/browser/web_contents_delegate.cc (working copy)
|
||||
@@ -110,6 +110,13 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+bool WebContentsDelegate::CanDragEnter(
|
||||
+ WebContents* source,
|
||||
+ const WebDropData& data,
|
||||
+ WebKit::WebDragOperationsMask operations_allowed) {
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
bool WebContentsDelegate::OnGoToEntryOffset(int offset) {
|
||||
return true;
|
||||
}
|
||||
Index: public/browser/web_contents_delegate.h
|
||||
===================================================================
|
||||
--- public/browser/web_contents_delegate.h (revision 202711)
|
||||
+++ public/browser/web_contents_delegate.h (working copy)
|
||||
@@ -17,11 +17,13 @@
|
||||
#include "content/public/common/page_transition_types.h"
|
||||
#include "content/public/common/window_container_type.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
#include "ui/gfx/rect_f.h"
|
||||
|
||||
class GURL;
|
||||
+struct WebDropData;
|
||||
|
||||
namespace base {
|
||||
class FilePath;
|
||||
@@ -264,6 +266,13 @@
|
||||
virtual void HandleGestureBegin() {}
|
||||
virtual void HandleGestureEnd() {}
|
||||
|
||||
+ // Called when an external drag event enters the web contents window. Return
|
||||
+ // true to allow dragging and dropping on the web contents window or false to
|
||||
+ // cancel the operation.
|
||||
+ virtual bool CanDragEnter(WebContents* source,
|
||||
+ const WebDropData& data,
|
||||
+ WebKit::WebDragOperationsMask operations_allowed);
|
||||
+
|
||||
// Render view drag n drop ended.
|
||||
virtual void DragEnded() {}
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user