// Copyright (c) 2025 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=34c21edf0ddb3d28717f7e5d4727ea3f3f31e912$
//

#include "libcef_dll/ctocpp/preference_registrar_ctocpp.h"

#include "libcef_dll/ctocpp/value_ctocpp.h"

// VIRTUAL METHODS - Body may be edited by hand.

NO_SANITIZE("cfi-icall")
bool CefPreferenceRegistrarCToCpp::AddPreference(
    const CefString& name,
    CefRefPtr<CefValue> default_value) {
  auto* _struct = GetStruct();
  if (!_struct->add_preference) {
    return false;
  }

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Verify param: name; type: string_byref_const
  DCHECK(!name.empty());
  if (name.empty()) {
    return false;
  }
  // Verify param: default_value; type: refptr_same
  DCHECK(default_value.get());
  if (!default_value.get()) {
    return false;
  }

  // Execute
  int _retval = _struct->add_preference(_struct, name.GetStruct(),
                                        CefValueCToCpp_Unwrap(default_value));

  // Return type: bool
  return _retval ? true : false;
}

// CONSTRUCTOR - Do not edit by hand.

CefPreferenceRegistrarCToCpp::CefPreferenceRegistrarCToCpp() {}

// DESTRUCTOR - Do not edit by hand.

CefPreferenceRegistrarCToCpp::~CefPreferenceRegistrarCToCpp() {}

template <>
cef_preference_registrar_t* CefCToCppScoped<CefPreferenceRegistrarCToCpp,
                                            CefPreferenceRegistrar,
                                            cef_preference_registrar_t>::
    UnwrapDerivedOwn(CefWrapperType type, CefOwnPtr<CefPreferenceRegistrar> c) {
  CHECK(false) << __func__ << " called with unexpected class type " << type;
  return nullptr;
}

template <>
cef_preference_registrar_t* CefCToCppScoped<CefPreferenceRegistrarCToCpp,
                                            CefPreferenceRegistrar,
                                            cef_preference_registrar_t>::
    UnwrapDerivedRaw(CefWrapperType type, CefRawPtr<CefPreferenceRegistrar> c) {
  CHECK(false) << __func__ << " called with unexpected class type " << type;
  return nullptr;
}

template <>
CefWrapperType CefCToCppScoped<CefPreferenceRegistrarCToCpp,
                               CefPreferenceRegistrar,
                               cef_preference_registrar_t>::kWrapperType =
    WT_PREFERENCE_REGISTRAR;
