summaryrefslogtreecommitdiffstats
path: root/chrome/common/chrome_plugin_api.h
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 19:22:56 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 19:22:56 +0000
commit0167204bc9a6f6873af4b92c8f0969d5ae465088 (patch)
tree95e5e2d475da2c25152ebe31689fc8e1f74acf16 /chrome/common/chrome_plugin_api.h
parent89518924aa928807e7d5daf4d59fdb969cd19494 (diff)
downloadchromium_src-0167204bc9a6f6873af4b92c8f0969d5ae465088.zip
chromium_src-0167204bc9a6f6873af4b92c8f0969d5ae465088.tar.gz
chromium_src-0167204bc9a6f6873af4b92c8f0969d5ae465088.tar.bz2
CPAPI gears drag drop and renderer IPC....
CPAPI (0.10) functions for gears drag drop; one to extract the drag type/data given an NPObject *event, one to override the drop effect (drag cursor). Gears drag drop API receives a browser event as an NPObject* so the event is untrusted. Provide IPC calls to the renderer so gears can pass the event to renderer/V8 for checking, prior to drag type/data extraction, or the setting of the drop effect. V8 event checking is a TODO(noel), http://mondrian/10947778 for the CPAPI (0.10) change submitted to gears. BUG=7995 Original patch by Noel Gordon via: http://codereview.chromium.org/99240 Review URL: http://codereview.chromium.org/115280 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15986 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/chrome_plugin_api.h')
-rw-r--r--chrome/common/chrome_plugin_api.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/chrome/common/chrome_plugin_api.h b/chrome/common/chrome_plugin_api.h
index 384e9c2..c10985a 100644
--- a/chrome/common/chrome_plugin_api.h
+++ b/chrome/common/chrome_plugin_api.h
@@ -30,7 +30,7 @@ extern "C" {
// The current version of the API, used by the 'version' field of CPPluginFuncs
// and CPBrowserFuncs.
#define CP_MAJOR_VERSION 0
-#define CP_MINOR_VERSION 9
+#define CP_MINOR_VERSION 10
#define CP_VERSION ((CP_MAJOR_VERSION << 8) | (CP_MINOR_VERSION))
#define CP_GET_MAJOR_VERSION(version) ((version & 0xff00) >> 8)
@@ -414,6 +414,37 @@ typedef void (STDCALL *CPP_OnFileDialogResultFunc)(void *data,
const char **files,
uint32 files_len);
+// Asks the browser to verify that NPObject* 'event' is the current drag event
+// the browser is dispatching, and extract drag data from the event if so. On
+// success, returns the drag 'identity' (an up-counter that the browser chrome
+// increases each time a user drag enters a renderer tab), the drag 'event_id'
+// and the 'drag_type' being a utf8 encoded string with values "Files", "Text"
+// or "URL". If 'add_data' is true, also return the 'drag_data', again a utf8
+// encoded string with the data for the drag type. For drag type "Files", the
+// data is a backspace delimited list of file paths.
+//
+// The call fails with a CPError if 'event' is an invalid drag event, and sets
+// the 'identity' and 'event_id' to 0. Note: on success, non-NULL 'drag_type'
+// and 'drag_data' should be freed with CPB_Free() when done.
+typedef CPError (STDCALL *CPB_GetDragDataFunc)(
+ CPID id, CPBrowsingContext context, struct NPObject* event, bool add_data,
+ int32* identity, int32* event_id, char** drag_type, char** drag_data);
+
+// Asks the browser to verify that NPObject* 'event' is the current drag event
+// the browser is dispatching and show the requested drop 'effect' if so. The
+// browser displays drop effects during dragenter and dragover events, to give
+// user visible feedback (with a drag cursor, typically) to indicate whether a
+// subsequent drop event will succeed or not. The implementation supports the
+// so-called "copy" and "none" effects. When 'effect' is non-zero, the "copy"
+// effect is shown. Otherwise, the "none" effect is shown, which prevents the
+// subsequent drop event from succeeding. Returns CPError on failure, meaning
+// the 'event' is an invalid drag event.
+//
+// Note: 'effect' is int to allow for new effects in future. For example, the
+// HTML5-defined drop effects "move" and "link".
+typedef CPError (STDCALL *CPB_SetDropEffectFunc)(
+ CPID id, CPBrowsingContext context, struct NPObject* event, int effect);
+
// Function table for issuing requests using via the other side's network stack.
// For the plugin, this functions deal with issuing requests through the
// browser. For the browser, these functions deal with allowing the plugin to
@@ -488,6 +519,8 @@ typedef struct _CPBrowserFuncs {
CPB_SendSyncMessageFunc send_sync_message;
CPB_PluginThreadAsyncCallFunc plugin_thread_async_call;
CPB_OpenFileDialogFunc open_file_dialog;
+ CPB_GetDragDataFunc get_drag_data;
+ CPB_SetDropEffectFunc set_drop_effect;
} CPBrowserFuncs;