Add methods for configuring website/content settings (fixes #3490)

This approach is now used to allow popups on a case-by-case basis in
tests instead of globally disabling the popup blocker with the Chrome
runtime.
This commit is contained in:
Marshall Greenblatt
2023-05-25 11:15:06 +00:00
parent ecdfd467f8
commit 5707889555
18 changed files with 1005 additions and 27 deletions

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=c2a6265e8e9acce475a8b5755a8c58b97b495207$
// $hash=1c3c3dfb4bde6cd45278c6a80fbc53f624017c44$
//
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
@@ -46,6 +46,7 @@
#include "include/capi/cef_extension_handler_capi.h"
#include "include/capi/cef_media_router_capi.h"
#include "include/capi/cef_preference_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
extern "C" {
@@ -301,6 +302,72 @@ typedef struct _cef_request_context_t {
struct _cef_media_router_t*(CEF_CALLBACK* get_media_router)(
struct _cef_request_context_t* self,
struct _cef_completion_callback_t* callback);
///
/// Returns the current value for |content_type| that applies for the
/// specified URLs. If both URLs are NULL the default value will be returned.
/// Returns nullptr if no value is configured. Must be called on the browser
/// process UI thread.
///
struct _cef_value_t*(CEF_CALLBACK* get_website_setting)(
struct _cef_request_context_t* self,
const cef_string_t* requesting_url,
const cef_string_t* top_level_url,
cef_content_setting_types_t content_type);
///
/// Sets the current value for |content_type| for the specified URLs in the
/// default scope. If both URLs are NULL, and the context is not incognito,
/// the default value will be set. Pass nullptr for |value| to remove the
/// default value for this content type.
///
/// WARNING: Incorrect usage of this function may cause instability or
/// security issues in Chromium. Make sure that you first understand the
/// potential impact of any changes to |content_type| by reviewing the related
/// source code in Chromium. For example, if you plan to modify
/// CEF_CONTENT_SETTING_TYPE_POPUPS, first review and understand the usage of
/// ContentSettingsType::POPUPS in Chromium:
/// https://source.chromium.org/search?q=ContentSettingsType::POPUPS
///
void(CEF_CALLBACK* set_website_setting)(
struct _cef_request_context_t* self,
const cef_string_t* requesting_url,
const cef_string_t* top_level_url,
cef_content_setting_types_t content_type,
struct _cef_value_t* value);
///
/// Returns the current value for |content_type| that applies for the
/// specified URLs. If both URLs are NULL the default value will be returned.
/// Returns CEF_CONTENT_SETTING_VALUE_DEFAULT if no value is configured. Must
/// be called on the browser process UI thread.
///
cef_content_setting_values_t(CEF_CALLBACK* get_content_setting)(
struct _cef_request_context_t* self,
const cef_string_t* requesting_url,
const cef_string_t* top_level_url,
cef_content_setting_types_t content_type);
///
/// Sets the current value for |content_type| for the specified URLs in the
/// default scope. If both URLs are NULL, and the context is not incognito,
/// the default value will be set. Pass CEF_CONTENT_SETTING_VALUE_DEFAULT for
/// |value| to use the default value for this content type.
///
/// WARNING: Incorrect usage of this function may cause instability or
/// security issues in Chromium. Make sure that you first understand the
/// potential impact of any changes to |content_type| by reviewing the related
/// source code in Chromium. For example, if you plan to modify
/// CEF_CONTENT_SETTING_TYPE_POPUPS, first review and understand the usage of
/// ContentSettingsType::POPUPS in Chromium:
/// https://source.chromium.org/search?q=ContentSettingsType::POPUPS
///
void(CEF_CALLBACK* set_content_setting)(
struct _cef_request_context_t* self,
const cef_string_t* requesting_url,
const cef_string_t* top_level_url,
cef_content_setting_types_t content_type,
cef_content_setting_values_t value);
} cef_request_context_t;
///