// Copyright (c) 2016 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/menu_model_delegate_cpptoc.h"
#include "libcef_dll/ctocpp/menu_model_ctocpp.h"


namespace {

// MEMBER FUNCTIONS - Body may be edited by hand.

void CEF_CALLBACK menu_model_delegate_execute_command(
    struct _cef_menu_model_delegate_t* self, cef_menu_model_t* menu_model,
    int command_id, cef_event_flags_t event_flags) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return;
  // Verify param: menu_model; type: refptr_diff
  DCHECK(menu_model);
  if (!menu_model)
    return;

  // Execute
  CefMenuModelDelegateCppToC::Get(self)->ExecuteCommand(
      CefMenuModelCToCpp::Wrap(menu_model),
      command_id,
      event_flags);
}

void CEF_CALLBACK menu_model_delegate_menu_will_show(
    struct _cef_menu_model_delegate_t* self, cef_menu_model_t* menu_model) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return;
  // Verify param: menu_model; type: refptr_diff
  DCHECK(menu_model);
  if (!menu_model)
    return;

  // Execute
  CefMenuModelDelegateCppToC::Get(self)->MenuWillShow(
      CefMenuModelCToCpp::Wrap(menu_model));
}

}  // namespace


// CONSTRUCTOR - Do not edit by hand.

CefMenuModelDelegateCppToC::CefMenuModelDelegateCppToC() {
  GetStruct()->execute_command = menu_model_delegate_execute_command;
  GetStruct()->menu_will_show = menu_model_delegate_menu_will_show;
}

template<> CefRefPtr<CefMenuModelDelegate> CefCppToC<CefMenuModelDelegateCppToC,
    CefMenuModelDelegate, cef_menu_model_delegate_t>::UnwrapDerived(
    CefWrapperType type, cef_menu_model_delegate_t* s) {
  NOTREACHED() << "Unexpected class type: " << type;
  return NULL;
}

#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefMenuModelDelegateCppToC,
    CefMenuModelDelegate, cef_menu_model_delegate_t>::DebugObjCt = 0;
#endif

template<> CefWrapperType CefCppToC<CefMenuModelDelegateCppToC,
    CefMenuModelDelegate, cef_menu_model_delegate_t>::kWrapperType =
    WT_MENU_MODEL_DELEGATE;
