mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 19:54:53 +00:00
088c3d02f4
- Add new SchemeOptions enum - Change AddCustomScheme to use new enum (replaces all the bool params) - Simplify command line arg processing, now sends scheme name and int (options) - Add CefCustomScheme.IsFetchEnabled Resolves #2690 Breaking Change
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
// Copyright © 2019 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 System.Collections.Generic;
|
|
|
|
namespace CefSharp
|
|
{
|
|
/// <summary>
|
|
/// Default implementation of <see cref="IApp"/> which represents the CefApp class
|
|
/// </summary>
|
|
public class DefaultApp : IApp
|
|
{
|
|
public IBrowserProcessHandler BrowserProcessHandler { get; private set; }
|
|
public IEnumerable<CefCustomScheme> Schemes { get; private set; }
|
|
|
|
public DefaultApp(IBrowserProcessHandler browserProcessHandler, IEnumerable<CefCustomScheme> schemes)
|
|
{
|
|
BrowserProcessHandler = browserProcessHandler;
|
|
Schemes = schemes;
|
|
}
|
|
|
|
void IApp.OnRegisterCustomSchemes(ISchemeRegistrar registrar)
|
|
{
|
|
OnRegisterCustomSchemes(registrar);
|
|
}
|
|
|
|
protected virtual void OnRegisterCustomSchemes(ISchemeRegistrar registrar)
|
|
{
|
|
foreach (var scheme in Schemes)
|
|
{
|
|
//We don't need to register http or https, they're built in schemes
|
|
if (scheme.SchemeName == "http" || scheme.SchemeName == "https")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
var success = registrar.AddCustomScheme(scheme.SchemeName, scheme.Options);
|
|
|
|
if (!success)
|
|
{
|
|
var msg = "CefSchemeRegistrar::AddCustomScheme failed for schemeName:" + scheme.SchemeName;
|
|
//TODO: Log error
|
|
//LOG(ERROR) << StringUtils::ToNative(msg).ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|