mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CefPermissionHandler callback for media access (fixes issue #2582)
This commit is contained in:
89
libcef_dll/ctocpp/permission_handler_ctocpp.cc
Normal file
89
libcef_dll/ctocpp/permission_handler_ctocpp.cc
Normal file
@@ -0,0 +1,89 @@
|
||||
// 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=f9073ac6e5a3634a3bf3c919ac1b0a9c607b4398$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/permission_handler_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_access_callback_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefPermissionHandlerCToCpp::OnRequestMediaAccessPermission(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& requesting_url,
|
||||
uint32 requested_permissions,
|
||||
CefRefPtr<CefMediaAccessCallback> callback) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_permission_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_request_media_access_permission))
|
||||
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: requesting_url; type: string_byref_const
|
||||
DCHECK(!requesting_url.empty());
|
||||
if (requesting_url.empty())
|
||||
return false;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->on_request_media_access_permission(
|
||||
_struct, CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
|
||||
requesting_url.GetStruct(), requested_permissions,
|
||||
CefMediaAccessCallbackCppToC::Wrap(callback));
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefPermissionHandlerCToCpp::CefPermissionHandlerCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefPermissionHandlerCToCpp::~CefPermissionHandlerCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_permission_handler_t* CefCToCppRefCounted<
|
||||
CefPermissionHandlerCToCpp,
|
||||
CefPermissionHandler,
|
||||
cef_permission_handler_t>::UnwrapDerived(CefWrapperType type,
|
||||
CefPermissionHandler* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefPermissionHandlerCToCpp,
|
||||
CefPermissionHandler,
|
||||
cef_permission_handler_t>::kWrapperType =
|
||||
WT_PERMISSION_HANDLER;
|
Reference in New Issue
Block a user