Files
cefsharp/CefSharp.Wpf.Example/Handlers/RequestContextHandler.cs
T
amaitland 73a156fdc5 Initial version 75 upgrade and NetworkService changes
Compiles, that's about it at this point, there are major CEF breaking changes, and lots to be addressed.

Browser Process (main process)
- Removed IResourceHandlerFactory as it no longer fits with the structure that CEF provides
- New IResourceRequestHandler interface added, not plumbed in yet
- CefSettings - Add RootCachePath and ApplicationClientIdForFileScanning

BrowserSubprocess (render process)
- SendProcessMessage was moved from CefBrowser to CefFrame
- OnBrowserCreated added extraInfo param

The BrowserSubprocess changes for this upgrade should be complete
2019-06-25 19:24:57 +10:00

44 lines
1.8 KiB
C#

// Copyright © 2016 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.
namespace CefSharp.Wpf.Example.Handlers
{
public class RequestContextHandler : IRequestContextHandler
{
private readonly ICookieManager customCookieManager;
IResourceRequestHandler IRequestContextHandler.GetResourceRequestHandler(IBrowser browser, IFrame frame, IRequest request, bool iNavigation, bool isDownload, string requestInitiator, ref bool disableDefaultHandling)
{
return null;
}
bool IRequestContextHandler.OnBeforePluginLoad(string mimeType, string url, bool isMainFrame, string topOriginUrl, WebPluginInfo pluginInfo, ref PluginPolicy pluginPolicy)
{
//pluginPolicy = PluginPolicy.Disable;
//return true;
return false;
}
void IRequestContextHandler.OnRequestContextInitialized(IRequestContext requestContext)
{
//You can set preferences here on your newly initialized request context.
//Note, there is called on the CEF UI Thread, so you can directly call SetPreference
//Use this to check that settings preferences are working in your code
//string errorMessage;
//var success = requestContext.SetPreference("webkit.webprefs.minimum_font_size", 24, out errorMessage);
//You can set the proxy with code similar to the code below
//var v = new Dictionary<string, object>
//{
// ["mode"] = "fixed_servers",
// ["server"] = "scheme://host:port"
//};
//string errorMessage;
//bool success = requestContext.SetPreference("proxy", v, out errorMessage);
}
}
}