mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-13 10:06:28 +01:00
dc3aae19e8
- 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.
154 lines
4.3 KiB
C++
154 lines
4.3 KiB
C++
// Copyright (c) 2015 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/resource_bundle_cpptoc.h"
|
|
|
|
|
|
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
|
|
|
CEF_EXPORT cef_resource_bundle_t* cef_resource_bundle_get_global() {
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
// Execute
|
|
CefRefPtr<CefResourceBundle> _retval = CefResourceBundle::GetGlobal();
|
|
|
|
// Return type: refptr_same
|
|
return CefResourceBundleCppToC::Wrap(_retval);
|
|
}
|
|
|
|
|
|
namespace {
|
|
|
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
|
|
|
cef_string_userfree_t CEF_CALLBACK resource_bundle_get_localized_string(
|
|
struct _cef_resource_bundle_t* self, int string_id) {
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return NULL;
|
|
|
|
// Execute
|
|
CefString _retval = CefResourceBundleCppToC::Get(self)->GetLocalizedString(
|
|
string_id);
|
|
|
|
// Return type: string
|
|
return _retval.DetachToUserFree();
|
|
}
|
|
|
|
int CEF_CALLBACK resource_bundle_get_data_resource(
|
|
struct _cef_resource_bundle_t* self, int resource_id, void** data,
|
|
size_t* data_size) {
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return 0;
|
|
// Verify param: data; type: simple_byref
|
|
DCHECK(data);
|
|
if (!data)
|
|
return 0;
|
|
// Verify param: data_size; type: simple_byref
|
|
DCHECK(data_size);
|
|
if (!data_size)
|
|
return 0;
|
|
|
|
// Translate param: data; type: simple_byref
|
|
void* dataVal = data?*data:NULL;
|
|
// Translate param: data_size; type: simple_byref
|
|
size_t data_sizeVal = data_size?*data_size:0;
|
|
|
|
// Execute
|
|
bool _retval = CefResourceBundleCppToC::Get(self)->GetDataResource(
|
|
resource_id,
|
|
dataVal,
|
|
data_sizeVal);
|
|
|
|
// Restore param: data; type: simple_byref
|
|
if (data)
|
|
*data = dataVal;
|
|
// Restore param: data_size; type: simple_byref
|
|
if (data_size)
|
|
*data_size = data_sizeVal;
|
|
|
|
// Return type: bool
|
|
return _retval;
|
|
}
|
|
|
|
int CEF_CALLBACK resource_bundle_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) {
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return 0;
|
|
// Verify param: data; type: simple_byref
|
|
DCHECK(data);
|
|
if (!data)
|
|
return 0;
|
|
// Verify param: data_size; type: simple_byref
|
|
DCHECK(data_size);
|
|
if (!data_size)
|
|
return 0;
|
|
|
|
// Translate param: data; type: simple_byref
|
|
void* dataVal = data?*data:NULL;
|
|
// Translate param: data_size; type: simple_byref
|
|
size_t data_sizeVal = data_size?*data_size:0;
|
|
|
|
// Execute
|
|
bool _retval = CefResourceBundleCppToC::Get(self)->GetDataResourceForScale(
|
|
resource_id,
|
|
scale_factor,
|
|
dataVal,
|
|
data_sizeVal);
|
|
|
|
// Restore param: data; type: simple_byref
|
|
if (data)
|
|
*data = dataVal;
|
|
// Restore param: data_size; type: simple_byref
|
|
if (data_size)
|
|
*data_size = data_sizeVal;
|
|
|
|
// Return type: bool
|
|
return _retval;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
|
|
// CONSTRUCTOR - Do not edit by hand.
|
|
|
|
CefResourceBundleCppToC::CefResourceBundleCppToC() {
|
|
GetStruct()->get_localized_string = resource_bundle_get_localized_string;
|
|
GetStruct()->get_data_resource = resource_bundle_get_data_resource;
|
|
GetStruct()->get_data_resource_for_scale =
|
|
resource_bundle_get_data_resource_for_scale;
|
|
}
|
|
|
|
template<> CefRefPtr<CefResourceBundle> CefCppToC<CefResourceBundleCppToC,
|
|
CefResourceBundle, cef_resource_bundle_t>::UnwrapDerived(
|
|
CefWrapperType type, cef_resource_bundle_t* s) {
|
|
NOTREACHED() << "Unexpected class type: " << type;
|
|
return NULL;
|
|
}
|
|
|
|
#ifndef NDEBUG
|
|
template<> base::AtomicRefCount CefCppToC<CefResourceBundleCppToC,
|
|
CefResourceBundle, cef_resource_bundle_t>::DebugObjCt = 0;
|
|
#endif
|
|
|
|
template<> CefWrapperType CefCppToC<CefResourceBundleCppToC, CefResourceBundle,
|
|
cef_resource_bundle_t>::kWrapperType = WT_RESOURCE_BUNDLE;
|