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:
Marshall Greenblatt
2012-09-28 20:14:02 +00:00
parent ccb2b296ac
commit a3ac7b446f
19 changed files with 888 additions and 43 deletions

View File

@ -18,6 +18,7 @@
#include "libcef_dll/ctocpp/frame_ctocpp.h"
#include "libcef_dll/ctocpp/quota_callback_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.
@ -264,6 +265,36 @@ void CEF_CALLBACK request_handler_on_protocol_execution(
*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.
@ -278,6 +309,7 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC(CefRequestHandler* cls)
struct_.struct_.on_quota_request = request_handler_on_quota_request;
struct_.struct_.get_cookie_manager = request_handler_get_cookie_manager;
struct_.struct_.on_protocol_execution = request_handler_on_protocol_execution;
struct_.struct_.on_before_plugin_load = request_handler_on_before_plugin_load;
}
#ifndef NDEBUG

View 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

View 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_