mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
a5c9a66832
- Matches other examples - Minor changes
41 lines
1.7 KiB
C#
41 lines
1.7 KiB
C#
// Copyright © 2022 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
using CefSharp.Handler;
|
|
|
|
namespace CefSharp.Example.Handlers
|
|
{
|
|
/// <summary>
|
|
/// A simple <see cref="PermissionHandler"/> implementation that programatically allows
|
|
/// all requests without user interaction.
|
|
/// </summary>
|
|
public class ExamplePermissionHandler : PermissionHandler
|
|
{
|
|
protected override bool OnShowPermissionPrompt(IWebBrowser chromiumWebBrowser, IBrowser browser, ulong promptId, string requestingOrigin, PermissionRequestType requestedPermissions, IPermissionPromptCallback callback)
|
|
{
|
|
using (callback)
|
|
{
|
|
System.Diagnostics.Debug.WriteLine($"{promptId}|{requestedPermissions} {requestingOrigin}");
|
|
callback.Continue(PermissionRequestResult.Accept);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
protected override void OnDismissPermissionPrompt(IWebBrowser chromiumWebBrowser, IBrowser browser, ulong promptId, PermissionRequestResult result)
|
|
{
|
|
base.OnDismissPermissionPrompt(chromiumWebBrowser, browser, promptId, result);
|
|
}
|
|
|
|
protected override bool OnRequestMediaAccessPermission(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, string requestingOrigin, MediaAccessPermissionType requestedPermissions, IMediaAccessCallback callback)
|
|
{
|
|
using (callback)
|
|
{
|
|
//Allow the requested permissions
|
|
callback.Continue(requestedPermissions);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|