mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-03-01 18:37:42 +01:00
Merge revision 457 changes:
- Add the ability to restrict V8 extension loading by frame using a new CefPermissionHandler::OnBeforeScriptExtensionLoad() callback (issue #471). git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/963@519 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
4560ab916b
commit
9ba4603109
70
libcef_dll/cpptoc/permission_handler_cpptoc.cc
Normal file
70
libcef_dll/cpptoc/permission_handler_cpptoc.cc
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
// 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/permission_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK permission_handler_on_before_script_extension_load(
|
||||||
|
struct _cef_permission_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_frame_t* frame, const cef_string_t* extensionName)
|
||||||
|
{
|
||||||
|
// 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: frame; type: refptr_diff
|
||||||
|
DCHECK(frame);
|
||||||
|
if (!frame)
|
||||||
|
return 0;
|
||||||
|
// Verify param: extensionName; type: string_byref_const
|
||||||
|
DCHECK(extensionName);
|
||||||
|
if (!extensionName)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefPermissionHandlerCppToC::Get(
|
||||||
|
self)->OnBeforeScriptExtensionLoad(
|
||||||
|
CefBrowserCToCpp::Wrap(browser),
|
||||||
|
CefFrameCToCpp::Wrap(frame),
|
||||||
|
CefString(extensionName));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefPermissionHandlerCppToC::CefPermissionHandlerCppToC(
|
||||||
|
CefPermissionHandler* cls)
|
||||||
|
: CefCppToC<CefPermissionHandlerCppToC, CefPermissionHandler,
|
||||||
|
cef_permission_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_before_script_extension_load =
|
||||||
|
permission_handler_on_before_script_extension_load;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefPermissionHandlerCppToC, CefPermissionHandler,
|
||||||
|
cef_permission_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
37
libcef_dll/cpptoc/permission_handler_cpptoc.h
Normal file
37
libcef_dll/cpptoc/permission_handler_cpptoc.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// 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 _PERMISSIONHANDLER_CPPTOC_H
|
||||||
|
#define _PERMISSIONHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_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 CefPermissionHandlerCppToC
|
||||||
|
: public CefCppToC<CefPermissionHandlerCppToC, CefPermissionHandler,
|
||||||
|
cef_permission_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefPermissionHandlerCppToC(CefPermissionHandler* cls);
|
||||||
|
virtual ~CefPermissionHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _PERMISSIONHANDLER_CPPTOC_H
|
||||||
|
|
58
libcef_dll/ctocpp/permission_handler_ctocpp.cc
Normal file
58
libcef_dll/ctocpp/permission_handler_ctocpp.cc
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// 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/browser_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/permission_handler_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// VIRTUAL METHODS - Body may be edited by hand.
|
||||||
|
|
||||||
|
bool CefPermissionHandlerCToCpp::OnBeforeScriptExtensionLoad(
|
||||||
|
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||||
|
const CefString& extensionName)
|
||||||
|
{
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, on_before_script_extension_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: frame; type: refptr_diff
|
||||||
|
DCHECK(frame.get());
|
||||||
|
if (!frame.get())
|
||||||
|
return false;
|
||||||
|
// Verify param: extensionName; type: string_byref_const
|
||||||
|
DCHECK(!extensionName.empty());
|
||||||
|
if (extensionName.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = struct_->on_before_script_extension_load(struct_,
|
||||||
|
CefBrowserCppToC::Wrap(browser),
|
||||||
|
CefFrameCppToC::Wrap(frame),
|
||||||
|
extensionName.GetStruct());
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCToCpp<CefPermissionHandlerCToCpp, CefPermissionHandler,
|
||||||
|
cef_permission_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
43
libcef_dll/ctocpp/permission_handler_ctocpp.h
Normal file
43
libcef_dll/ctocpp/permission_handler_ctocpp.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// 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 _PERMISSIONHANDLER_CTOCPP_H
|
||||||
|
#define _PERMISSIONHANDLER_CTOCPP_H
|
||||||
|
|
||||||
|
#ifndef BUILDING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||||
|
#else // BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_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 CefPermissionHandlerCToCpp
|
||||||
|
: public CefCToCpp<CefPermissionHandlerCToCpp, CefPermissionHandler,
|
||||||
|
cef_permission_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefPermissionHandlerCToCpp(cef_permission_handler_t* str)
|
||||||
|
: CefCToCpp<CefPermissionHandlerCToCpp, CefPermissionHandler,
|
||||||
|
cef_permission_handler_t>(str) {}
|
||||||
|
virtual ~CefPermissionHandlerCToCpp() {}
|
||||||
|
|
||||||
|
// CefPermissionHandler methods
|
||||||
|
virtual bool OnBeforeScriptExtensionLoad(CefRefPtr<CefBrowser> browser,
|
||||||
|
CefRefPtr<CefFrame> frame, const CefString& extensionName) OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
#endif // _PERMISSIONHANDLER_CTOCPP_H
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user