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

@@ -16,6 +16,7 @@
#include "libcef_dll/cpptoc/frame_cpptoc.h"
#include "libcef_dll/cpptoc/quota_callback_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/resource_handler_ctocpp.h"
@@ -244,6 +245,35 @@ void CefRequestHandlerCToCpp::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
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
template<> long CefCToCpp<CefRequestHandlerCToCpp, CefRequestHandler,

View File

@@ -53,6 +53,9 @@ class CefRequestHandlerCToCpp
CefRefPtr<CefBrowser> browser, const CefString& main_url) OVERRIDE;
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
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

View 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

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