diff --git a/CefSharp.Core/Cef.h b/CefSharp.Core/Cef.h index 329d01328..d5ff05a07 100644 --- a/CefSharp.Core/Cef.h +++ b/CefSharp.Core/Cef.h @@ -7,6 +7,7 @@ #include #include #include +#include #include "Internals/CefSharpApp.h" #include "Internals/CookieVisitor.h" @@ -168,6 +169,94 @@ namespace CefSharp return success; } + /// Add an entry to the cross-origin whitelist. + /// The origin allowed to be accessed by the target protocol/domain. + /// The target protocol allowed to access the source origin. + /// The optional target domain allowed to access the source origin. + /// If set to true would allow a blah.example.com if the + /// URL (like http://www.example.com) will be allowed access to + /// all resources hosted on the specified and . + /// If is non-empty and if false only + /// exact domain matches will be allowed. If contains a top- + /// level domain component (like "example.com") and is + /// true sub-domain matches will be allowed. If is empty and + /// "/> if true all domains and IP addresses will be + /// allowed. + // + /// This method cannot be used to bypass the restrictions on local or display + /// isolated schemes. See the comments on for more + /// information. + /// + /// This function may be called on any thread. Returns false if + /// is invalid or the whitelist cannot be accessed. + /// + static bool AddCrossOriginWhitelistEntry( + String^ sourceOrigin, + String^ targetProtocol, + String^ targetDomain, + bool allowTargetSubdomains) + { + return CefAddCrossOriginWhitelistEntry( + StringUtils::ToNative(sourceOrigin), + StringUtils::ToNative(targetProtocol), + StringUtils::ToNative(targetDomain), + allowTargetSubdomains); + } + + /// Remove entry from cross-origin whitelist + /// The origin allowed to be accessed by the target protocol/domain. + /// The target protocol allowed to access the source origin. + /// The optional target domain allowed to access the source origin. + /// If set to true would allow a blah.example.com if the + /// is invalid or the whitelist cannot be accessed. + /// + static bool RemoveCrossOriginWhitelistEntry(String^ sourceOrigin, + String^ targetProtocol, + String^ targetDomain, + bool allowTargetSubdomains) + + { + return CefRemoveCrossOriginWhitelistEntry( + StringUtils::ToNative(sourceOrigin), + StringUtils::ToNative(targetProtocol), + StringUtils::ToNative(targetDomain), + allowTargetSubdomains); + } + + /// Remove all entries from the cross-origin access whitelist. + /// + /// Remove all entries from the cross-origin access whitelist. Returns false if + /// the whitelist cannot be accessed. + /// + static bool ClearCrossOriginWhitelist() + { + return CefClearCrossOriginWhitelist(); + } + /// Visits all cookies using the provided Cookie Visitor. The returned cookies are sorted by longest path, then by earliest creation date. /// A user-provided Cookie Visitor implementation. /// Returns false if the CookieManager is not available; otherwise, true.