Commit dc3aae19 authored by Marshall Greenblatt's avatar Marshall Greenblatt

Add plugin placeholder and policy support (issue #1708)

- Default plugin loading policy can be specified using the new
  `--plugin-policy=[allow|block|detect]` command-line flag.
- Move CefRequestHandler::OnBeforePluginLoad to
  CefRequestContextHandler and add a new policy argument that
  supports different actions (allow, block, detect, disable) on a
  per-plugin-instance basis.
- Add CefContextMenuHandler::RunContextMenu for providing a custom
  context menu implementation.
- Add CefResourceBundleHandler::GetDataResourceForScale for
  returning scaled resources (issue #1272).
- Add CefResourceBundle for retrieving resources from the resource
  bundle (*.pak) files loaded by CEF during startup or via the
  CefResourceBundleHandler.
- Linux: Fix Debug build IO access warning with CefGetMimeType.
- cef_unittests: Move the refcounting implementation from TestHandler
  to subclasses in order to support interface inheritance from
  subclasses.
parent 846107b2
......@@ -409,6 +409,8 @@
'tests/cefclient/renderer/client_app_renderer.cc',
'tests/cefclient/renderer/client_app_renderer.h',
'tests/cefclient/resources/osr_test.html',
'tests/cefclient/resources/pdf.html',
'tests/cefclient/resources/pdf.pdf',
'tests/unittests/browser_info_map_unittest.cc',
'tests/unittests/command_line_unittest.cc',
'tests/unittests/cookie_unittest.cc',
......@@ -425,6 +427,7 @@
'tests/unittests/navigation_unittest.cc',
'tests/unittests/os_rendering_unittest.cc',
'tests/unittests/parser_unittest.cc',
'tests/unittests/plugin_unittest.cc',
'tests/unittests/print_unittest.cc',
'tests/unittests/process_message_unittest.cc',
'tests/unittests/request_context_unittest.cc',
......@@ -457,6 +460,8 @@
],
'mac_bundle_resources': [
'tests/cefclient/resources/osr_test.html',
'tests/cefclient/resources/pdf.html',
'tests/cefclient/resources/pdf.pdf',
'tests/unittests/mac/unittests.icns',
'tests/unittests/mac/English.lproj/InfoPlist.strings',
'tests/unittests/mac/English.lproj/MainMenu.xib',
......@@ -595,6 +600,8 @@
'destination': '<(PRODUCT_DIR)/files',
'files': [
'tests/cefclient/resources/osr_test.html',
'tests/cefclient/resources/pdf.html',
'tests/cefclient/resources/pdf.pdf',
],
},
],
......@@ -921,6 +928,7 @@
'<(DEPTH)/third_party/WebKit/public/web',
# CEF grit resource includes
'<(DEPTH)/cef/libcef/resources/grit_stub',
'<(DEPTH)/cef/libcef/resources/grit_stub/chrome',
'<(grit_out_dir)',
'<(SHARED_INTERMEDIATE_DIR)/ui/resources',
'<(SHARED_INTERMEDIATE_DIR)/ui/strings',
......@@ -938,6 +946,8 @@
'<(DEPTH)/chrome/chrome.gyp:safe_browsing_proto',
'<(DEPTH)/components/components.gyp:cdm_renderer',
'<(DEPTH)/components/components.gyp:component_updater',
'<(DEPTH)/components/components.gyp:content_settings_core_browser',
'<(DEPTH)/components/components.gyp:content_settings_core_common',
'<(DEPTH)/components/components.gyp:crash_component_breakpad_mac_to_be_deleted',
'<(DEPTH)/components/components.gyp:crx_file',
'<(DEPTH)/components/components.gyp:devtools_discovery',
......@@ -1080,8 +1090,6 @@
'libcef/browser/extensions/pdf_extension_util.h',
'libcef/browser/extensions/pdf_web_contents_helper_client.cc',
'libcef/browser/extensions/pdf_web_contents_helper_client.h',
'libcef/browser/extensions/plugin_info_message_filter.cc',
'libcef/browser/extensions/plugin_info_message_filter.h',
'libcef/browser/extensions/url_request_util.cc',
'libcef/browser/extensions/url_request_util.h',
'libcef/browser/frame_host_impl.cc',
......@@ -1114,6 +1122,8 @@
'libcef/browser/pepper/device_id_fetcher.cc',
'libcef/browser/permission_manager.cc',
'libcef/browser/permission_manager.h',
'libcef/browser/plugins/plugin_info_message_filter.cc',
'libcef/browser/plugins/plugin_info_message_filter.h',
'libcef/browser/print_settings_impl.cc',
'libcef/browser/print_settings_impl.h',
'libcef/browser/printing/printing_message_filter.cc',
......@@ -1210,6 +1220,8 @@
'libcef/common/process_message_impl.h',
'libcef/common/request_impl.cc',
'libcef/common/request_impl.h',
'libcef/common/resource_bundle_impl.cc',
'libcef/common/resource_bundle_impl.h',
'libcef/common/response_impl.cc',
'libcef/common/response_impl.h',
'libcef/common/response_manager.cc',
......@@ -1262,6 +1274,10 @@
'libcef/renderer/pepper/pepper_uma_host.cc',
'libcef/renderer/pepper/renderer_pepper_host_factory.cc',
'libcef/renderer/pepper/renderer_pepper_host_factory.h',
'libcef/renderer/plugins/cef_plugin_placeholder.cc',
'libcef/renderer/plugins/cef_plugin_placeholder.h',
'libcef/renderer/plugins/plugin_preroller.cc',
'libcef/renderer/plugins/plugin_preroller.h',
'libcef/renderer/render_frame_observer.cc',
'libcef/renderer/render_frame_observer.h',
'libcef/renderer/render_message_filter.cc',
......@@ -1403,6 +1419,13 @@
# Include sources for widevine support.
'<(DEPTH)/chrome/common/widevine_cdm_constants.cc',
'<(DEPTH)/chrome/common/widevine_cdm_constants.h',
# Include sources for plugin placeholder support.
'<(DEPTH)/chrome/browser/plugins/plugin_finder.cc',
'<(DEPTH)/chrome/browser/plugins/plugin_finder.h',
'<(DEPTH)/chrome/browser/plugins/plugin_metadata.cc',
'<(DEPTH)/chrome/browser/plugins/plugin_metadata.h',
'<(DEPTH)/components/nacl/common/nacl_constants.cc',
'<(DEPTH)/components/nacl/common/nacl_constants.h',
],
'conditions': [
['OS=="win"', {
......@@ -1754,6 +1777,9 @@
'sources': [
'tests/cefclient/browser/client_app_browser.cc',
'tests/cefclient/browser/client_app_browser.h',
'tests/cefclient/browser/resource_util.h',
'tests/cefclient/browser/resource_util_mac.mm',
'tests/cefclient/browser/resource_util_posix.cc',
'tests/cefclient/common/client_app.cc',
'tests/cefclient/common/client_app.h',
'tests/cefclient/common/client_app_other.cc',
......@@ -1769,6 +1795,7 @@
'tests/unittests/frame_unittest.cc',
'tests/unittests/message_router_unittest.cc',
'tests/unittests/navigation_unittest.cc',
'tests/unittests/plugin_unittest.cc',
'tests/unittests/process_message_unittest.cc',
'tests/unittests/request_handler_unittest.cc',
'tests/unittests/request_unittest.cc',
......
......@@ -11,6 +11,8 @@
'enable_print_preview': 0,
# Enable support for Widevine CDM.
'enable_widevine': 1,
# Disable support for plugin installation.
'enable_plugin_installation': 0,
'conditions': [
# Directory for CEF source files.
[ 'OS=="win"', {
......
......@@ -52,6 +52,7 @@
'include/cef_request_context.h',
'include/cef_request_context_handler.h',
'include/cef_request_handler.h',
'include/cef_resource_bundle.h',
'include/cef_resource_bundle_handler.h',
'include/cef_resource_handler.h',
'include/cef_response.h',
......@@ -110,6 +111,7 @@
'include/capi/cef_request_context_capi.h',
'include/capi/cef_request_context_handler_capi.h',
'include/capi/cef_request_handler_capi.h',
'include/capi/cef_resource_bundle_capi.h',
'include/capi/cef_resource_bundle_handler_capi.h',
'include/capi/cef_resource_handler_capi.h',
'include/capi/cef_response_capi.h',
......@@ -248,12 +250,16 @@
'libcef_dll/ctocpp/request_context_handler_ctocpp.h',
'libcef_dll/ctocpp/request_handler_ctocpp.cc',
'libcef_dll/ctocpp/request_handler_ctocpp.h',
'libcef_dll/cpptoc/resource_bundle_cpptoc.cc',
'libcef_dll/cpptoc/resource_bundle_cpptoc.h',
'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.cc',
'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h',
'libcef_dll/ctocpp/resource_handler_ctocpp.cc',
'libcef_dll/ctocpp/resource_handler_ctocpp.h',
'libcef_dll/cpptoc/response_cpptoc.cc',
'libcef_dll/cpptoc/response_cpptoc.h',
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.cc',
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h',
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.cc',
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h',
'libcef_dll/cpptoc/sslcert_principal_cpptoc.cc',
......@@ -442,12 +448,16 @@
'libcef_dll/cpptoc/request_context_handler_cpptoc.h',
'libcef_dll/cpptoc/request_handler_cpptoc.cc',
'libcef_dll/cpptoc/request_handler_cpptoc.h',
'libcef_dll/ctocpp/resource_bundle_ctocpp.cc',
'libcef_dll/ctocpp/resource_bundle_ctocpp.h',
'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc',
'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h',
'libcef_dll/cpptoc/resource_handler_cpptoc.cc',
'libcef_dll/cpptoc/resource_handler_cpptoc.h',
'libcef_dll/ctocpp/response_ctocpp.cc',
'libcef_dll/ctocpp/response_ctocpp.h',
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.cc',
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h',
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.cc',
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h',
'libcef_dll/ctocpp/sslcert_principal_ctocpp.cc',
......
......@@ -49,6 +49,29 @@ extern "C" {
struct _cef_context_menu_params_t;
///
// Callback structure used for continuation of custom context menu display.
///
typedef struct _cef_run_context_menu_callback_t {
///
// Base structure.
///
cef_base_t base;
///
// Complete context menu display by selecting the specified |command_id| and
// |event_flags|.
///
void (CEF_CALLBACK *cont)(struct _cef_run_context_menu_callback_t* self,
int command_id, cef_event_flags_t event_flags);
///
// Cancel context menu display.
///
void (CEF_CALLBACK *cancel)(struct _cef_run_context_menu_callback_t* self);
} cef_run_context_menu_callback_t;
///
// Implement this structure to handle context menu events. The functions of this
// structure will be called on the UI thread.
......@@ -71,6 +94,20 @@ typedef struct _cef_context_menu_handler_t {
struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params,
struct _cef_menu_model_t* model);
///
// Called to allow custom display of the context menu. |params| provides
// information about the context menu state. |model| contains the context menu
// model resulting from OnBeforeContextMenu. For custom display return true
// (1) and execute |callback| either synchronously or asynchronously with the
// selected command ID. For default display return false (0). Do not keep
// references to |params| or |model| outside of this callback.
///
int (CEF_CALLBACK *run_context_menu)(struct _cef_context_menu_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
struct _cef_context_menu_params_t* params,
struct _cef_menu_model_t* model,
struct _cef_run_context_menu_callback_t* callback);
///
// Called to execute a command selected from the context menu. Return true (1)
// if the command was handled or false (0) for the default implementation. See
......@@ -232,6 +269,18 @@ typedef struct _cef_context_menu_params_t {
///
cef_context_menu_edit_state_flags_t (CEF_CALLBACK *get_edit_state_flags)(
struct _cef_context_menu_params_t* self);
///
// Returns true (1) if the context menu contains items specified by the
// renderer process (for example, plugin placeholder or pepper plugin menu
// items).
///
int (CEF_CALLBACK *is_custom_menu)(struct _cef_context_menu_params_t* self);
///
// Returns true (1) if the context menu was invoked from a pepper plugin.
///
int (CEF_CALLBACK *is_pepper_menu)(struct _cef_context_menu_params_t* self);
} cef_context_menu_params_t;
......
......@@ -40,6 +40,7 @@
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_cookie_capi.h"
#include "include/capi/cef_web_plugin_capi.h"
#ifdef __cplusplus
extern "C" {
......@@ -58,12 +59,30 @@ typedef struct _cef_request_context_handler_t {
cef_base_t base;
///
// Called on the IO thread to retrieve the cookie manager. If this function
// returns NULL the default cookie manager retrievable via
// Called on the browser process IO thread to retrieve the cookie manager. If
// this function returns NULL the default cookie manager retrievable via
// cef_request_tContext::get_default_cookie_manager() will be used.
///
struct _cef_cookie_manager_t* (CEF_CALLBACK *get_cookie_manager)(
struct _cef_request_context_handler_t* self);
///
// Called on the browser process IO thread before a plugin instance is loaded.
// |mime_type| is the mime type of the plugin that will be loaded.
// |plugin_url| is the content URL that the plugin will load and may be NULL.
// |top_origin_url| is the URL for the top-level frame that contains the
// plugin. |plugin_info| includes additional information about the plugin that
// will be loaded. |plugin_policy| is the recommended policy. Modify
// |plugin_policy| and return true (1) to change the policy. Return false (0)
// to use the recommended policy. The default plugin policy can be set at
// runtime using the `--plugin-policy=[allow|detect|block]` command-line flag.
///
int (CEF_CALLBACK *on_before_plugin_load)(
struct _cef_request_context_handler_t* self,
const cef_string_t* mime_type, const cef_string_t* plugin_url,
const cef_string_t* top_origin_url,
struct _cef_web_plugin_info_t* plugin_info,
cef_plugin_policy_t* plugin_policy);
} cef_request_context_handler_t;
......
......@@ -46,7 +46,6 @@
#include "include/capi/cef_resource_handler_capi.h"
#include "include/capi/cef_response_capi.h"
#include "include/capi/cef_ssl_info_capi.h"
#include "include/capi/cef_web_plugin_capi.h"
#ifdef __cplusplus
extern "C" {
......@@ -214,14 +213,6 @@ typedef struct _cef_request_handler_t {
const cef_string_t* request_url, struct _cef_sslinfo_t* ssl_info,
struct _cef_request_callback_t* callback);
///
// Called on the browser process IO thread before a plugin is loaded. Return
// true (1) to block loading of the plugin.
///
int (CEF_CALLBACK *on_before_plugin_load)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser, const cef_string_t* url,
const cef_string_t* policy_url, struct _cef_web_plugin_info_t* info);
///
// Called on the browser process UI thread when a plugin has crashed.
// |plugin_path| is the path of the plugin that crashed.
......
// Copyright (c) 2015 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_RESOURCE_BUNDLE_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Structure used for retrieving resources from the resource bundle (*.pak)
// files loaded by CEF during startup or via the cef_resource_bundle_tHandler
// returned from cef_app_t::GetResourceBundleHandler. See CefSettings for
// additional options related to resource bundle loading. The functions of this
// structure may be called on any thread unless otherwise indicated.
///
typedef struct _cef_resource_bundle_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns the localized string for the specified |string_id| or an NULL
// string if the value is not found. Include cef_pack_strings.h for a listing
// of valid string ID values.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_localized_string)(
struct _cef_resource_bundle_t* self, int string_id);
///
// Retrieves the contents of the specified scale independent |resource_id|. If
// the value is found then |data| and |data_size| will be populated and this
// function will return true (1). If the value is not found then this function
// will return false (0). The returned |data| pointer will remain resident in
// memory and should not be freed. Include cef_pack_resources.h for a listing
// of valid resource ID values.
///
int (CEF_CALLBACK *get_data_resource)(struct _cef_resource_bundle_t* self,
int resource_id, void** data, size_t* data_size);
///
// Retrieves the contents of the specified |resource_id| nearest the scale
// factor |scale_factor|. Use a |scale_factor| value of SCALE_FACTOR_NONE for
// scale independent resources or call GetDataResource instead. If the value
// is found then |data| and |data_size| will be populated and this function
// will return true (1). If the value is not found then this function will
// return false (0). The returned |data| pointer will remain resident in
// memory and should not be freed. Include cef_pack_resources.h for a listing
// of valid resource ID values.
///
int (CEF_CALLBACK *get_data_resource_for_scale)(
struct _cef_resource_bundle_t* self, int resource_id,
cef_scale_factor_t scale_factor, void** data, size_t* data_size);
} cef_resource_bundle_t;
///
// Returns the global resource bundle instance.
///
CEF_EXPORT cef_resource_bundle_t* cef_resource_bundle_get_global();
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
......@@ -46,8 +46,9 @@ extern "C" {
///
// Structure used to implement a custom resource bundle structure. The functions
// of this structure may be called on multiple threads.
// Structure used to implement a custom resource bundle structure. See
// CefSettings for additional options related to resource bundle loading. The
// functions of this structure may be called on multiple threads.
///
typedef struct _cef_resource_bundle_handler_t {
///
......@@ -56,26 +57,38 @@ typedef struct _cef_resource_bundle_handler_t {
cef_base_t base;
///
// Called to retrieve a localized translation for the string specified by
// |message_id|. To provide the translation set |string| to the translation
// string and return true (1). To use the default translation return false
// (0). Supported message IDs are listed in cef_pack_strings.h.
// Called to retrieve a localized translation for the specified |string_id|.
// To provide the translation set |string| to the translation string and
// return true (1). To use the default translation return false (0). Include
// cef_pack_strings.h for a listing of valid string ID values.
///
int (CEF_CALLBACK *get_localized_string)(
struct _cef_resource_bundle_handler_t* self, int message_id,
struct _cef_resource_bundle_handler_t* self, int string_id,
cef_string_t* string);
///
// Called to retrieve data for the resource specified by |resource_id|. To
// provide the resource data set |data| and |data_size| to the data pointer
// Called to retrieve data for the specified scale independent |resource_id|.
// To provide the resource data set |data| and |data_size| to the data pointer
// and size respectively and return true (1). To use the default resource data
// return false (0). The resource data will not be copied and must remain
// resident in memory. Supported resource IDs are listed in
// cef_pack_resources.h.
// resident in memory. Include cef_pack_resources.h for a listing of valid
// resource ID values.
///
int (CEF_CALLBACK *get_data_resource)(
struct _cef_resource_bundle_handler_t* self, int resource_id, void** data,
size_t* data_size);
///
// Called to retrieve data for the specified |resource_id| nearest the scale
// factor |scale_factor|. To provide the resource data set |data| and
// |data_size| to the data pointer and size respectively and return true (1).
// To use the default resource data return false (0). The resource data will
// not be copied and must remain resident in memory. Include
// cef_pack_resources.h for a listing of valid resource ID values.
///
int (CEF_CALLBACK *get_data_resource_for_scale)(
struct _cef_resource_bundle_handler_t* self, int resource_id,
cef_scale_factor_t scale_factor, void** data, size_t* data_size);
} cef_resource_bundle_handler_t;
......
......@@ -39,12 +39,12 @@
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_browser_t;
///
// Information about a specific web plugin.
......
......@@ -45,6 +45,30 @@
class CefContextMenuParams;
///
// Callback interface used for continuation of custom context menu display.
///
/*--cef(source=library)--*/
class CefRunContextMenuCallback : public virtual CefBase {
public:
typedef cef_event_flags_t EventFlags;
///
// Complete context menu display by selecting the specified |command_id| and
// |event_flags|.
///
/*--cef(capi_name=cont)--*/
virtual void Continue(int command_id, EventFlags event_flags) =0;
///
// Cancel context menu display.
///
/*--cef()--*/
virtual void Cancel() =0;
};
///
// Implement this interface to handle context menu events. The methods of this
// class will be called on the UI thread.
......@@ -67,6 +91,23 @@ class CefContextMenuHandler : public virtual CefBase {
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model) {}
///
// Called to allow custom display of the context menu. |params| provides
// information about the context menu state. |model| contains the context menu
// model resulting from OnBeforeContextMenu. For custom display return true
// and execute |callback| either synchronously or asynchronously with the
// selected command ID. For default display return false. Do not keep
// references to |params| or |model| outside of this callback.
///
/*--cef()--*/
virtual bool RunContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model,
CefRefPtr<CefRunContextMenuCallback> callback) {
return false;
}
///
// Called to execute a command selected from the context menu. Return true if
// the command was handled or false for the default implementation. See
......@@ -226,6 +267,19 @@ class CefContextMenuParams : public virtual CefBase {
///
/*--cef(default_retval=CM_EDITFLAG_NONE)--*/
virtual EditStateFlags GetEditStateFlags() =0;
///
// Returns true if the context menu contains items specified by the renderer
// process (for example, plugin placeholder or pepper plugin menu items).
///
/*--cef()--*/
virtual bool IsCustomMenu() =0;
///
// Returns true if the context menu was invoked from a pepper plugin.
///
/*--cef()--*/
virtual bool IsPepperMenu() =0;
};
#endif // CEF_INCLUDE_CEF_CONTEXT_MENU_HANDLER_H_
......@@ -40,6 +40,7 @@
#include "include/cef_base.h"
#include "include/cef_cookie.h"
#include "include/cef_web_plugin.h"
///
// Implement this interface to provide handler implementations. The handler
......@@ -49,13 +50,35 @@
/*--cef(source=client,no_debugct_check)--*/
class CefRequestContextHandler : public virtual CefBase {
public:
typedef cef_plugin_policy_t PluginPolicy;
///
// Called on the IO thread to retrieve the cookie manager. If this method
// returns NULL the default cookie manager retrievable via
// Called on the browser process IO thread to retrieve the cookie manager. If
// this method returns NULL the default cookie manager retrievable via
// CefRequestContext::GetDefaultCookieManager() will be used.
///
/*--cef()--*/
virtual CefRefPtr<CefCookieManager> GetCookieManager() { return NULL; }
///
// Called on the browser process IO thread before a plugin instance is loaded.
// |mime_type| is the mime type of the plugin that will be loaded.
// |plugin_url| is the content URL that the plugin will load and may be empty.
// |top_origin_url| is the URL for the top-level frame that contains the
// plugin. |plugin_info| includes additional information about the plugin that
// will be loaded. |plugin_policy| is the recommended policy. Modify
// |plugin_policy| and return true to change the policy. Return false to use
// the recommended policy. The default plugin policy can be set at runtime
// using the `--plugin-policy=[allow|detect|block]` command-line flag.
///
/*--cef(optional_param=plugin_url)--*/
virtual bool OnBeforePluginLoad(const CefString& mime_type,
const CefString& plugin_url,
const CefString& top_origin_url,
CefRefPtr<CefWebPluginInfo> plugin_info,
PluginPolicy* plugin_policy) {
return false;
}
};
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_HANDLER_H_
......@@ -46,7 +46,6 @@
#include "include/cef_response.h"
#include "include/cef_request.h"
#include "include/cef_ssl_info.h"
#include "include/cef_web_plugin.h"
///
......@@ -248,18 +247,6 @@ class CefRequestHandler : public virtual CefBase {
return false;
}
///
// Called on the browser process IO thread before a plugin is loaded. Return
// true to block loading of the plugin.
///
/*--cef(optional_param=url,optional_param=policy_url)--*/
virtual bool OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
const CefString& url,
const CefString& policy_url,
CefRefPtr<CefWebPluginInfo> info) {
return false;
}
///
// Called on the browser process UI thread when a plugin has crashed.
// |plugin_path| is the path of the plugin that crashed.
......
// Copyright (c) 2015 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,