Skip to content

Commit a5c9a66

Browse files
committed
Example - Rename PermissionHandlerExample to ExamplePermissionHandler
- Matches other examples - Minor changes
1 parent 1ae9e01 commit a5c9a66

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

CefSharp.Example/Handlers/PermissionHandlerExample.cs renamed to CefSharp.Example/Handlers/ExamplePermissionHandler.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66

77
namespace CefSharp.Example.Handlers
88
{
9-
public class PermissionHandlerExample : PermissionHandler
9+
/// <summary>
10+
/// A simple <see cref="PermissionHandler"/> implementation that programatically allows
11+
/// all requests without user interaction.
12+
/// </summary>
13+
public class ExamplePermissionHandler : PermissionHandler
1014
{
1115
protected override bool OnShowPermissionPrompt(IWebBrowser chromiumWebBrowser, IBrowser browser, ulong promptId, string requestingOrigin, PermissionRequestType requestedPermissions, IPermissionPromptCallback callback)
1216
{
@@ -27,10 +31,8 @@ protected override bool OnRequestMediaAccessPermission(IWebBrowser chromiumWebBr
2731
{
2832
using (callback)
2933
{
30-
callback.Continue(MediaAccessPermissionType.AudioCapture |
31-
MediaAccessPermissionType.VideoCapture |
32-
MediaAccessPermissionType.DesktopVideoCapture |
33-
MediaAccessPermissionType.DesktopAudioCapture);
34+
//Allow the requested permissions
35+
callback.Continue(requestedPermissions);
3436
return true;
3537
}
3638
}

CefSharp.WinForms.Example/BrowserTabUserControl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public BrowserTabUserControl(Action<string, int?> openNewTab, string url, bool m
6060
browser.DownloadHandler = Fluent.DownloadHandler.AskUser();
6161
browser.AudioHandler = new CefSharp.Handler.AudioHandler();
6262
browser.FrameHandler = new CefSharp.Handler.FrameHandler();
63+
browser.PermissionHandler = new ExamplePermissionHandler();
6364

6465
if (multiThreadedMessageLoopEnabled)
6566
{

CefSharp.Wpf.Example/Views/BrowserTabView.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public BrowserTabView()
4545
browser.RequestHandler = new ExampleRequestHandler();
4646

4747
//Test Handler allow All Permission
48-
browser.PermissionHandler = new PermissionHandlerExample();
48+
browser.PermissionHandler = new ExamplePermissionHandler();
4949

5050
var bindingOptions = new BindingOptions()
5151
{

0 commit comments

Comments
 (0)