mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-16 20:20:51 +01:00
Add new CefRequestHandler::OnBeforePluginLoad callback and functions for controlling plugin loading and life span (issue #645).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@822 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
ccb2b296ac
commit
a3ac7b446f
1
cef.gyp
1
cef.gyp
@ -845,6 +845,7 @@
|
|||||||
'libcef/browser/url_request_interceptor.cc',
|
'libcef/browser/url_request_interceptor.cc',
|
||||||
'libcef/browser/url_request_interceptor.h',
|
'libcef/browser/url_request_interceptor.h',
|
||||||
'libcef/browser/web_plugin_impl.cc',
|
'libcef/browser/web_plugin_impl.cc',
|
||||||
|
'libcef/browser/web_plugin_impl.h',
|
||||||
'libcef/browser/xml_reader_impl.cc',
|
'libcef/browser/xml_reader_impl.cc',
|
||||||
'libcef/browser/xml_reader_impl.h',
|
'libcef/browser/xml_reader_impl.h',
|
||||||
'libcef/browser/zip_reader_impl.cc',
|
'libcef/browser/zip_reader_impl.cc',
|
||||||
|
@ -228,6 +228,8 @@
|
|||||||
'libcef_dll/cpptoc/web_plugin_info_cpptoc.h',
|
'libcef_dll/cpptoc/web_plugin_info_cpptoc.h',
|
||||||
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc',
|
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h',
|
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/write_handler_ctocpp.cc',
|
'libcef_dll/ctocpp/write_handler_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/write_handler_ctocpp.h',
|
'libcef_dll/ctocpp/write_handler_ctocpp.h',
|
||||||
'libcef_dll/cpptoc/xml_reader_cpptoc.cc',
|
'libcef_dll/cpptoc/xml_reader_cpptoc.cc',
|
||||||
@ -364,6 +366,8 @@
|
|||||||
'libcef_dll/ctocpp/web_plugin_info_ctocpp.h',
|
'libcef_dll/ctocpp/web_plugin_info_ctocpp.h',
|
||||||
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc',
|
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h',
|
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/write_handler_cpptoc.cc',
|
'libcef_dll/cpptoc/write_handler_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/write_handler_cpptoc.h',
|
'libcef_dll/cpptoc/write_handler_cpptoc.h',
|
||||||
'libcef_dll/ctocpp/xml_reader_ctocpp.cc',
|
'libcef_dll/ctocpp/xml_reader_ctocpp.cc',
|
||||||
|
@ -173,6 +173,14 @@ typedef struct _cef_request_handler_t {
|
|||||||
void (CEF_CALLBACK *on_protocol_execution)(
|
void (CEF_CALLBACK *on_protocol_execution)(
|
||||||
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
|
||||||
const cef_string_t* url, int* allow_os_execution);
|
const cef_string_t* url, int* allow_os_execution);
|
||||||
|
|
||||||
|
///
|
||||||
|
// 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);
|
||||||
} cef_request_handler_t;
|
} cef_request_handler_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,11 +46,66 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Visit web plugin information.
|
// Visit web plugin information. Can be called on any thread in the browser
|
||||||
|
// process.
|
||||||
///
|
///
|
||||||
CEF_EXPORT void cef_visit_web_plugin_info(
|
CEF_EXPORT void cef_visit_web_plugin_info(
|
||||||
struct _cef_web_plugin_info_visitor_t* visitor);
|
struct _cef_web_plugin_info_visitor_t* visitor);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Cause the plugin list to refresh the next time it is accessed regardless of
|
||||||
|
// whether it has already been loaded. Can be called on any thread in the
|
||||||
|
// browser process.
|
||||||
|
///
|
||||||
|
CEF_EXPORT void cef_refresh_web_plugins();
|
||||||
|
|
||||||
|
///
|
||||||
|
// Add a plugin path (directory + file). This change may not take affect until
|
||||||
|
// after cef_refresh_web_plugins() is called. Can be called on any thread in the
|
||||||
|
// browser process.
|
||||||
|
///
|
||||||
|
CEF_EXPORT void cef_add_web_plugin_path(const cef_string_t* path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Add a plugin directory. This change may not take affect until after
|
||||||
|
// cef_refresh_web_plugins() is called. Can be called on any thread in the
|
||||||
|
// browser process.
|
||||||
|
///
|
||||||
|
CEF_EXPORT void cef_add_web_plugin_directory(const cef_string_t* dir);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Remove a plugin path (directory + file). This change may not take affect
|
||||||
|
// until after cef_refresh_web_plugins() is called. Can be called on any thread
|
||||||
|
// in the browser process.
|
||||||
|
///
|
||||||
|
CEF_EXPORT void cef_remove_web_plugin_path(const cef_string_t* path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Unregister an internal plugin. This may be undone the next time
|
||||||
|
// cef_refresh_web_plugins() is called. Can be called on any thread in the
|
||||||
|
// browser process.
|
||||||
|
///
|
||||||
|
CEF_EXPORT void cef_unregister_internal_web_plugin(const cef_string_t* path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Force a plugin to shutdown. Can be called on any thread in the browser
|
||||||
|
// process but will be executed on the IO thread.
|
||||||
|
///
|
||||||
|
CEF_EXPORT void cef_force_web_plugin_shutdown(const cef_string_t* path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Register a plugin crash. Can be called on any thread in the browser process
|
||||||
|
// but will be executed on the IO thread.
|
||||||
|
///
|
||||||
|
CEF_EXPORT void cef_register_web_plugin_crash(const cef_string_t* path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Query if a plugin is unstable. Can be called on any thread in the browser
|
||||||
|
// process.
|
||||||
|
///
|
||||||
|
CEF_EXPORT void cef_is_web_plugin_unstable(const cef_string_t* path,
|
||||||
|
struct _cef_web_plugin_unstable_callback_t* callback);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Information about a specific web plugin.
|
// Information about a specific web plugin.
|
||||||
///
|
///
|
||||||
@ -92,7 +147,7 @@ typedef struct _cef_web_plugin_info_t {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// Structure to implement for visiting web plugin information. The functions of
|
// Structure to implement for visiting web plugin information. The functions of
|
||||||
// this structure will be called on the UI thread.
|
// this structure will be called on the browser process UI thread.
|
||||||
///
|
///
|
||||||
typedef struct _cef_web_plugin_info_visitor_t {
|
typedef struct _cef_web_plugin_info_visitor_t {
|
||||||
///
|
///
|
||||||
@ -111,6 +166,27 @@ typedef struct _cef_web_plugin_info_visitor_t {
|
|||||||
} cef_web_plugin_info_visitor_t;
|
} cef_web_plugin_info_visitor_t;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
// Structure to implement for receiving unstable plugin information. The
|
||||||
|
// functions of this structure will be called on the browser process IO thread.
|
||||||
|
///
|
||||||
|
typedef struct _cef_web_plugin_unstable_callback_t {
|
||||||
|
///
|
||||||
|
// Base structure.
|
||||||
|
///
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Method that will be called for the requested plugin. |unstable| will be
|
||||||
|
// true (1) if the plugin has reached the crash count threshold of 3 times in
|
||||||
|
// 120 seconds.
|
||||||
|
///
|
||||||
|
void (CEF_CALLBACK *is_unstable)(
|
||||||
|
struct _cef_web_plugin_unstable_callback_t* self,
|
||||||
|
const cef_string_t* path, int unstable);
|
||||||
|
} cef_web_plugin_unstable_callback_t;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "include/cef_resource_handler.h"
|
#include "include/cef_resource_handler.h"
|
||||||
#include "include/cef_response.h"
|
#include "include/cef_response.h"
|
||||||
#include "include/cef_request.h"
|
#include "include/cef_request.h"
|
||||||
|
#include "include/cef_web_plugin.h"
|
||||||
|
|
||||||
///
|
///
|
||||||
// Callback interface used for asynchronous continuation of authentication
|
// Callback interface used for asynchronous continuation of authentication
|
||||||
@ -190,6 +191,18 @@ class CefRequestHandler : public virtual CefBase {
|
|||||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& url,
|
const CefString& url,
|
||||||
bool& allow_os_execution) {}
|
bool& allow_os_execution) {}
|
||||||
|
|
||||||
|
///
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CEF_REQUEST_HANDLER_H_
|
#endif // CEF_INCLUDE_CEF_REQUEST_HANDLER_H_
|
||||||
|
@ -38,16 +38,7 @@
|
|||||||
#define CEF_INCLUDE_CEF_WEB_PLUGIN_H_
|
#define CEF_INCLUDE_CEF_WEB_PLUGIN_H_
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
|
#include "include/cef_browser.h"
|
||||||
class CefWebPluginInfoVisitor;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
// Visit web plugin information.
|
|
||||||
///
|
|
||||||
/*--cef()--*/
|
|
||||||
void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor);
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Information about a specific web plugin.
|
// Information about a specific web plugin.
|
||||||
@ -80,10 +71,9 @@ class CefWebPluginInfo : public virtual CefBase {
|
|||||||
virtual CefString GetDescription() =0;
|
virtual CefString GetDescription() =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Interface to implement for visiting web plugin information. The methods of
|
// Interface to implement for visiting web plugin information. The methods of
|
||||||
// this class will be called on the UI thread.
|
// this class will be called on the browser process UI thread.
|
||||||
///
|
///
|
||||||
/*--cef(source=client)--*/
|
/*--cef(source=client)--*/
|
||||||
class CefWebPluginInfoVisitor : public virtual CefBase {
|
class CefWebPluginInfoVisitor : public virtual CefBase {
|
||||||
@ -98,4 +88,91 @@ class CefWebPluginInfoVisitor : public virtual CefBase {
|
|||||||
virtual bool Visit(CefRefPtr<CefWebPluginInfo> info, int count, int total) =0;
|
virtual bool Visit(CefRefPtr<CefWebPluginInfo> info, int count, int total) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
// Visit web plugin information. Can be called on any thread in the browser
|
||||||
|
// process.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Cause the plugin list to refresh the next time it is accessed regardless
|
||||||
|
// of whether it has already been loaded. Can be called on any thread in the
|
||||||
|
// browser process.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
void CefRefreshWebPlugins();
|
||||||
|
|
||||||
|
///
|
||||||
|
// Add a plugin path (directory + file). This change may not take affect until
|
||||||
|
// after CefRefreshWebPlugins() is called. Can be called on any thread in the
|
||||||
|
// browser process.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
void CefAddWebPluginPath(const CefString& path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Add a plugin directory. This change may not take affect until after
|
||||||
|
// CefRefreshWebPlugins() is called. Can be called on any thread in the browser
|
||||||
|
// process.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
void CefAddWebPluginDirectory(const CefString& dir);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Remove a plugin path (directory + file). This change may not take affect
|
||||||
|
// until after CefRefreshWebPlugins() is called. Can be called on any thread in
|
||||||
|
// the browser process.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
void CefRemoveWebPluginPath(const CefString& path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Unregister an internal plugin. This may be undone the next time
|
||||||
|
// CefRefreshWebPlugins() is called. Can be called on any thread in the browser
|
||||||
|
// process.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
void CefUnregisterInternalWebPlugin(const CefString& path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Force a plugin to shutdown. Can be called on any thread in the browser
|
||||||
|
// process but will be executed on the IO thread.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
void CefForceWebPluginShutdown(const CefString& path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Register a plugin crash. Can be called on any thread in the browser process
|
||||||
|
// but will be executed on the IO thread.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
void CefRegisterWebPluginCrash(const CefString& path);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Interface to implement for receiving unstable plugin information. The methods
|
||||||
|
// of this class will be called on the browser process IO thread.
|
||||||
|
///
|
||||||
|
/*--cef(source=client)--*/
|
||||||
|
class CefWebPluginUnstableCallback : public virtual CefBase {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
// Method that will be called for the requested plugin. |unstable| will be
|
||||||
|
// true if the plugin has reached the crash count threshold of 3 times in 120
|
||||||
|
// seconds.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual void IsUnstable(const CefString& path,
|
||||||
|
bool unstable) =0;
|
||||||
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
// Query if a plugin is unstable. Can be called on any thread in the browser
|
||||||
|
// process.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
void CefIsWebPluginUnstable(const CefString& path,
|
||||||
|
CefRefPtr<CefWebPluginUnstableCallback> callback);
|
||||||
|
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CEF_WEB_PLUGIN_H_
|
#endif // CEF_INCLUDE_CEF_WEB_PLUGIN_H_
|
||||||
|
@ -14,14 +14,17 @@
|
|||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/resource_dispatcher_host_delegate.h"
|
#include "libcef/browser/resource_dispatcher_host_delegate.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
#include "libcef/browser/web_plugin_impl.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/command_line_impl.h"
|
#include "libcef/common/command_line_impl.h"
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
|
#include "content/browser/plugin_service_impl.h"
|
||||||
#include "content/public/browser/access_token_store.h"
|
#include "content/public/browser/access_token_store.h"
|
||||||
#include "content/public/browser/media_observer.h"
|
#include "content/public/browser/media_observer.h"
|
||||||
|
#include "content/public/browser/plugin_service_filter.h"
|
||||||
#include "content/public/browser/quota_permission_context.h"
|
#include "content/public/browser/quota_permission_context.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/browser/resource_dispatcher_host.h"
|
#include "content/public/browser/resource_dispatcher_host.h"
|
||||||
@ -161,6 +164,42 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CefPluginServiceFilter : public content::PluginServiceFilter {
|
||||||
|
public:
|
||||||
|
CefPluginServiceFilter() {}
|
||||||
|
virtual ~CefPluginServiceFilter() {}
|
||||||
|
|
||||||
|
virtual bool ShouldUsePlugin(int render_process_id,
|
||||||
|
int render_view_id,
|
||||||
|
const void* context,
|
||||||
|
const GURL& url,
|
||||||
|
const GURL& policy_url,
|
||||||
|
webkit::WebPluginInfo* plugin) OVERRIDE {
|
||||||
|
bool allowed = true;
|
||||||
|
|
||||||
|
CefRefPtr<CefBrowserHostImpl> browser =
|
||||||
|
CefBrowserHostImpl::GetBrowserByRoutingID(render_process_id,
|
||||||
|
render_view_id);
|
||||||
|
if (browser.get()) {
|
||||||
|
CefRefPtr<CefClient> client = browser->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||||
|
if (handler.get()) {
|
||||||
|
CefRefPtr<CefWebPluginInfoImpl> pluginInfo(
|
||||||
|
new CefWebPluginInfoImpl(*plugin));
|
||||||
|
allowed =
|
||||||
|
!handler->OnBeforePluginLoad(browser.get(),
|
||||||
|
url.possibly_invalid_spec(),
|
||||||
|
policy_url.possibly_invalid_spec(),
|
||||||
|
pluginInfo.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return allowed;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
@ -192,6 +231,8 @@ class CefMediaObserver : public content::MediaObserver {
|
|||||||
|
|
||||||
CefContentBrowserClient::CefContentBrowserClient()
|
CefContentBrowserClient::CefContentBrowserClient()
|
||||||
: browser_main_parts_(NULL) {
|
: browser_main_parts_(NULL) {
|
||||||
|
plugin_service_filter_.reset(new CefPluginServiceFilter);
|
||||||
|
PluginServiceImpl::GetInstance()->SetFilter(plugin_service_filter_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
CefContentBrowserClient::~CefContentBrowserClient() {
|
CefContentBrowserClient::~CefContentBrowserClient() {
|
||||||
|
@ -19,6 +19,7 @@ class CefMediaObserver;
|
|||||||
class CefResourceDispatcherHostDelegate;
|
class CefResourceDispatcherHostDelegate;
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
class PluginServiceFilter;
|
||||||
class SiteInstance;
|
class SiteInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
CefBrowserMainParts* browser_main_parts_;
|
CefBrowserMainParts* browser_main_parts_;
|
||||||
|
|
||||||
scoped_ptr<CefMediaObserver> media_observer_;
|
scoped_ptr<CefMediaObserver> media_observer_;
|
||||||
|
scoped_ptr<content::PluginServiceFilter> plugin_service_filter_;
|
||||||
scoped_ptr<CefResourceDispatcherHostDelegate>
|
scoped_ptr<CefResourceDispatcherHostDelegate>
|
||||||
resource_dispatcher_host_delegate_;
|
resource_dispatcher_host_delegate_;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "include/cef_web_plugin.h"
|
#include "libcef/browser/web_plugin_impl.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
@ -12,34 +12,6 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class CefWebPluginInfoImpl : public CefWebPluginInfo {
|
|
||||||
public:
|
|
||||||
explicit CefWebPluginInfoImpl(const webkit::WebPluginInfo& plugin_info)
|
|
||||||
: plugin_info_(plugin_info) {
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual CefString GetName() OVERRIDE {
|
|
||||||
return plugin_info_.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual CefString GetPath() OVERRIDE {
|
|
||||||
return plugin_info_.path.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual CefString GetVersion() OVERRIDE {
|
|
||||||
return plugin_info_.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual CefString GetDescription() OVERRIDE {
|
|
||||||
return plugin_info_.desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
webkit::WebPluginInfo plugin_info_;
|
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(CefWebPluginInfoImpl);
|
|
||||||
};
|
|
||||||
|
|
||||||
void PluginsCallbackImpl(
|
void PluginsCallbackImpl(
|
||||||
CefRefPtr<CefWebPluginInfoVisitor> visitor,
|
CefRefPtr<CefWebPluginInfoVisitor> visitor,
|
||||||
const std::vector<webkit::WebPluginInfo>& all_plugins) {
|
const std::vector<webkit::WebPluginInfo>& all_plugins) {
|
||||||
@ -58,6 +30,33 @@ void PluginsCallbackImpl(
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
|
// CefWebPluginInfoImpl
|
||||||
|
|
||||||
|
CefWebPluginInfoImpl::CefWebPluginInfoImpl(
|
||||||
|
const webkit::WebPluginInfo& plugin_info)
|
||||||
|
: plugin_info_(plugin_info) {
|
||||||
|
}
|
||||||
|
|
||||||
|
CefString CefWebPluginInfoImpl::GetName() {
|
||||||
|
return plugin_info_.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefString CefWebPluginInfoImpl::GetPath() {
|
||||||
|
return plugin_info_.path.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
CefString CefWebPluginInfoImpl::GetVersion() {
|
||||||
|
return plugin_info_.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefString CefWebPluginInfoImpl::GetDescription() {
|
||||||
|
return plugin_info_.desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Global functions.
|
||||||
|
|
||||||
void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor) {
|
void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor) {
|
||||||
// Verify that the context is in a valid state.
|
// Verify that the context is in a valid state.
|
||||||
if (!CONTEXT_STATE_VALID()) {
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
@ -65,6 +64,11 @@ void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!visitor.get()) {
|
||||||
|
NOTREACHED() << "invalid parameter";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (CEF_CURRENTLY_ON_UIT()) {
|
if (CEF_CURRENTLY_ON_UIT()) {
|
||||||
PluginServiceImpl::GetInstance()->GetPlugins(
|
PluginServiceImpl::GetInstance()->GetPlugins(
|
||||||
base::Bind(PluginsCallbackImpl, visitor));
|
base::Bind(PluginsCallbackImpl, visitor));
|
||||||
@ -73,3 +77,141 @@ void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor) {
|
|||||||
CEF_POST_TASK(CEF_UIT, base::Bind(CefVisitWebPluginInfo, visitor));
|
CEF_POST_TASK(CEF_UIT, base::Bind(CefVisitWebPluginInfo, visitor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefRefreshWebPlugins() {
|
||||||
|
// Verify that the context is in a valid state.
|
||||||
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
|
NOTREACHED() << "context not valid";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No thread affinity.
|
||||||
|
PluginServiceImpl::GetInstance()->RefreshPlugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefAddWebPluginPath(const CefString& path) {
|
||||||
|
// Verify that the context is in a valid state.
|
||||||
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
|
NOTREACHED() << "context not valid";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.empty()) {
|
||||||
|
NOTREACHED() << "invalid parameter";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No thread affinity.
|
||||||
|
PluginServiceImpl::GetInstance()->AddExtraPluginPath(FilePath(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefAddWebPluginDirectory(const CefString& dir) {
|
||||||
|
// Verify that the context is in a valid state.
|
||||||
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
|
NOTREACHED() << "context not valid";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dir.empty()) {
|
||||||
|
NOTREACHED() << "invalid parameter";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No thread affinity.
|
||||||
|
PluginServiceImpl::GetInstance()->AddExtraPluginDir(FilePath(dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefRemoveWebPluginPath(const CefString& path) {
|
||||||
|
// Verify that the context is in a valid state.
|
||||||
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
|
NOTREACHED() << "context not valid";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.empty()) {
|
||||||
|
NOTREACHED() << "invalid parameter";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No thread affinity.
|
||||||
|
PluginServiceImpl::GetInstance()->RemoveExtraPluginPath(FilePath(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefUnregisterInternalWebPlugin(const CefString& path) {
|
||||||
|
// Verify that the context is in a valid state.
|
||||||
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
|
NOTREACHED() << "context not valid";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.empty()) {
|
||||||
|
NOTREACHED() << "invalid parameter";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No thread affinity.
|
||||||
|
PluginServiceImpl::GetInstance()->UnregisterInternalPlugin(FilePath(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefForceWebPluginShutdown(const CefString& path) {
|
||||||
|
// Verify that the context is in a valid state.
|
||||||
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
|
NOTREACHED() << "context not valid";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.empty()) {
|
||||||
|
NOTREACHED() << "invalid parameter";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CEF_CURRENTLY_ON_IOT()) {
|
||||||
|
PluginServiceImpl::GetInstance()->ForcePluginShutdown(FilePath(path));
|
||||||
|
} else {
|
||||||
|
// Execute on the IO thread.
|
||||||
|
CEF_POST_TASK(CEF_IOT, base::Bind(CefForceWebPluginShutdown, path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefRegisterWebPluginCrash(const CefString& path) {
|
||||||
|
// Verify that the context is in a valid state.
|
||||||
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
|
NOTREACHED() << "context not valid";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.empty()) {
|
||||||
|
NOTREACHED() << "invalid parameter";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CEF_CURRENTLY_ON_IOT()) {
|
||||||
|
PluginServiceImpl::GetInstance()->RegisterPluginCrash(FilePath(path));
|
||||||
|
} else {
|
||||||
|
// Execute on the IO thread.
|
||||||
|
CEF_POST_TASK(CEF_IOT, base::Bind(CefRegisterWebPluginCrash, path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefIsWebPluginUnstable(
|
||||||
|
const CefString& path,
|
||||||
|
CefRefPtr<CefWebPluginUnstableCallback> callback) {
|
||||||
|
// Verify that the context is in a valid state.
|
||||||
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
|
NOTREACHED() << "context not valid";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.empty() || !callback.get()) {
|
||||||
|
NOTREACHED() << "invalid parameter";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CEF_CURRENTLY_ON_IOT()) {
|
||||||
|
callback->IsUnstable(path,
|
||||||
|
PluginServiceImpl::GetInstance()->IsPluginUnstable(FilePath(path)));
|
||||||
|
} else {
|
||||||
|
// Execute on the IO thread.
|
||||||
|
CEF_POST_TASK(CEF_IOT, base::Bind(CefIsWebPluginUnstable, path, callback));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
27
libcef/browser/web_plugin_impl.h
Normal file
27
libcef/browser/web_plugin_impl.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) 2012 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_BROWSER_WEB_PLUGIN_IMPL_H_
|
||||||
|
#define CEF_LIBCEF_BROWSER_WEB_PLUGIN_IMPL_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/cef_web_plugin.h"
|
||||||
|
#include "webkit/plugins/webplugininfo.h"
|
||||||
|
|
||||||
|
class CefWebPluginInfoImpl : public CefWebPluginInfo {
|
||||||
|
public:
|
||||||
|
explicit CefWebPluginInfoImpl(const webkit::WebPluginInfo& plugin_info);
|
||||||
|
|
||||||
|
virtual CefString GetName() OVERRIDE;
|
||||||
|
virtual CefString GetPath() OVERRIDE;
|
||||||
|
virtual CefString GetVersion() OVERRIDE;
|
||||||
|
virtual CefString GetDescription() OVERRIDE;
|
||||||
|
|
||||||
|
private:
|
||||||
|
webkit::WebPluginInfo plugin_info_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefWebPluginInfoImpl);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_BROWSER_WEB_PLUGIN_IMPL_H_
|
@ -18,6 +18,7 @@
|
|||||||
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/quota_callback_ctocpp.h"
|
#include "libcef_dll/ctocpp/quota_callback_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
@ -264,6 +265,36 @@ void CEF_CALLBACK request_handler_on_protocol_execution(
|
|||||||
*allow_os_execution = allow_os_executionBool?true:false;
|
*allow_os_execution = allow_os_executionBool?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK request_handler_on_before_plugin_load(
|
||||||
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_string_t* url, const cef_string_t* policy_url,
|
||||||
|
struct _cef_web_plugin_info_t* info) {
|
||||||
|
// 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: info; type: refptr_diff
|
||||||
|
DCHECK(info);
|
||||||
|
if (!info)
|
||||||
|
return 0;
|
||||||
|
// Unverified params: url, policy_url
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefRequestHandlerCppToC::Get(self)->OnBeforePluginLoad(
|
||||||
|
CefBrowserCToCpp::Wrap(browser),
|
||||||
|
CefString(url),
|
||||||
|
CefString(policy_url),
|
||||||
|
CefWebPluginInfoCToCpp::Wrap(info));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// CONSTRUCTOR - Do not edit by hand.
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
@ -278,6 +309,7 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC(CefRequestHandler* cls)
|
|||||||
struct_.struct_.on_quota_request = request_handler_on_quota_request;
|
struct_.struct_.on_quota_request = request_handler_on_quota_request;
|
||||||
struct_.struct_.get_cookie_manager = request_handler_get_cookie_manager;
|
struct_.struct_.get_cookie_manager = request_handler_get_cookie_manager;
|
||||||
struct_.struct_.on_protocol_execution = request_handler_on_protocol_execution;
|
struct_.struct_.on_protocol_execution = request_handler_on_protocol_execution;
|
||||||
|
struct_.struct_.on_before_plugin_load = request_handler_on_before_plugin_load;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
53
libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.cc
Normal file
53
libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.cc
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// Copyright (c) 2012 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/web_plugin_unstable_callback_cpptoc.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CEF_CALLBACK web_plugin_unstable_callback_is_unstable(
|
||||||
|
struct _cef_web_plugin_unstable_callback_t* self, const cef_string_t* path,
|
||||||
|
int unstable) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(path);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefWebPluginUnstableCallbackCppToC::Get(self)->IsUnstable(
|
||||||
|
CefString(path),
|
||||||
|
unstable?true:false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefWebPluginUnstableCallbackCppToC::CefWebPluginUnstableCallbackCppToC(
|
||||||
|
CefWebPluginUnstableCallback* cls)
|
||||||
|
: CefCppToC<CefWebPluginUnstableCallbackCppToC,
|
||||||
|
CefWebPluginUnstableCallback, cef_web_plugin_unstable_callback_t>(
|
||||||
|
cls) {
|
||||||
|
struct_.struct_.is_unstable = web_plugin_unstable_callback_is_unstable;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefWebPluginUnstableCallbackCppToC,
|
||||||
|
CefWebPluginUnstableCallback,
|
||||||
|
cef_web_plugin_unstable_callback_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
38
libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h
Normal file
38
libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (c) 2012 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_WEB_PLUGIN_UNSTABLE_CALLBACK_CPPTOC_H_
|
||||||
|
#define CEF_LIBCEF_DLL_CPPTOC_WEB_PLUGIN_UNSTABLE_CALLBACK_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_web_plugin.h"
|
||||||
|
#include "include/capi/cef_web_plugin_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 CefWebPluginUnstableCallbackCppToC
|
||||||
|
: public CefCppToC<CefWebPluginUnstableCallbackCppToC,
|
||||||
|
CefWebPluginUnstableCallback, cef_web_plugin_unstable_callback_t> {
|
||||||
|
public:
|
||||||
|
explicit CefWebPluginUnstableCallbackCppToC(
|
||||||
|
CefWebPluginUnstableCallback* cls);
|
||||||
|
virtual ~CefWebPluginUnstableCallbackCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // CEF_LIBCEF_DLL_CPPTOC_WEB_PLUGIN_UNSTABLE_CALLBACK_CPPTOC_H_
|
||||||
|
|
@ -16,6 +16,7 @@
|
|||||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/quota_callback_cpptoc.h"
|
#include "libcef_dll/cpptoc/quota_callback_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
|
||||||
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/resource_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/resource_handler_ctocpp.h"
|
||||||
|
|
||||||
@ -244,6 +245,35 @@ void CefRequestHandlerCToCpp::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
|||||||
allow_os_execution = allow_os_executionInt?true:false;
|
allow_os_execution = allow_os_executionInt?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefRequestHandlerCToCpp::OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& url, const CefString& policy_url,
|
||||||
|
CefRefPtr<CefWebPluginInfo> info) {
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, on_before_plugin_load))
|
||||||
|
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: info; type: refptr_diff
|
||||||
|
DCHECK(info.get());
|
||||||
|
if (!info.get())
|
||||||
|
return false;
|
||||||
|
// Unverified params: url, policy_url
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = struct_->on_before_plugin_load(struct_,
|
||||||
|
CefBrowserCppToC::Wrap(browser),
|
||||||
|
url.GetStruct(),
|
||||||
|
policy_url.GetStruct(),
|
||||||
|
CefWebPluginInfoCppToC::Wrap(info));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCToCpp<CefRequestHandlerCToCpp, CefRequestHandler,
|
template<> long CefCToCpp<CefRequestHandlerCToCpp, CefRequestHandler,
|
||||||
|
@ -53,6 +53,9 @@ class CefRequestHandlerCToCpp
|
|||||||
CefRefPtr<CefBrowser> browser, const CefString& main_url) OVERRIDE;
|
CefRefPtr<CefBrowser> browser, const CefString& main_url) OVERRIDE;
|
||||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& url, bool& allow_os_execution) OVERRIDE;
|
const CefString& url, bool& allow_os_execution) OVERRIDE;
|
||||||
|
virtual bool OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& url, const CefString& policy_url,
|
||||||
|
CefRefPtr<CefWebPluginInfo> info) OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BUILDING_CEF_SHARED
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
42
libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.cc
Normal file
42
libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.cc
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Copyright (c) 2012 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/web_plugin_unstable_callback_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// VIRTUAL METHODS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CefWebPluginUnstableCallbackCToCpp::IsUnstable(const CefString& path,
|
||||||
|
bool unstable) {
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, is_unstable))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(!path.empty());
|
||||||
|
if (path.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
struct_->is_unstable(struct_,
|
||||||
|
path.GetStruct(),
|
||||||
|
unstable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCToCpp<CefWebPluginUnstableCallbackCToCpp,
|
||||||
|
CefWebPluginUnstableCallback,
|
||||||
|
cef_web_plugin_unstable_callback_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
44
libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.h
Normal file
44
libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (c) 2012 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_WEB_PLUGIN_UNSTABLE_CALLBACK_CTOCPP_H_
|
||||||
|
#define CEF_LIBCEF_DLL_CTOCPP_WEB_PLUGIN_UNSTABLE_CALLBACK_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_web_plugin.h"
|
||||||
|
#include "include/capi/cef_web_plugin_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 CefWebPluginUnstableCallbackCToCpp
|
||||||
|
: public CefCToCpp<CefWebPluginUnstableCallbackCToCpp,
|
||||||
|
CefWebPluginUnstableCallback, cef_web_plugin_unstable_callback_t> {
|
||||||
|
public:
|
||||||
|
explicit CefWebPluginUnstableCallbackCToCpp(
|
||||||
|
cef_web_plugin_unstable_callback_t* str)
|
||||||
|
: CefCToCpp<CefWebPluginUnstableCallbackCToCpp,
|
||||||
|
CefWebPluginUnstableCallback, cef_web_plugin_unstable_callback_t>(
|
||||||
|
str) {}
|
||||||
|
virtual ~CefWebPluginUnstableCallbackCToCpp() {}
|
||||||
|
|
||||||
|
// CefWebPluginUnstableCallback methods
|
||||||
|
virtual void IsUnstable(const CefString& path, bool unstable) OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
#endif // CEF_LIBCEF_DLL_CTOCPP_WEB_PLUGIN_UNSTABLE_CALLBACK_CTOCPP_H_
|
||||||
|
|
@ -89,6 +89,7 @@
|
|||||||
#include "libcef_dll/ctocpp/v8accessor_ctocpp.h"
|
#include "libcef_dll/ctocpp/v8accessor_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/v8handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/v8handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h"
|
#include "libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/write_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/write_handler_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
@ -216,6 +217,7 @@ CEF_EXPORT void cef_shutdown() {
|
|||||||
DCHECK_EQ(CefV8ValueCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefV8ValueCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefWebPluginInfoCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefWebPluginInfoCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefWebPluginInfoVisitorCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefWebPluginInfoVisitorCToCpp::DebugObjCt, 0);
|
||||||
|
DCHECK_EQ(CefWebPluginUnstableCallbackCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefWriteHandlerCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefWriteHandlerCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefXmlReaderCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefXmlReaderCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefZipReaderCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefZipReaderCppToC::DebugObjCt, 0);
|
||||||
@ -518,3 +520,107 @@ CEF_EXPORT void cef_visit_web_plugin_info(
|
|||||||
CefWebPluginInfoVisitorCToCpp::Wrap(visitor));
|
CefWebPluginInfoVisitorCToCpp::Wrap(visitor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_refresh_web_plugins() {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefRefreshWebPlugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_add_web_plugin_path(const cef_string_t* path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(path);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefAddWebPluginPath(
|
||||||
|
CefString(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_add_web_plugin_directory(const cef_string_t* dir) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: dir; type: string_byref_const
|
||||||
|
DCHECK(dir);
|
||||||
|
if (!dir)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefAddWebPluginDirectory(
|
||||||
|
CefString(dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_remove_web_plugin_path(const cef_string_t* path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(path);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefRemoveWebPluginPath(
|
||||||
|
CefString(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_unregister_internal_web_plugin(const cef_string_t* path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(path);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefUnregisterInternalWebPlugin(
|
||||||
|
CefString(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_force_web_plugin_shutdown(const cef_string_t* path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(path);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefForceWebPluginShutdown(
|
||||||
|
CefString(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_register_web_plugin_crash(const cef_string_t* path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(path);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefRegisterWebPluginCrash(
|
||||||
|
CefString(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_is_web_plugin_unstable(const cef_string_t* path,
|
||||||
|
struct _cef_web_plugin_unstable_callback_t* callback) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(path);
|
||||||
|
if (!path)
|
||||||
|
return;
|
||||||
|
// Verify param: callback; type: refptr_diff
|
||||||
|
DCHECK(callback);
|
||||||
|
if (!callback)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefIsWebPluginUnstable(
|
||||||
|
CefString(path),
|
||||||
|
CefWebPluginUnstableCallbackCToCpp::Wrap(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
#include "libcef_dll/cpptoc/v8accessor_cpptoc.h"
|
#include "libcef_dll/cpptoc/v8accessor_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/v8handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/v8handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h"
|
#include "libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/write_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/write_handler_cpptoc.h"
|
||||||
#include "libcef_dll/ctocpp/auth_callback_ctocpp.h"
|
#include "libcef_dll/ctocpp/auth_callback_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/before_download_callback_ctocpp.h"
|
#include "libcef_dll/ctocpp/before_download_callback_ctocpp.h"
|
||||||
@ -208,6 +209,7 @@ CEF_GLOBAL void CefShutdown() {
|
|||||||
DCHECK_EQ(CefV8ValueCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefV8ValueCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefWebPluginInfoCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefWebPluginInfoCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefWebPluginInfoVisitorCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefWebPluginInfoVisitorCppToC::DebugObjCt, 0);
|
||||||
|
DCHECK_EQ(CefWebPluginUnstableCallbackCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefWriteHandlerCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefWriteHandlerCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefXmlReaderCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefXmlReaderCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefZipReaderCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefZipReaderCToCpp::DebugObjCt, 0);
|
||||||
@ -470,3 +472,107 @@ CEF_GLOBAL void CefVisitWebPluginInfo(
|
|||||||
CefWebPluginInfoVisitorCppToC::Wrap(visitor));
|
CefWebPluginInfoVisitorCppToC::Wrap(visitor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL void CefRefreshWebPlugins() {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cef_refresh_web_plugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL void CefAddWebPluginPath(const CefString& path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(!path.empty());
|
||||||
|
if (path.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cef_add_web_plugin_path(
|
||||||
|
path.GetStruct());
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL void CefAddWebPluginDirectory(const CefString& dir) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: dir; type: string_byref_const
|
||||||
|
DCHECK(!dir.empty());
|
||||||
|
if (dir.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cef_add_web_plugin_directory(
|
||||||
|
dir.GetStruct());
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL void CefRemoveWebPluginPath(const CefString& path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(!path.empty());
|
||||||
|
if (path.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cef_remove_web_plugin_path(
|
||||||
|
path.GetStruct());
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL void CefUnregisterInternalWebPlugin(const CefString& path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(!path.empty());
|
||||||
|
if (path.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cef_unregister_internal_web_plugin(
|
||||||
|
path.GetStruct());
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL void CefForceWebPluginShutdown(const CefString& path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(!path.empty());
|
||||||
|
if (path.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cef_force_web_plugin_shutdown(
|
||||||
|
path.GetStruct());
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL void CefRegisterWebPluginCrash(const CefString& path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(!path.empty());
|
||||||
|
if (path.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cef_register_web_plugin_crash(
|
||||||
|
path.GetStruct());
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL void CefIsWebPluginUnstable(const CefString& path,
|
||||||
|
CefRefPtr<CefWebPluginUnstableCallback> callback) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref_const
|
||||||
|
DCHECK(!path.empty());
|
||||||
|
if (path.empty())
|
||||||
|
return;
|
||||||
|
// Verify param: callback; type: refptr_diff
|
||||||
|
DCHECK(callback.get());
|
||||||
|
if (!callback.get())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cef_is_web_plugin_unstable(
|
||||||
|
path.GetStruct(),
|
||||||
|
CefWebPluginUnstableCallbackCppToC::Wrap(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user