mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CefPermissionHandler callbacks for permission prompts (see issue #3352)
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=e25fb66e356e1f01d67cb86433382b3318e9778d$
|
||||
// $hash=5a39566f586c012271d96c7d42337a30bf98e6b8$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PERMISSION_HANDLER_CAPI_H_
|
||||
@@ -74,6 +74,22 @@ typedef struct _cef_media_access_callback_t {
|
||||
void(CEF_CALLBACK* cancel)(struct _cef_media_access_callback_t* self);
|
||||
} cef_media_access_callback_t;
|
||||
|
||||
///
|
||||
// Callback structure used for asynchronous continuation of permission prompts.
|
||||
///
|
||||
typedef struct _cef_permission_prompt_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Complete the permissions request with the specified |result|.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_permission_prompt_callback_t* self,
|
||||
cef_permission_request_result_t result);
|
||||
} cef_permission_prompt_callback_t;
|
||||
|
||||
///
|
||||
// Implement this structure to handle events related to permission requests. The
|
||||
// functions of this structure will be called on the browser process UI thread.
|
||||
@@ -85,11 +101,11 @@ typedef struct _cef_permission_handler_t {
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Called when a page requests permission to access media. |requesting_url| is
|
||||
// the URL requesting permission. |requested_permissions| is a combination of
|
||||
// values from cef_media_access_permission_types_t that represent the
|
||||
// requested permissions. Return true (1) and call
|
||||
// cef_media_access_callback_t::cont() either in this function or at a later
|
||||
// Called when a page requests permission to access media. |requesting_origin|
|
||||
// is the URL origin requesting permission. |requested_permissions| is a
|
||||
// combination of values from cef_media_access_permission_types_t that
|
||||
// represent the requested permissions. Return true (1) and call
|
||||
// cef_media_access_callback_t functions either in this function or at a later
|
||||
// time to continue or cancel the request. Return false (0) to cancel the
|
||||
// request immediately. This function will not be called if the "--enable-
|
||||
// media-stream" command-line switch is used to grant all permissions.
|
||||
@@ -98,9 +114,43 @@ typedef struct _cef_permission_handler_t {
|
||||
struct _cef_permission_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
const cef_string_t* requesting_url,
|
||||
const cef_string_t* requesting_origin,
|
||||
uint32 requested_permissions,
|
||||
struct _cef_media_access_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called when a page should show a permission prompt. |prompt_id| uniquely
|
||||
// identifies the prompt. |requesting_origin| is the URL origin requesting
|
||||
// permission. |requested_permissions| is a combination of values from
|
||||
// cef_permission_request_types_t that represent the requested permissions.
|
||||
// Return true (1) and call cef_permission_prompt_callback_t::Continue either
|
||||
// in this function or at a later time to continue or cancel the request.
|
||||
// Return false (0) to proceed with default handling. With the Chrome runtime,
|
||||
// default handling will display the permission prompt UI. With the Alloy
|
||||
// runtime, default handling is CEF_PERMISSION_RESULT_IGNORE.
|
||||
///
|
||||
int(CEF_CALLBACK* on_show_permission_prompt)(
|
||||
struct _cef_permission_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
uint64 prompt_id,
|
||||
const cef_string_t* requesting_origin,
|
||||
uint32 requested_permissions,
|
||||
struct _cef_permission_prompt_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called when a permission prompt handled via OnShowPermissionPrompt is
|
||||
// dismissed. |prompt_id| will match the value that was passed to
|
||||
// OnShowPermissionPrompt. |result| will be the value passed to
|
||||
// cef_permission_prompt_callback_t::Continue or CEF_PERMISSION_RESULT_IGNORE
|
||||
// if the dialog was dismissed for other reasons such as navigation, browser
|
||||
// closure, etc. This function will not be called if OnShowPermissionPrompt
|
||||
// returned false (0) for |prompt_id|.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dismiss_permission_prompt)(
|
||||
struct _cef_permission_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
uint64 prompt_id,
|
||||
cef_permission_request_result_t result);
|
||||
} cef_permission_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Reference in New Issue
Block a user