mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Support registration of custom preferences.
Custom global and request context preferences can now be registered via CefBrowserProcessHandler::OnRegisterCustomPreferences. CefRequestContext now extends CefPreferenceManager and global preferences can be accessed via CefPreferenceManager::GetGlobalPreferenceManager.
This commit is contained in:
82
libcef_dll/cpptoc/preference_registrar_cpptoc.cc
Normal file
82
libcef_dll/cpptoc/preference_registrar_cpptoc.cc
Normal file
@ -0,0 +1,82 @@
|
||||
// Copyright (c) 2022 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.
|
||||
//
|
||||
// $hash=c20ff60ecd65930e687921444e6c46e90e7cc230$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/preference_registrar_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/value_cpptoc.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
int CEF_CALLBACK
|
||||
preference_registrar_add_preference(struct _cef_preference_registrar_t* self,
|
||||
const cef_string_t* name,
|
||||
struct _cef_value_t* default_value) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: name; type: string_byref_const
|
||||
DCHECK(name);
|
||||
if (!name)
|
||||
return 0;
|
||||
// Verify param: default_value; type: refptr_same
|
||||
DCHECK(default_value);
|
||||
if (!default_value)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefPreferenceRegistrarCppToC::Get(self)->AddPreference(
|
||||
CefString(name), CefValueCppToC::Unwrap(default_value));
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefPreferenceRegistrarCppToC::CefPreferenceRegistrarCppToC() {
|
||||
GetStruct()->add_preference = preference_registrar_add_preference;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefPreferenceRegistrarCppToC::~CefPreferenceRegistrarCppToC() {}
|
||||
|
||||
template <>
|
||||
CefOwnPtr<CefPreferenceRegistrar> CefCppToCScoped<CefPreferenceRegistrarCppToC,
|
||||
CefPreferenceRegistrar,
|
||||
cef_preference_registrar_t>::
|
||||
UnwrapDerivedOwn(CefWrapperType type, cef_preference_registrar_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return CefOwnPtr<CefPreferenceRegistrar>();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRawPtr<CefPreferenceRegistrar> CefCppToCScoped<CefPreferenceRegistrarCppToC,
|
||||
CefPreferenceRegistrar,
|
||||
cef_preference_registrar_t>::
|
||||
UnwrapDerivedRaw(CefWrapperType type, cef_preference_registrar_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCppToCScoped<CefPreferenceRegistrarCppToC,
|
||||
CefPreferenceRegistrar,
|
||||
cef_preference_registrar_t>::kWrapperType =
|
||||
WT_PREFERENCE_REGISTRAR;
|
Reference in New Issue
Block a user