diff --git a/CefSharp.Example/CefSharp.Example.csproj b/CefSharp.Example/CefSharp.Example.csproj index cff534e2d4..7dbe2d3428 100644 --- a/CefSharp.Example/CefSharp.Example.csproj +++ b/CefSharp.Example/CefSharp.Example.csproj @@ -76,7 +76,6 @@ - diff --git a/CefSharp.Example/DevTools/DevToolsExtensions.cs b/CefSharp.Example/DevTools/DevToolsExtensions.cs index c382c1134c..af1aa9aba8 100644 --- a/CefSharp.Example/DevTools/DevToolsExtensions.cs +++ b/CefSharp.Example/DevTools/DevToolsExtensions.cs @@ -1,6 +1,4 @@ using System; -using System.Text; -using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; @@ -8,7 +6,6 @@ namespace CefSharp.Example.DevTools { public static class DevToolsExtensions { - private static int LastMessageId = 600000; /// /// Calls Page.captureScreenshot without any optional params /// (Results in PNG image of default viewport) @@ -23,11 +20,11 @@ public static async Task CaptureScreenShotAsPng(this IWebBrowser chromiu // throw new System.Exception("Page hasn't loaded"); //} - var host = chromiumWebBrowser.GetBrowserHost(); + var browser = chromiumWebBrowser.GetBrowser(); - if (host == null || host.IsDisposed) + if (browser == null || browser.IsDisposed) { - throw new Exception("BrowserHost is Null or Disposed"); + throw new Exception("browser is Null or Disposed"); } //var param = new Dictionary @@ -35,46 +32,17 @@ public static async Task CaptureScreenShotAsPng(this IWebBrowser chromiu // { "format", "png" }, //} - var msgId = Interlocked.Increment(ref LastMessageId); - - var observer = new TaskMethodDevToolsMessageObserver(msgId); - //Make sure to dispose of our observer registration when done - //TODO: Create a single observer that maps tasks to Id's - //Or at least create one for each type, events and method - using (var observerRegistration = host.AddDevToolsMessageObserver(observer)) + using (var devToolsClient = browser.GetDevToolsClient()) { - //Page.captureScreenshot defaults to PNG, all params are optional - //for this DevTools method - int id = 0; const string methodName = "Page.captureScreenshot"; - //TODO: Simplify this, we can use an Func to reduce code duplication - if (Cef.CurrentlyOnThread(CefThreadIds.TID_UI)) - { - id = host.ExecuteDevToolsMethod(msgId, methodName); - } - else - { - id = await Cef.UIThreadTaskFactory.StartNew(() => - { - return host.ExecuteDevToolsMethod(msgId, methodName); - }); - } - - if (id != msgId) - { - throw new Exception("Message Id doesn't match the provided Id"); - } - - var result = await observer.Task; - - var success = result.Item1; + var result = await devToolsClient.ExecuteDevToolsMethodAsync(methodName); - dynamic response = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(result.Item2)); + dynamic response = JsonConvert.DeserializeObject(result.ResponseAsJsonString); //Success - if (success) + if (result.Success) { return Convert.FromBase64String((string)response.data); } diff --git a/CefSharp.Example/DevTools/TaskMethodDevToolsMessageObserver.cs b/CefSharp.Example/DevTools/TaskMethodDevToolsMessageObserver.cs deleted file mode 100644 index 714f9f5a34..0000000000 --- a/CefSharp.Example/DevTools/TaskMethodDevToolsMessageObserver.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.IO; -using System.Threading.Tasks; -using CefSharp.Callback; - -namespace CefSharp.Example.DevTools -{ - /// - /// For capturing the response from a DevTools Method - /// (Doesn't handle DevTools events) - /// - public class TaskMethodDevToolsMessageObserver : IDevToolsMessageObserver - { - private readonly TaskCompletionSource> taskCompletionSource = new TaskCompletionSource>(TaskCreationOptions.RunContinuationsAsynchronously); - private readonly int matchMessageId; - - public TaskMethodDevToolsMessageObserver(int messageId) - { - matchMessageId = messageId; - } - - void IDisposable.Dispose() - { - - } - - void IDevToolsMessageObserver.OnDevToolsAgentAttached(IBrowser browser) - { - - } - - void IDevToolsMessageObserver.OnDevToolsAgentDetached(IBrowser browser) - { - - } - - void IDevToolsMessageObserver.OnDevToolsEvent(IBrowser browser, string method, Stream parameters) - { - - } - - bool IDevToolsMessageObserver.OnDevToolsMessage(IBrowser browser, Stream message) - { - return false; - } - - void IDevToolsMessageObserver.OnDevToolsMethodResult(IBrowser browser, int messageId, bool success, Stream result) - { - //We found the message Id we're after - if (matchMessageId == messageId) - { - var memoryStream = new MemoryStream((int)result.Length); - - result.CopyTo(memoryStream); - - var response = Tuple.Create(success, memoryStream.ToArray()); - - taskCompletionSource.TrySetResult(response); - } - } - - public Task> Task - { - get { return taskCompletionSource.Task; } - } - } -} diff --git a/CefSharp.Test/CefSharp.Test.csproj b/CefSharp.Test/CefSharp.Test.csproj index d93fa819f2..72b60fa3d6 100644 --- a/CefSharp.Test/CefSharp.Test.csproj +++ b/CefSharp.Test/CefSharp.Test.csproj @@ -125,6 +125,7 @@ + @@ -138,6 +139,7 @@ + diff --git a/CefSharp.Test/DevTools/DevToolsClientFacts.cs b/CefSharp.Test/DevTools/DevToolsClientFacts.cs new file mode 100644 index 0000000000..aabacf289f --- /dev/null +++ b/CefSharp.Test/DevTools/DevToolsClientFacts.cs @@ -0,0 +1,126 @@ +// Copyright © 2017 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.Threading.Tasks; +using CefSharp.DevTools.Browser; +using CefSharp.DevTools.Network; +using CefSharp.Example; +using CefSharp.OffScreen; +using Xunit; +using Xunit.Abstractions; + +namespace CefSharp.Test.DevTools +{ + //NOTE: All Test classes must be part of this collection as it manages the Cef Initialize/Shutdown lifecycle + [Collection(CefSharpFixtureCollection.Key)] + public class DevToolsClientFacts + { + private readonly ITestOutputHelper output; + private readonly CefSharpFixture fixture; + + public DevToolsClientFacts(ITestOutputHelper output, CefSharpFixture fixture) + { + this.fixture = fixture; + this.output = output; + } + + [Fact] + public void CanConvertDevToolsObjectToDictionary() + { + var bounds = new Bounds + { + Height = 1, + Width = 1, + Left = 1, + Top = 1, + WindowState = WindowState.Fullscreen + }; + + var dict = bounds.ToDictionary(); + + Assert.Equal(bounds.Height, (int)dict["height"]); + Assert.Equal(bounds.Width, (int)dict["width"]); + Assert.Equal(bounds.Top, (int)dict["top"]); + Assert.Equal(bounds.Left, (int)dict["left"]); + Assert.Equal("fullscreen", (string)dict["windowState"]); + } + + + [Fact] + public async Task CanGetDevToolsProtocolVersion() + { + using (var browser = new ChromiumWebBrowser("www.google.com")) + { + await browser.LoadPageAsync(); + + using (var devToolsClient = browser.GetDevToolsClient()) + { + var response = await devToolsClient.Browser.GetVersionAsync(); + var jsVersion = response.JsVersion; + var revision = response.Revision; + + Assert.NotNull(jsVersion); + Assert.NotNull(revision); + + output.WriteLine("DevTools Revision {0}", revision); + } + } + } + + [Fact] + public async Task CanCanEmulate() + { + using (var browser = new ChromiumWebBrowser("www.google.com")) + { + await browser.LoadPageAsync(); + + using (var devToolsClient = browser.GetDevToolsClient()) + { + var response = await devToolsClient.Emulation.CanEmulateAsync(); + + Assert.True(response.Result); + } + } + } + + [Fact] + public async Task CanGetPageNavigationHistory() + { + using (var browser = new ChromiumWebBrowser("www.google.com")) + { + await browser.LoadPageAsync(); + + using (var devToolsClient = browser.GetDevToolsClient()) + { + var response = await devToolsClient.Page.GetNavigationHistoryAsync(); + var currentIndex = response.CurrentIndex; + var entries = response.Entries; + + Assert.Equal(0, currentIndex); + Assert.NotNull(entries); + Assert.True(entries.Count > 0); + Assert.Equal(CefSharp.DevTools.Page.TransitionType.Typed, entries[0].TransitionType); + } + } + } + + [Theory] + //[InlineData("CefSharpTest", "CefSharp Test Cookie", CefExample.ExampleDomain, CookieSameSite.None)] + [InlineData("CefSharpTest1", "CefSharp Test Cookie2", CefExample.ExampleDomain, CookieSameSite.Lax)] + public async Task CanSetCookieForDomain(string name, string value, string domain, CookieSameSite sameSite) + { + using (var browser = new ChromiumWebBrowser("www.google.com")) + { + await browser.LoadPageAsync(); + + using (var devToolsClient = browser.GetDevToolsClient()) + { + var response = await devToolsClient.Network.SetCookieAsync(name, value, domain: domain, sameSite: sameSite); + Assert.True(response.Success, "SetCookieForDomain"); + } + } + } + + } +} diff --git a/CefSharp.Test/PostMessage/IntegrationTestFacts.cs b/CefSharp.Test/PostMessage/IntegrationTestFacts.cs new file mode 100644 index 0000000000..b068ca9f6e --- /dev/null +++ b/CefSharp.Test/PostMessage/IntegrationTestFacts.cs @@ -0,0 +1,79 @@ +// Copyright © 2020 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.Threading.Tasks; +using CefSharp.OffScreen; +using CefSharp.Web; +using Xunit; +using Xunit.Abstractions; + +namespace CefSharp.Test.PostMessage +{ + /// + /// This is more a set of integration tests than it is unit tests, for now we need to + /// run our QUnit tests in an automated fashion and some other testing. + /// + //TODO: Improve Test Naming, we need a naming scheme that fits these cases that's consistent + //(Ideally we implement consistent naming accross all test classes, though I'm open to a different + //naming convention as these are more integration tests than unit tests). + //NOTE: All Test classes must be part of this collection as it manages the Cef Initialize/Shutdown lifecycle + [Collection(CefSharpFixtureCollection.Key)] + public class IntegrationTestFacts + { + private readonly ITestOutputHelper output; + private readonly CefSharpFixture fixture; + + public IntegrationTestFacts(ITestOutputHelper output, CefSharpFixture fixture) + { + this.fixture = fixture; + this.output = output; + } + + [Theory] + [InlineData("Event", "Event1")] + [InlineData("Event", "Event2")] + [InlineData("CustomEvent", "Event1")] + [InlineData("CustomEvent", "Event2")] + public async Task JavascriptCustomEvent(string jsEventObject, string eventToRaise) + { + const string Script = @" + const postMessageHandler = e => { cefSharp.postMessage(e.type); }; + window.addEventListener(""Event1"", postMessageHandler, false); + window.addEventListener(""Event2"", postMessageHandler, false);"; + + string rawHtml = $"

testing

"; + int scriptId = 0; + + var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + //Load a dummy page initially so we can then add our script using + //Page.AddScriptToEvaluateOnNewDocument (via DevTools) + using (var browser = new ChromiumWebBrowser(new HtmlString("Initial Load"))) + { + await browser.LoadPageAsync(); + + using (var devToolsClient = browser.GetDevToolsClient()) + { + var result = await devToolsClient.Page.AddScriptToEvaluateOnNewDocumentAsync(Script); + scriptId = int.Parse(result.Identifier); + + //We must use Page.Enable for the script to be added + await devToolsClient.Page.EnableAsync(); + } + + browser.LoadHtml(rawHtml); + + browser.JavascriptMessageReceived += (o, e) => + { + tcs.SetResult((string)e.Message); + }; + + var responseFromJavascript = await tcs.Task; + + Assert.True(scriptId > 0); + Assert.Equal(eventToRaise, responseFromJavascript); + } + } + } +} diff --git a/CefSharp/CefSharp.csproj b/CefSharp/CefSharp.csproj index 1bd1df8068..2521ffe832 100644 --- a/CefSharp/CefSharp.csproj +++ b/CefSharp/CefSharp.csproj @@ -104,12 +104,498 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CefSharp/DevTools/Accessibility/AXNode.cs b/CefSharp/DevTools/Accessibility/AXNode.cs new file mode 100644 index 0000000000..b0b3a506da --- /dev/null +++ b/CefSharp/DevTools/Accessibility/AXNode.cs @@ -0,0 +1,112 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// A node in the accessibility tree. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AXNode : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Unique identifier for this node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeId"), IsRequired = (true))] + public string NodeId + { + get; + set; + } + + /// + /// Whether this node is ignored for accessibility + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("ignored"), IsRequired = (true))] + public bool Ignored + { + get; + set; + } + + /// + /// Collection of reasons why this node is hidden. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("ignoredReasons"), IsRequired = (false))] + public System.Collections.Generic.IList IgnoredReasons + { + get; + set; + } + + /// + /// This `Node`'s role, whether explicit or implicit. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("role"), IsRequired = (false))] + public CefSharp.DevTools.Accessibility.AXValue Role + { + get; + set; + } + + /// + /// The accessible name for this `Node`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (false))] + public CefSharp.DevTools.Accessibility.AXValue Name + { + get; + set; + } + + /// + /// The accessible description for this `Node`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("description"), IsRequired = (false))] + public CefSharp.DevTools.Accessibility.AXValue Description + { + get; + set; + } + + /// + /// The value for this `Node`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public CefSharp.DevTools.Accessibility.AXValue Value + { + get; + set; + } + + /// + /// All other properties + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("properties"), IsRequired = (false))] + public System.Collections.Generic.IList Properties + { + get; + set; + } + + /// + /// IDs for each of this node's child nodes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("childIds"), IsRequired = (false))] + public string[] ChildIds + { + get; + set; + } + + /// + /// The backend ID for the associated DOM node, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("backendDOMNodeId"), IsRequired = (false))] + public int? BackendDOMNodeId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/AXProperty.cs b/CefSharp/DevTools/Accessibility/AXProperty.cs new file mode 100644 index 0000000000..5df76dea14 --- /dev/null +++ b/CefSharp/DevTools/Accessibility/AXProperty.cs @@ -0,0 +1,45 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// AXProperty + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AXProperty : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Accessibility.AXPropertyName Name + { + get + { + return (CefSharp.DevTools.Accessibility.AXPropertyName)(StringToEnum(typeof(CefSharp.DevTools.Accessibility.AXPropertyName), name)); + } + + set + { + name = (EnumToString(value)); + } + } + + /// + /// The name of this property. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + internal string name + { + get; + set; + } + + /// + /// The value of this property. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public CefSharp.DevTools.Accessibility.AXValue Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/AXRelatedNode.cs b/CefSharp/DevTools/Accessibility/AXRelatedNode.cs new file mode 100644 index 0000000000..083e64cc9c --- /dev/null +++ b/CefSharp/DevTools/Accessibility/AXRelatedNode.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// AXRelatedNode + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AXRelatedNode : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The BackendNodeId of the related DOM node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("backendDOMNodeId"), IsRequired = (true))] + public int BackendDOMNodeId + { + get; + set; + } + + /// + /// The IDRef value provided, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("idref"), IsRequired = (false))] + public string Idref + { + get; + set; + } + + /// + /// The text alternative of this node in the current context. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("text"), IsRequired = (false))] + public string Text + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/AXValue.cs b/CefSharp/DevTools/Accessibility/AXValue.cs new file mode 100644 index 0000000000..00a822002f --- /dev/null +++ b/CefSharp/DevTools/Accessibility/AXValue.cs @@ -0,0 +1,65 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// A single computed AX property. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AXValue : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Accessibility.AXValueType Type + { + get + { + return (CefSharp.DevTools.Accessibility.AXValueType)(StringToEnum(typeof(CefSharp.DevTools.Accessibility.AXValueType), type)); + } + + set + { + type = (EnumToString(value)); + } + } + + /// + /// The type of this value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + internal string type + { + get; + set; + } + + /// + /// The computed value of this property. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public object Value + { + get; + set; + } + + /// + /// One or more related nodes, if applicable. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("relatedNodes"), IsRequired = (false))] + public System.Collections.Generic.IList RelatedNodes + { + get; + set; + } + + /// + /// The sources which contributed to the computation of this property. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sources"), IsRequired = (false))] + public System.Collections.Generic.IList Sources + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/AXValueSource.cs b/CefSharp/DevTools/Accessibility/AXValueSource.cs new file mode 100644 index 0000000000..89f71cb5e5 --- /dev/null +++ b/CefSharp/DevTools/Accessibility/AXValueSource.cs @@ -0,0 +1,128 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// A single source for a computed AX property. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AXValueSource : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Accessibility.AXValueSourceType Type + { + get + { + return (CefSharp.DevTools.Accessibility.AXValueSourceType)(StringToEnum(typeof(CefSharp.DevTools.Accessibility.AXValueSourceType), type)); + } + + set + { + type = (EnumToString(value)); + } + } + + /// + /// What type of source this is. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + internal string type + { + get; + set; + } + + /// + /// The value of this property source. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public CefSharp.DevTools.Accessibility.AXValue Value + { + get; + set; + } + + /// + /// The name of the relevant attribute, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("attribute"), IsRequired = (false))] + public string Attribute + { + get; + set; + } + + /// + /// The value of the relevant attribute, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("attributeValue"), IsRequired = (false))] + public CefSharp.DevTools.Accessibility.AXValue AttributeValue + { + get; + set; + } + + /// + /// Whether this source is superseded by a higher priority source. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("superseded"), IsRequired = (false))] + public bool? Superseded + { + get; + set; + } + + public CefSharp.DevTools.Accessibility.AXValueNativeSourceType? NativeSource + { + get + { + return (CefSharp.DevTools.Accessibility.AXValueNativeSourceType? )(StringToEnum(typeof(CefSharp.DevTools.Accessibility.AXValueNativeSourceType? ), nativeSource)); + } + + set + { + nativeSource = (EnumToString(value)); + } + } + + /// + /// The native markup source for this value, e.g. a + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nativeSource"), IsRequired = (false))] + internal string nativeSource + { + get; + set; + } + + /// + /// The value, such as a node or node list, of the native source. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nativeSourceValue"), IsRequired = (false))] + public CefSharp.DevTools.Accessibility.AXValue NativeSourceValue + { + get; + set; + } + + /// + /// Whether the value for this property is invalid. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("invalid"), IsRequired = (false))] + public bool? Invalid + { + get; + set; + } + + /// + /// Reason for the value being invalid, if it is. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("invalidReason"), IsRequired = (false))] + public string InvalidReason + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/Accessibility.cs b/CefSharp/DevTools/Accessibility/Accessibility.cs new file mode 100644 index 0000000000..0e79b1f91e --- /dev/null +++ b/CefSharp/DevTools/Accessibility/Accessibility.cs @@ -0,0 +1,90 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + using System.Linq; + + /// + /// Accessibility + /// + public partial class Accessibility : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Accessibility(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disables the accessibility domain. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Accessibility.disable", dict); + return methodResult; + } + + /// + /// Enables the accessibility domain which causes `AXNodeId`s to remain consistent between method calls. + /// This turns on accessibility for the page, which can impact performance until accessibility is disabled. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Accessibility.enable", dict); + return methodResult; + } + + partial void ValidateGetPartialAXTree(int? nodeId = null, int? backendNodeId = null, string objectId = null, bool? fetchRelatives = null); + /// + /// Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists. + /// + /// Identifier of the node to get the partial accessibility tree for. + /// Identifier of the backend node to get the partial accessibility tree for. + /// JavaScript object id of the node wrapper to get the partial accessibility tree for. + /// Whether to fetch this nodes ancestors, siblings and children. Defaults to true. + /// returns System.Threading.Tasks.Task<GetPartialAXTreeResponse> + public async System.Threading.Tasks.Task GetPartialAXTreeAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null, bool? fetchRelatives = null) + { + ValidateGetPartialAXTree(nodeId, backendNodeId, objectId, fetchRelatives); + var dict = new System.Collections.Generic.Dictionary(); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + if (fetchRelatives.HasValue) + { + dict.Add("fetchRelatives", fetchRelatives.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Accessibility.getPartialAXTree", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Fetches the entire accessibility tree + /// + /// returns System.Threading.Tasks.Task<GetFullAXTreeResponse> + public async System.Threading.Tasks.Task GetFullAXTreeAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Accessibility.getFullAXTree", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/Enums/AXPropertyName.cs b/CefSharp/DevTools/Accessibility/Enums/AXPropertyName.cs new file mode 100644 index 0000000000..2e4703c07f --- /dev/null +++ b/CefSharp/DevTools/Accessibility/Enums/AXPropertyName.cs @@ -0,0 +1,212 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// Values of AXProperty name: + /// - from 'busy' to 'roledescription': states which apply to every AX node + /// - from 'live' to 'root': attributes which apply to nodes in live regions + /// - from 'autocomplete' to 'valuetext': attributes which apply to widgets + /// - from 'checked' to 'selected': states which apply to widgets + /// - from 'activedescendant' to 'owns' - relationships between elements other than parent/child/sibling. + /// + public enum AXPropertyName + { + /// + /// busy + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("busy"))] + Busy, + /// + /// disabled + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("disabled"))] + Disabled, + /// + /// editable + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("editable"))] + Editable, + /// + /// focusable + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("focusable"))] + Focusable, + /// + /// focused + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("focused"))] + Focused, + /// + /// hidden + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("hidden"))] + Hidden, + /// + /// hiddenRoot + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("hiddenRoot"))] + HiddenRoot, + /// + /// invalid + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("invalid"))] + Invalid, + /// + /// keyshortcuts + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("keyshortcuts"))] + Keyshortcuts, + /// + /// settable + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("settable"))] + Settable, + /// + /// roledescription + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("roledescription"))] + Roledescription, + /// + /// live + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("live"))] + Live, + /// + /// atomic + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("atomic"))] + Atomic, + /// + /// relevant + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("relevant"))] + Relevant, + /// + /// root + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("root"))] + Root, + /// + /// autocomplete + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("autocomplete"))] + Autocomplete, + /// + /// hasPopup + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("hasPopup"))] + HasPopup, + /// + /// level + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("level"))] + Level, + /// + /// multiselectable + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("multiselectable"))] + Multiselectable, + /// + /// orientation + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("orientation"))] + Orientation, + /// + /// multiline + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("multiline"))] + Multiline, + /// + /// readonly + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("readonly"))] + Readonly, + /// + /// required + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("required"))] + Required, + /// + /// valuemin + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("valuemin"))] + Valuemin, + /// + /// valuemax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("valuemax"))] + Valuemax, + /// + /// valuetext + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("valuetext"))] + Valuetext, + /// + /// checked + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("checked"))] + Checked, + /// + /// expanded + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("expanded"))] + Expanded, + /// + /// modal + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("modal"))] + Modal, + /// + /// pressed + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("pressed"))] + Pressed, + /// + /// selected + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("selected"))] + Selected, + /// + /// activedescendant + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("activedescendant"))] + Activedescendant, + /// + /// controls + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("controls"))] + Controls, + /// + /// describedby + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("describedby"))] + Describedby, + /// + /// details + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("details"))] + Details, + /// + /// errormessage + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("errormessage"))] + Errormessage, + /// + /// flowto + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("flowto"))] + Flowto, + /// + /// labelledby + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("labelledby"))] + Labelledby, + /// + /// owns + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("owns"))] + Owns + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/Enums/AXValueNativeSourceType.cs b/CefSharp/DevTools/Accessibility/Enums/AXValueNativeSourceType.cs new file mode 100644 index 0000000000..e7e77e869c --- /dev/null +++ b/CefSharp/DevTools/Accessibility/Enums/AXValueNativeSourceType.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// Enum of possible native property sources (as a subtype of a particular AXValueSourceType). + /// + public enum AXValueNativeSourceType + { + /// + /// figcaption + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("figcaption"))] + Figcaption, + /// + /// label + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("label"))] + Label, + /// + /// labelfor + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("labelfor"))] + Labelfor, + /// + /// labelwrapped + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("labelwrapped"))] + Labelwrapped, + /// + /// legend + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("legend"))] + Legend, + /// + /// tablecaption + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("tablecaption"))] + Tablecaption, + /// + /// title + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("title"))] + Title, + /// + /// other + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("other"))] + Other + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/Enums/AXValueSourceType.cs b/CefSharp/DevTools/Accessibility/Enums/AXValueSourceType.cs new file mode 100644 index 0000000000..cdc6438c43 --- /dev/null +++ b/CefSharp/DevTools/Accessibility/Enums/AXValueSourceType.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// Enum of possible property sources. + /// + public enum AXValueSourceType + { + /// + /// attribute + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("attribute"))] + Attribute, + /// + /// implicit + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("implicit"))] + Implicit, + /// + /// style + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("style"))] + Style, + /// + /// contents + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("contents"))] + Contents, + /// + /// placeholder + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("placeholder"))] + Placeholder, + /// + /// relatedElement + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("relatedElement"))] + RelatedElement + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/Enums/AXValueType.cs b/CefSharp/DevTools/Accessibility/Enums/AXValueType.cs new file mode 100644 index 0000000000..b81a6cfb6f --- /dev/null +++ b/CefSharp/DevTools/Accessibility/Enums/AXValueType.cs @@ -0,0 +1,97 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// Enum of possible property types. + /// + public enum AXValueType + { + /// + /// boolean + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("boolean"))] + Boolean, + /// + /// tristate + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("tristate"))] + Tristate, + /// + /// booleanOrUndefined + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("booleanOrUndefined"))] + BooleanOrUndefined, + /// + /// idref + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("idref"))] + Idref, + /// + /// idrefList + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("idrefList"))] + IdrefList, + /// + /// integer + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("integer"))] + Integer, + /// + /// node + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("node"))] + Node, + /// + /// nodeList + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("nodeList"))] + NodeList, + /// + /// number + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("number"))] + Number, + /// + /// string + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("string"))] + String, + /// + /// computedString + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("computedString"))] + ComputedString, + /// + /// token + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("token"))] + Token, + /// + /// tokenList + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("tokenList"))] + TokenList, + /// + /// domRelation + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("domRelation"))] + DomRelation, + /// + /// role + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("role"))] + Role, + /// + /// internalRole + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("internalRole"))] + InternalRole, + /// + /// valueUndefined + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("valueUndefined"))] + ValueUndefined + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/GetFullAXTreeResponse.cs b/CefSharp/DevTools/Accessibility/GetFullAXTreeResponse.cs new file mode 100644 index 0000000000..31703db3cd --- /dev/null +++ b/CefSharp/DevTools/Accessibility/GetFullAXTreeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// GetFullAXTreeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetFullAXTreeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList nodes + { + get; + set; + } + + /// + /// nodes + /// + public System.Collections.Generic.IList Nodes + { + get + { + return nodes; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Accessibility/GetPartialAXTreeResponse.cs b/CefSharp/DevTools/Accessibility/GetPartialAXTreeResponse.cs new file mode 100644 index 0000000000..21504a6f28 --- /dev/null +++ b/CefSharp/DevTools/Accessibility/GetPartialAXTreeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Accessibility +{ + /// + /// GetPartialAXTreeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetPartialAXTreeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList nodes + { + get; + set; + } + + /// + /// nodes + /// + public System.Collections.Generic.IList Nodes + { + get + { + return nodes; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Animation/Animation.cs b/CefSharp/DevTools/Animation/Animation.cs new file mode 100644 index 0000000000..e8b8ddeead --- /dev/null +++ b/CefSharp/DevTools/Animation/Animation.cs @@ -0,0 +1,165 @@ +// Copyright © 2020 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.DevTools.Animation +{ + using System.Linq; + + /// + /// Animation + /// + public partial class Animation : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Animation(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disables animation domain notifications. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.disable", dict); + return methodResult; + } + + /// + /// Enables animation domain notifications. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.enable", dict); + return methodResult; + } + + partial void ValidateGetCurrentTime(string id); + /// + /// Returns the current time of the an animation. + /// + /// Id of animation. + /// returns System.Threading.Tasks.Task<GetCurrentTimeResponse> + public async System.Threading.Tasks.Task GetCurrentTimeAsync(string id) + { + ValidateGetCurrentTime(id); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("id", id); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.getCurrentTime", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Gets the playback rate of the document timeline. + /// + /// returns System.Threading.Tasks.Task<GetPlaybackRateResponse> + public async System.Threading.Tasks.Task GetPlaybackRateAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.getPlaybackRate", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateReleaseAnimations(string[] animations); + /// + /// Releases a set of animations to no longer be manipulated. + /// + /// List of animation ids to seek. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ReleaseAnimationsAsync(string[] animations) + { + ValidateReleaseAnimations(animations); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("animations", animations); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.releaseAnimations", dict); + return methodResult; + } + + partial void ValidateResolveAnimation(string animationId); + /// + /// Gets the remote object of the Animation. + /// + /// Animation id. + /// returns System.Threading.Tasks.Task<ResolveAnimationResponse> + public async System.Threading.Tasks.Task ResolveAnimationAsync(string animationId) + { + ValidateResolveAnimation(animationId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("animationId", animationId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.resolveAnimation", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSeekAnimations(string[] animations, long currentTime); + /// + /// Seek a set of animations to a particular time within each animation. + /// + /// List of animation ids to seek. + /// Set the current time of each animation. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SeekAnimationsAsync(string[] animations, long currentTime) + { + ValidateSeekAnimations(animations, currentTime); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("animations", animations); + dict.Add("currentTime", currentTime); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.seekAnimations", dict); + return methodResult; + } + + partial void ValidateSetPaused(string[] animations, bool paused); + /// + /// Sets the paused state of a set of animations. + /// + /// Animations to set the pause state of. + /// Paused state to set to. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetPausedAsync(string[] animations, bool paused) + { + ValidateSetPaused(animations, paused); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("animations", animations); + dict.Add("paused", paused); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.setPaused", dict); + return methodResult; + } + + partial void ValidateSetPlaybackRate(long playbackRate); + /// + /// Sets the playback rate of the document timeline. + /// + /// Playback rate for animations on page + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetPlaybackRateAsync(long playbackRate) + { + ValidateSetPlaybackRate(playbackRate); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("playbackRate", playbackRate); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.setPlaybackRate", dict); + return methodResult; + } + + partial void ValidateSetTiming(string animationId, long duration, long delay); + /// + /// Sets the timing of an animation node. + /// + /// Animation id. + /// Duration of the animation. + /// Delay of the animation. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetTimingAsync(string animationId, long duration, long delay) + { + ValidateSetTiming(animationId, duration, delay); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("animationId", animationId); + dict.Add("duration", duration); + dict.Add("delay", delay); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.setTiming", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Animation/AnimationEffect.cs b/CefSharp/DevTools/Animation/AnimationEffect.cs new file mode 100644 index 0000000000..52c577813a --- /dev/null +++ b/CefSharp/DevTools/Animation/AnimationEffect.cs @@ -0,0 +1,112 @@ +// Copyright © 2020 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.DevTools.Animation +{ + /// + /// AnimationEffect instance + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AnimationEffect : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// `AnimationEffect`'s delay. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("delay"), IsRequired = (true))] + public long Delay + { + get; + set; + } + + /// + /// `AnimationEffect`'s end delay. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("endDelay"), IsRequired = (true))] + public long EndDelay + { + get; + set; + } + + /// + /// `AnimationEffect`'s iteration start. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("iterationStart"), IsRequired = (true))] + public long IterationStart + { + get; + set; + } + + /// + /// `AnimationEffect`'s iterations. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("iterations"), IsRequired = (true))] + public long Iterations + { + get; + set; + } + + /// + /// `AnimationEffect`'s iteration duration. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("duration"), IsRequired = (true))] + public long Duration + { + get; + set; + } + + /// + /// `AnimationEffect`'s playback direction. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("direction"), IsRequired = (true))] + public string Direction + { + get; + set; + } + + /// + /// `AnimationEffect`'s fill mode. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fill"), IsRequired = (true))] + public string Fill + { + get; + set; + } + + /// + /// `AnimationEffect`'s target node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("backendNodeId"), IsRequired = (false))] + public int? BackendNodeId + { + get; + set; + } + + /// + /// `AnimationEffect`'s keyframes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyframesRule"), IsRequired = (false))] + public CefSharp.DevTools.Animation.KeyframesRule KeyframesRule + { + get; + set; + } + + /// + /// `AnimationEffect`'s timing function. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("easing"), IsRequired = (true))] + public string Easing + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Animation/GetCurrentTimeResponse.cs b/CefSharp/DevTools/Animation/GetCurrentTimeResponse.cs new file mode 100644 index 0000000000..89f184d2b6 --- /dev/null +++ b/CefSharp/DevTools/Animation/GetCurrentTimeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Animation +{ + /// + /// GetCurrentTimeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetCurrentTimeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal long currentTime + { + get; + set; + } + + /// + /// currentTime + /// + public long CurrentTime + { + get + { + return currentTime; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Animation/GetPlaybackRateResponse.cs b/CefSharp/DevTools/Animation/GetPlaybackRateResponse.cs new file mode 100644 index 0000000000..ebab091a32 --- /dev/null +++ b/CefSharp/DevTools/Animation/GetPlaybackRateResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Animation +{ + /// + /// GetPlaybackRateResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetPlaybackRateResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal long playbackRate + { + get; + set; + } + + /// + /// playbackRate + /// + public long PlaybackRate + { + get + { + return playbackRate; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Animation/KeyframeStyle.cs b/CefSharp/DevTools/Animation/KeyframeStyle.cs new file mode 100644 index 0000000000..3dbe21066a --- /dev/null +++ b/CefSharp/DevTools/Animation/KeyframeStyle.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Animation +{ + /// + /// Keyframe Style + /// + [System.Runtime.Serialization.DataContractAttribute] + public class KeyframeStyle : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Keyframe's time offset. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("offset"), IsRequired = (true))] + public string Offset + { + get; + set; + } + + /// + /// `AnimationEffect`'s timing function. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("easing"), IsRequired = (true))] + public string Easing + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Animation/KeyframesRule.cs b/CefSharp/DevTools/Animation/KeyframesRule.cs new file mode 100644 index 0000000000..27fd7d84b9 --- /dev/null +++ b/CefSharp/DevTools/Animation/KeyframesRule.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Animation +{ + /// + /// Keyframes Rule + /// + [System.Runtime.Serialization.DataContractAttribute] + public class KeyframesRule : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// CSS keyframed animation's name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (false))] + public string Name + { + get; + set; + } + + /// + /// List of animation keyframes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyframes"), IsRequired = (true))] + public System.Collections.Generic.IList Keyframes + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Animation/ResolveAnimationResponse.cs b/CefSharp/DevTools/Animation/ResolveAnimationResponse.cs new file mode 100644 index 0000000000..c054e28219 --- /dev/null +++ b/CefSharp/DevTools/Animation/ResolveAnimationResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Animation +{ + /// + /// ResolveAnimationResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ResolveAnimationResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject remoteObject + { + get; + set; + } + + /// + /// remoteObject + /// + public CefSharp.DevTools.Runtime.RemoteObject RemoteObject + { + get + { + return remoteObject; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ApplicationCache/ApplicationCache.cs b/CefSharp/DevTools/ApplicationCache/ApplicationCache.cs new file mode 100644 index 0000000000..0442639a85 --- /dev/null +++ b/CefSharp/DevTools/ApplicationCache/ApplicationCache.cs @@ -0,0 +1,72 @@ +// Copyright © 2020 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.DevTools.ApplicationCache +{ + using System.Linq; + + /// + /// ApplicationCache + /// + public partial class ApplicationCache : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public ApplicationCache(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Enables application cache domain notifications. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("ApplicationCache.enable", dict); + return methodResult; + } + + partial void ValidateGetApplicationCacheForFrame(string frameId); + /// + /// Returns relevant application cache data for the document in given frame. + /// + /// Identifier of the frame containing document whose application cache is retrieved. + /// returns System.Threading.Tasks.Task<GetApplicationCacheForFrameResponse> + public async System.Threading.Tasks.Task GetApplicationCacheForFrameAsync(string frameId) + { + ValidateGetApplicationCacheForFrame(frameId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("frameId", frameId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ApplicationCache.getApplicationCacheForFrame", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns array of frame identifiers with manifest urls for each frame containing a document + /// associated with some application cache. + /// + /// returns System.Threading.Tasks.Task<GetFramesWithManifestsResponse> + public async System.Threading.Tasks.Task GetFramesWithManifestsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("ApplicationCache.getFramesWithManifests", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetManifestForFrame(string frameId); + /// + /// Returns manifest URL for document in the given frame. + /// + /// Identifier of the frame containing document whose manifest is retrieved. + /// returns System.Threading.Tasks.Task<GetManifestForFrameResponse> + public async System.Threading.Tasks.Task GetManifestForFrameAsync(string frameId) + { + ValidateGetManifestForFrame(frameId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("frameId", frameId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ApplicationCache.getManifestForFrame", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ApplicationCache/ApplicationCacheResource.cs b/CefSharp/DevTools/ApplicationCache/ApplicationCacheResource.cs new file mode 100644 index 0000000000..6665dbb4cd --- /dev/null +++ b/CefSharp/DevTools/ApplicationCache/ApplicationCacheResource.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.ApplicationCache +{ + /// + /// Detailed application cache resource information. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ApplicationCacheResource : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Resource url. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// Resource size. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("size"), IsRequired = (true))] + public int Size + { + get; + set; + } + + /// + /// Resource type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ApplicationCache/FrameWithManifest.cs b/CefSharp/DevTools/ApplicationCache/FrameWithManifest.cs new file mode 100644 index 0000000000..6ae0d88fb3 --- /dev/null +++ b/CefSharp/DevTools/ApplicationCache/FrameWithManifest.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.ApplicationCache +{ + /// + /// Frame identifier - manifest URL pair. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class FrameWithManifest : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Frame identifier. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frameId"), IsRequired = (true))] + public string FrameId + { + get; + set; + } + + /// + /// Manifest URL. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("manifestURL"), IsRequired = (true))] + public string ManifestURL + { + get; + set; + } + + /// + /// Application cache status. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("status"), IsRequired = (true))] + public int Status + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ApplicationCache/GetApplicationCacheForFrameResponse.cs b/CefSharp/DevTools/ApplicationCache/GetApplicationCacheForFrameResponse.cs new file mode 100644 index 0000000000..5d38ef8b66 --- /dev/null +++ b/CefSharp/DevTools/ApplicationCache/GetApplicationCacheForFrameResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.ApplicationCache +{ + /// + /// GetApplicationCacheForFrameResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetApplicationCacheForFrameResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.ApplicationCache.ApplicationCache applicationCache + { + get; + set; + } + + /// + /// applicationCache + /// + public CefSharp.DevTools.ApplicationCache.ApplicationCache ApplicationCache + { + get + { + return applicationCache; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ApplicationCache/GetFramesWithManifestsResponse.cs b/CefSharp/DevTools/ApplicationCache/GetFramesWithManifestsResponse.cs new file mode 100644 index 0000000000..531c81a70a --- /dev/null +++ b/CefSharp/DevTools/ApplicationCache/GetFramesWithManifestsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.ApplicationCache +{ + /// + /// GetFramesWithManifestsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetFramesWithManifestsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList frameIds + { + get; + set; + } + + /// + /// frameIds + /// + public System.Collections.Generic.IList FrameIds + { + get + { + return frameIds; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ApplicationCache/GetManifestForFrameResponse.cs b/CefSharp/DevTools/ApplicationCache/GetManifestForFrameResponse.cs new file mode 100644 index 0000000000..3ce62aea51 --- /dev/null +++ b/CefSharp/DevTools/ApplicationCache/GetManifestForFrameResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.ApplicationCache +{ + /// + /// GetManifestForFrameResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetManifestForFrameResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string manifestURL + { + get; + set; + } + + /// + /// manifestURL + /// + public string ManifestURL + { + get + { + return manifestURL; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/AffectedCookie.cs b/CefSharp/DevTools/Audits/AffectedCookie.cs new file mode 100644 index 0000000000..11d42c3b4e --- /dev/null +++ b/CefSharp/DevTools/Audits/AffectedCookie.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// Information about a cookie that is affected by an inspector issue. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AffectedCookie : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The following three properties uniquely identify a cookie + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Path + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("path"), IsRequired = (true))] + public string Path + { + get; + set; + } + + /// + /// Domain + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("domain"), IsRequired = (true))] + public string Domain + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/AffectedFrame.cs b/CefSharp/DevTools/Audits/AffectedFrame.cs new file mode 100644 index 0000000000..f1744c0991 --- /dev/null +++ b/CefSharp/DevTools/Audits/AffectedFrame.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// Information about the frame affected by an inspector issue. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AffectedFrame : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// FrameId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frameId"), IsRequired = (true))] + public string FrameId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/AffectedRequest.cs b/CefSharp/DevTools/Audits/AffectedRequest.cs new file mode 100644 index 0000000000..f98de5b8cb --- /dev/null +++ b/CefSharp/DevTools/Audits/AffectedRequest.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// Information about a request that is affected by an inspector issue. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AffectedRequest : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The unique request id. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestId"), IsRequired = (true))] + public string RequestId + { + get; + set; + } + + /// + /// Url + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (false))] + public string Url + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Audits.cs b/CefSharp/DevTools/Audits/Audits.cs new file mode 100644 index 0000000000..7d4d457c25 --- /dev/null +++ b/CefSharp/DevTools/Audits/Audits.cs @@ -0,0 +1,72 @@ +// Copyright © 2020 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.DevTools.Audits +{ + using System.Linq; + + /// + /// Audits domain allows investigation of page violations and possible improvements. + /// + public partial class Audits : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Audits(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateGetEncodedResponse(string requestId, string encoding, long? quality = null, bool? sizeOnly = null); + /// + /// Returns the response body and size if it were re-encoded with the specified settings. Only + /// applies to images. + /// + /// Identifier of the network request to get content for. + /// The encoding to use. + /// The quality of the encoding (0-1). (defaults to 1) + /// Whether to only return the size information (defaults to false). + /// returns System.Threading.Tasks.Task<GetEncodedResponseResponse> + public async System.Threading.Tasks.Task GetEncodedResponseAsync(string requestId, string encoding, long? quality = null, bool? sizeOnly = null) + { + ValidateGetEncodedResponse(requestId, encoding, quality, sizeOnly); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + dict.Add("encoding", encoding); + if (quality.HasValue) + { + dict.Add("quality", quality.Value); + } + + if (sizeOnly.HasValue) + { + dict.Add("sizeOnly", sizeOnly.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Audits.getEncodedResponse", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Disables issues domain, prevents further issues from being reported to the client. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Audits.disable", dict); + return methodResult; + } + + /// + /// Enables issues domain, sends the issues collected so far to the client by means of the + /// `issueAdded` event. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Audits.enable", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/BlockedByResponseIssueDetails.cs b/CefSharp/DevTools/Audits/BlockedByResponseIssueDetails.cs new file mode 100644 index 0000000000..5ee727bf55 --- /dev/null +++ b/CefSharp/DevTools/Audits/BlockedByResponseIssueDetails.cs @@ -0,0 +1,57 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// Details for a request that has been blocked with the BLOCKED_BY_RESPONSE + /// code. Currently only used for COEP/COOP, but may be extended to include + /// some CSP errors in the future. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class BlockedByResponseIssueDetails : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Request + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("request"), IsRequired = (true))] + public CefSharp.DevTools.Audits.AffectedRequest Request + { + get; + set; + } + + /// + /// Frame + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frame"), IsRequired = (false))] + public CefSharp.DevTools.Audits.AffectedFrame Frame + { + get; + set; + } + + public CefSharp.DevTools.Audits.BlockedByResponseReason Reason + { + get + { + return (CefSharp.DevTools.Audits.BlockedByResponseReason)(StringToEnum(typeof(CefSharp.DevTools.Audits.BlockedByResponseReason), reason)); + } + + set + { + reason = (EnumToString(value)); + } + } + + /// + /// Reason + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("reason"), IsRequired = (true))] + internal string reason + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Enums/BlockedByResponseReason.cs b/CefSharp/DevTools/Audits/Enums/BlockedByResponseReason.cs new file mode 100644 index 0000000000..0b2076806c --- /dev/null +++ b/CefSharp/DevTools/Audits/Enums/BlockedByResponseReason.cs @@ -0,0 +1,38 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// Enum indicating the reason a response has been blocked. These reasons are + /// refinements of the net error BLOCKED_BY_RESPONSE. + /// + public enum BlockedByResponseReason + { + /// + /// CoepFrameResourceNeedsCoepHeader + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("CoepFrameResourceNeedsCoepHeader"))] + CoepFrameResourceNeedsCoepHeader, + /// + /// CoopSandboxedIFrameCannotNavigateToCoopPage + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("CoopSandboxedIFrameCannotNavigateToCoopPage"))] + CoopSandboxedIFrameCannotNavigateToCoopPage, + /// + /// CorpNotSameOrigin + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("CorpNotSameOrigin"))] + CorpNotSameOrigin, + /// + /// CorpNotSameOriginAfterDefaultedToSameOriginByCoep + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("CorpNotSameOriginAfterDefaultedToSameOriginByCoep"))] + CorpNotSameOriginAfterDefaultedToSameOriginByCoep, + /// + /// CorpNotSameSite + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("CorpNotSameSite"))] + CorpNotSameSite + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Enums/HeavyAdReason.cs b/CefSharp/DevTools/Audits/Enums/HeavyAdReason.cs new file mode 100644 index 0000000000..c8cd99363c --- /dev/null +++ b/CefSharp/DevTools/Audits/Enums/HeavyAdReason.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// HeavyAdReason + /// + public enum HeavyAdReason + { + /// + /// NetworkTotalLimit + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("NetworkTotalLimit"))] + NetworkTotalLimit, + /// + /// CpuTotalLimit + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("CpuTotalLimit"))] + CpuTotalLimit, + /// + /// CpuPeakLimit + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("CpuPeakLimit"))] + CpuPeakLimit + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Enums/HeavyAdResolutionStatus.cs b/CefSharp/DevTools/Audits/Enums/HeavyAdResolutionStatus.cs new file mode 100644 index 0000000000..527728cfb5 --- /dev/null +++ b/CefSharp/DevTools/Audits/Enums/HeavyAdResolutionStatus.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// HeavyAdResolutionStatus + /// + public enum HeavyAdResolutionStatus + { + /// + /// HeavyAdBlocked + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("HeavyAdBlocked"))] + HeavyAdBlocked, + /// + /// HeavyAdWarning + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("HeavyAdWarning"))] + HeavyAdWarning + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Enums/InspectorIssueCode.cs b/CefSharp/DevTools/Audits/Enums/InspectorIssueCode.cs new file mode 100644 index 0000000000..184f849fbb --- /dev/null +++ b/CefSharp/DevTools/Audits/Enums/InspectorIssueCode.cs @@ -0,0 +1,34 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// A unique identifier for the type of issue. Each type may use one of the + /// optional fields in InspectorIssueDetails to convey more specific + /// information about the kind of issue. + /// + public enum InspectorIssueCode + { + /// + /// SameSiteCookieIssue + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SameSiteCookieIssue"))] + SameSiteCookieIssue, + /// + /// MixedContentIssue + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("MixedContentIssue"))] + MixedContentIssue, + /// + /// BlockedByResponseIssue + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("BlockedByResponseIssue"))] + BlockedByResponseIssue, + /// + /// HeavyAdIssue + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("HeavyAdIssue"))] + HeavyAdIssue + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Enums/MixedContentResolutionStatus.cs b/CefSharp/DevTools/Audits/Enums/MixedContentResolutionStatus.cs new file mode 100644 index 0000000000..7f3375c886 --- /dev/null +++ b/CefSharp/DevTools/Audits/Enums/MixedContentResolutionStatus.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// MixedContentResolutionStatus + /// + public enum MixedContentResolutionStatus + { + /// + /// MixedContentBlocked + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("MixedContentBlocked"))] + MixedContentBlocked, + /// + /// MixedContentAutomaticallyUpgraded + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("MixedContentAutomaticallyUpgraded"))] + MixedContentAutomaticallyUpgraded, + /// + /// MixedContentWarning + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("MixedContentWarning"))] + MixedContentWarning + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Enums/MixedContentResourceType.cs b/CefSharp/DevTools/Audits/Enums/MixedContentResourceType.cs new file mode 100644 index 0000000000..81231e4b6d --- /dev/null +++ b/CefSharp/DevTools/Audits/Enums/MixedContentResourceType.cs @@ -0,0 +1,142 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// MixedContentResourceType + /// + public enum MixedContentResourceType + { + /// + /// Audio + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Audio"))] + Audio, + /// + /// Beacon + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Beacon"))] + Beacon, + /// + /// CSPReport + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("CSPReport"))] + CSPReport, + /// + /// Download + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Download"))] + Download, + /// + /// EventSource + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("EventSource"))] + EventSource, + /// + /// Favicon + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Favicon"))] + Favicon, + /// + /// Font + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Font"))] + Font, + /// + /// Form + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Form"))] + Form, + /// + /// Frame + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Frame"))] + Frame, + /// + /// Image + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Image"))] + Image, + /// + /// Import + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Import"))] + Import, + /// + /// Manifest + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Manifest"))] + Manifest, + /// + /// Ping + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Ping"))] + Ping, + /// + /// PluginData + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("PluginData"))] + PluginData, + /// + /// PluginResource + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("PluginResource"))] + PluginResource, + /// + /// Prefetch + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Prefetch"))] + Prefetch, + /// + /// Resource + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Resource"))] + Resource, + /// + /// Script + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Script"))] + Script, + /// + /// ServiceWorker + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ServiceWorker"))] + ServiceWorker, + /// + /// SharedWorker + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SharedWorker"))] + SharedWorker, + /// + /// Stylesheet + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Stylesheet"))] + Stylesheet, + /// + /// Track + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Track"))] + Track, + /// + /// Video + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Video"))] + Video, + /// + /// Worker + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Worker"))] + Worker, + /// + /// XMLHttpRequest + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("XMLHttpRequest"))] + XMLHttpRequest, + /// + /// XSLT + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("XSLT"))] + XSLT + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Enums/SameSiteCookieExclusionReason.cs b/CefSharp/DevTools/Audits/Enums/SameSiteCookieExclusionReason.cs new file mode 100644 index 0000000000..6fff59d24d --- /dev/null +++ b/CefSharp/DevTools/Audits/Enums/SameSiteCookieExclusionReason.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// SameSiteCookieExclusionReason + /// + public enum SameSiteCookieExclusionReason + { + /// + /// ExcludeSameSiteUnspecifiedTreatedAsLax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ExcludeSameSiteUnspecifiedTreatedAsLax"))] + ExcludeSameSiteUnspecifiedTreatedAsLax, + /// + /// ExcludeSameSiteNoneInsecure + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ExcludeSameSiteNoneInsecure"))] + ExcludeSameSiteNoneInsecure + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Enums/SameSiteCookieOperation.cs b/CefSharp/DevTools/Audits/Enums/SameSiteCookieOperation.cs new file mode 100644 index 0000000000..92cb1fdb92 --- /dev/null +++ b/CefSharp/DevTools/Audits/Enums/SameSiteCookieOperation.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// SameSiteCookieOperation + /// + public enum SameSiteCookieOperation + { + /// + /// SetCookie + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SetCookie"))] + SetCookie, + /// + /// ReadCookie + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ReadCookie"))] + ReadCookie + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/Enums/SameSiteCookieWarningReason.cs b/CefSharp/DevTools/Audits/Enums/SameSiteCookieWarningReason.cs new file mode 100644 index 0000000000..5ea54b10af --- /dev/null +++ b/CefSharp/DevTools/Audits/Enums/SameSiteCookieWarningReason.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// SameSiteCookieWarningReason + /// + public enum SameSiteCookieWarningReason + { + /// + /// WarnSameSiteUnspecifiedCrossSiteContext + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WarnSameSiteUnspecifiedCrossSiteContext"))] + WarnSameSiteUnspecifiedCrossSiteContext, + /// + /// WarnSameSiteNoneInsecure + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WarnSameSiteNoneInsecure"))] + WarnSameSiteNoneInsecure, + /// + /// WarnSameSiteUnspecifiedLaxAllowUnsafe + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WarnSameSiteUnspecifiedLaxAllowUnsafe"))] + WarnSameSiteUnspecifiedLaxAllowUnsafe, + /// + /// WarnSameSiteStrictLaxDowngradeStrict + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WarnSameSiteStrictLaxDowngradeStrict"))] + WarnSameSiteStrictLaxDowngradeStrict, + /// + /// WarnSameSiteStrictCrossDowngradeStrict + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WarnSameSiteStrictCrossDowngradeStrict"))] + WarnSameSiteStrictCrossDowngradeStrict, + /// + /// WarnSameSiteStrictCrossDowngradeLax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WarnSameSiteStrictCrossDowngradeLax"))] + WarnSameSiteStrictCrossDowngradeLax, + /// + /// WarnSameSiteLaxCrossDowngradeStrict + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WarnSameSiteLaxCrossDowngradeStrict"))] + WarnSameSiteLaxCrossDowngradeStrict, + /// + /// WarnSameSiteLaxCrossDowngradeLax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WarnSameSiteLaxCrossDowngradeLax"))] + WarnSameSiteLaxCrossDowngradeLax + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/GetEncodedResponseResponse.cs b/CefSharp/DevTools/Audits/GetEncodedResponseResponse.cs new file mode 100644 index 0000000000..4ed7eb31a4 --- /dev/null +++ b/CefSharp/DevTools/Audits/GetEncodedResponseResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// GetEncodedResponseResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetEncodedResponseResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string body + { + get; + set; + } + + /// + /// body + /// + public byte[] Body + { + get + { + return Convert(body); + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal int originalSize + { + get; + set; + } + + /// + /// originalSize + /// + public int OriginalSize + { + get + { + return originalSize; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal int encodedSize + { + get; + set; + } + + /// + /// encodedSize + /// + public int EncodedSize + { + get + { + return encodedSize; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/HeavyAdIssueDetails.cs b/CefSharp/DevTools/Audits/HeavyAdIssueDetails.cs new file mode 100644 index 0000000000..74052fd2d1 --- /dev/null +++ b/CefSharp/DevTools/Audits/HeavyAdIssueDetails.cs @@ -0,0 +1,68 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// HeavyAdIssueDetails + /// + [System.Runtime.Serialization.DataContractAttribute] + public class HeavyAdIssueDetails : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Audits.HeavyAdResolutionStatus Resolution + { + get + { + return (CefSharp.DevTools.Audits.HeavyAdResolutionStatus)(StringToEnum(typeof(CefSharp.DevTools.Audits.HeavyAdResolutionStatus), resolution)); + } + + set + { + resolution = (EnumToString(value)); + } + } + + /// + /// The resolution status, either blocking the content or warning. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("resolution"), IsRequired = (true))] + internal string resolution + { + get; + set; + } + + public CefSharp.DevTools.Audits.HeavyAdReason Reason + { + get + { + return (CefSharp.DevTools.Audits.HeavyAdReason)(StringToEnum(typeof(CefSharp.DevTools.Audits.HeavyAdReason), reason)); + } + + set + { + reason = (EnumToString(value)); + } + } + + /// + /// The reason the ad was blocked, total network or cpu or peak cpu. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("reason"), IsRequired = (true))] + internal string reason + { + get; + set; + } + + /// + /// The frame that was blocked. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frame"), IsRequired = (true))] + public CefSharp.DevTools.Audits.AffectedFrame Frame + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/InspectorIssue.cs b/CefSharp/DevTools/Audits/InspectorIssue.cs new file mode 100644 index 0000000000..0a302fad03 --- /dev/null +++ b/CefSharp/DevTools/Audits/InspectorIssue.cs @@ -0,0 +1,45 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// An inspector issue reported from the back-end. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class InspectorIssue : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Audits.InspectorIssueCode Code + { + get + { + return (CefSharp.DevTools.Audits.InspectorIssueCode)(StringToEnum(typeof(CefSharp.DevTools.Audits.InspectorIssueCode), code)); + } + + set + { + code = (EnumToString(value)); + } + } + + /// + /// Code + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("code"), IsRequired = (true))] + internal string code + { + get; + set; + } + + /// + /// Details + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("details"), IsRequired = (true))] + public CefSharp.DevTools.Audits.InspectorIssueDetails Details + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/InspectorIssueDetails.cs b/CefSharp/DevTools/Audits/InspectorIssueDetails.cs new file mode 100644 index 0000000000..5d3789ebf3 --- /dev/null +++ b/CefSharp/DevTools/Audits/InspectorIssueDetails.cs @@ -0,0 +1,54 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// This struct holds a list of optional fields with additional information + /// specific to the kind of issue. When adding a new issue code, please also + /// add a new optional field to this type. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class InspectorIssueDetails : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// SameSiteCookieIssueDetails + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sameSiteCookieIssueDetails"), IsRequired = (false))] + public CefSharp.DevTools.Audits.SameSiteCookieIssueDetails SameSiteCookieIssueDetails + { + get; + set; + } + + /// + /// MixedContentIssueDetails + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mixedContentIssueDetails"), IsRequired = (false))] + public CefSharp.DevTools.Audits.MixedContentIssueDetails MixedContentIssueDetails + { + get; + set; + } + + /// + /// BlockedByResponseIssueDetails + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("blockedByResponseIssueDetails"), IsRequired = (false))] + public CefSharp.DevTools.Audits.BlockedByResponseIssueDetails BlockedByResponseIssueDetails + { + get; + set; + } + + /// + /// HeavyAdIssueDetails + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("heavyAdIssueDetails"), IsRequired = (false))] + public CefSharp.DevTools.Audits.HeavyAdIssueDetails HeavyAdIssueDetails + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/MixedContentIssueDetails.cs b/CefSharp/DevTools/Audits/MixedContentIssueDetails.cs new file mode 100644 index 0000000000..91a56fd690 --- /dev/null +++ b/CefSharp/DevTools/Audits/MixedContentIssueDetails.cs @@ -0,0 +1,102 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// MixedContentIssueDetails + /// + [System.Runtime.Serialization.DataContractAttribute] + public class MixedContentIssueDetails : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Audits.MixedContentResourceType? ResourceType + { + get + { + return (CefSharp.DevTools.Audits.MixedContentResourceType? )(StringToEnum(typeof(CefSharp.DevTools.Audits.MixedContentResourceType? ), resourceType)); + } + + set + { + resourceType = (EnumToString(value)); + } + } + + /// + /// The type of resource causing the mixed content issue (css, js, iframe, + /// form,...). Marked as optional because it is mapped to from + /// blink::mojom::RequestContextType, which will be replaced + /// by network::mojom::RequestDestination + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("resourceType"), IsRequired = (false))] + internal string resourceType + { + get; + set; + } + + public CefSharp.DevTools.Audits.MixedContentResolutionStatus ResolutionStatus + { + get + { + return (CefSharp.DevTools.Audits.MixedContentResolutionStatus)(StringToEnum(typeof(CefSharp.DevTools.Audits.MixedContentResolutionStatus), resolutionStatus)); + } + + set + { + resolutionStatus = (EnumToString(value)); + } + } + + /// + /// The way the mixed content issue is being resolved. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("resolutionStatus"), IsRequired = (true))] + internal string resolutionStatus + { + get; + set; + } + + /// + /// The unsafe http url causing the mixed content issue. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("insecureURL"), IsRequired = (true))] + public string InsecureURL + { + get; + set; + } + + /// + /// The url responsible for the call to an unsafe url. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mainResourceURL"), IsRequired = (true))] + public string MainResourceURL + { + get; + set; + } + + /// + /// The mixed content request. + /// Does not always exist (e.g. for unsafe form submission urls). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("request"), IsRequired = (false))] + public CefSharp.DevTools.Audits.AffectedRequest Request + { + get; + set; + } + + /// + /// Optional because not every mixed content issue is necessarily linked to a frame. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frame"), IsRequired = (false))] + public CefSharp.DevTools.Audits.AffectedFrame Frame + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Audits/SameSiteCookieIssueDetails.cs b/CefSharp/DevTools/Audits/SameSiteCookieIssueDetails.cs new file mode 100644 index 0000000000..c2562f29f0 --- /dev/null +++ b/CefSharp/DevTools/Audits/SameSiteCookieIssueDetails.cs @@ -0,0 +1,124 @@ +// Copyright © 2020 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.DevTools.Audits +{ + /// + /// This information is currently necessary, as the front-end has a difficult + /// time finding a specific cookie. With this, we can convey specific error + /// information without the cookie. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SameSiteCookieIssueDetails : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Cookie + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cookie"), IsRequired = (true))] + public CefSharp.DevTools.Audits.AffectedCookie Cookie + { + get; + set; + } + + public CefSharp.DevTools.Audits.SameSiteCookieWarningReason[] CookieWarningReasons + { + get + { + return (CefSharp.DevTools.Audits.SameSiteCookieWarningReason[])(StringToEnum(typeof(CefSharp.DevTools.Audits.SameSiteCookieWarningReason[]), cookieWarningReasons)); + } + + set + { + cookieWarningReasons = (EnumToString(value)); + } + } + + /// + /// CookieWarningReasons + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cookieWarningReasons"), IsRequired = (true))] + internal string cookieWarningReasons + { + get; + set; + } + + public CefSharp.DevTools.Audits.SameSiteCookieExclusionReason[] CookieExclusionReasons + { + get + { + return (CefSharp.DevTools.Audits.SameSiteCookieExclusionReason[])(StringToEnum(typeof(CefSharp.DevTools.Audits.SameSiteCookieExclusionReason[]), cookieExclusionReasons)); + } + + set + { + cookieExclusionReasons = (EnumToString(value)); + } + } + + /// + /// CookieExclusionReasons + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cookieExclusionReasons"), IsRequired = (true))] + internal string cookieExclusionReasons + { + get; + set; + } + + public CefSharp.DevTools.Audits.SameSiteCookieOperation Operation + { + get + { + return (CefSharp.DevTools.Audits.SameSiteCookieOperation)(StringToEnum(typeof(CefSharp.DevTools.Audits.SameSiteCookieOperation), operation)); + } + + set + { + operation = (EnumToString(value)); + } + } + + /// + /// Optionally identifies the site-for-cookies and the cookie url, which + /// may be used by the front-end as additional context. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("operation"), IsRequired = (true))] + internal string operation + { + get; + set; + } + + /// + /// SiteForCookies + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("siteForCookies"), IsRequired = (false))] + public string SiteForCookies + { + get; + set; + } + + /// + /// CookieUrl + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cookieUrl"), IsRequired = (false))] + public string CookieUrl + { + get; + set; + } + + /// + /// Request + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("request"), IsRequired = (false))] + public CefSharp.DevTools.Audits.AffectedRequest Request + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/BackgroundService/BackgroundService.cs b/CefSharp/DevTools/BackgroundService/BackgroundService.cs new file mode 100644 index 0000000000..2cad0f7310 --- /dev/null +++ b/CefSharp/DevTools/BackgroundService/BackgroundService.cs @@ -0,0 +1,81 @@ +// Copyright © 2020 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.DevTools.BackgroundService +{ + using System.Linq; + + /// + /// Defines events for background web platform features. + /// + public partial class BackgroundService : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public BackgroundService(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateStartObserving(CefSharp.DevTools.BackgroundService.ServiceName service); + /// + /// Enables event updates for the service. + /// + /// service + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartObservingAsync(CefSharp.DevTools.BackgroundService.ServiceName service) + { + ValidateStartObserving(service); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("service", this.EnumToString(service)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("BackgroundService.startObserving", dict); + return methodResult; + } + + partial void ValidateStopObserving(CefSharp.DevTools.BackgroundService.ServiceName service); + /// + /// Disables event updates for the service. + /// + /// service + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopObservingAsync(CefSharp.DevTools.BackgroundService.ServiceName service) + { + ValidateStopObserving(service); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("service", this.EnumToString(service)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("BackgroundService.stopObserving", dict); + return methodResult; + } + + partial void ValidateSetRecording(bool shouldRecord, CefSharp.DevTools.BackgroundService.ServiceName service); + /// + /// Set the recording state for the service. + /// + /// shouldRecord + /// service + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetRecordingAsync(bool shouldRecord, CefSharp.DevTools.BackgroundService.ServiceName service) + { + ValidateSetRecording(shouldRecord, service); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("shouldRecord", shouldRecord); + dict.Add("service", this.EnumToString(service)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("BackgroundService.setRecording", dict); + return methodResult; + } + + partial void ValidateClearEvents(CefSharp.DevTools.BackgroundService.ServiceName service); + /// + /// Clears all stored data for the service. + /// + /// service + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearEventsAsync(CefSharp.DevTools.BackgroundService.ServiceName service) + { + ValidateClearEvents(service); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("service", this.EnumToString(service)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("BackgroundService.clearEvents", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/BackgroundService/BackgroundServiceEvent.cs b/CefSharp/DevTools/BackgroundService/BackgroundServiceEvent.cs new file mode 100644 index 0000000000..cf7528b220 --- /dev/null +++ b/CefSharp/DevTools/BackgroundService/BackgroundServiceEvent.cs @@ -0,0 +1,95 @@ +// Copyright © 2020 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.DevTools.BackgroundService +{ + /// + /// BackgroundServiceEvent + /// + [System.Runtime.Serialization.DataContractAttribute] + public class BackgroundServiceEvent : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Timestamp of the event (in seconds). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("timestamp"), IsRequired = (true))] + public long Timestamp + { + get; + set; + } + + /// + /// The origin this event belongs to. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("origin"), IsRequired = (true))] + public string Origin + { + get; + set; + } + + /// + /// The Service Worker ID that initiated the event. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("serviceWorkerRegistrationId"), IsRequired = (true))] + public string ServiceWorkerRegistrationId + { + get; + set; + } + + public CefSharp.DevTools.BackgroundService.ServiceName Service + { + get + { + return (CefSharp.DevTools.BackgroundService.ServiceName)(StringToEnum(typeof(CefSharp.DevTools.BackgroundService.ServiceName), service)); + } + + set + { + service = (EnumToString(value)); + } + } + + /// + /// The Background Service this event belongs to. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("service"), IsRequired = (true))] + internal string service + { + get; + set; + } + + /// + /// A description of the event. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("eventName"), IsRequired = (true))] + public string EventName + { + get; + set; + } + + /// + /// An identifier that groups related events together. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("instanceId"), IsRequired = (true))] + public string InstanceId + { + get; + set; + } + + /// + /// A list of event-specific information. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("eventMetadata"), IsRequired = (true))] + public System.Collections.Generic.IList EventMetadata + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/BackgroundService/Enums/ServiceName.cs b/CefSharp/DevTools/BackgroundService/Enums/ServiceName.cs new file mode 100644 index 0000000000..257fea2715 --- /dev/null +++ b/CefSharp/DevTools/BackgroundService/Enums/ServiceName.cs @@ -0,0 +1,44 @@ +// Copyright © 2020 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.DevTools.BackgroundService +{ + /// + /// The Background Service that will be associated with the commands/events. + /// Every Background Service operates independently, but they share the same + /// API. + /// + public enum ServiceName + { + /// + /// backgroundFetch + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("backgroundFetch"))] + BackgroundFetch, + /// + /// backgroundSync + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("backgroundSync"))] + BackgroundSync, + /// + /// pushMessaging + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("pushMessaging"))] + PushMessaging, + /// + /// notifications + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("notifications"))] + Notifications, + /// + /// paymentHandler + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("paymentHandler"))] + PaymentHandler, + /// + /// periodicBackgroundSync + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("periodicBackgroundSync"))] + PeriodicBackgroundSync + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/BackgroundService/EventMetadata.cs b/CefSharp/DevTools/BackgroundService/EventMetadata.cs new file mode 100644 index 0000000000..b50e5c489c --- /dev/null +++ b/CefSharp/DevTools/BackgroundService/EventMetadata.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.BackgroundService +{ + /// + /// A key-value pair for additional event information to pass along. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class EventMetadata : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Key + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("key"), IsRequired = (true))] + public string Key + { + get; + set; + } + + /// + /// Value + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/Bounds.cs b/CefSharp/DevTools/Browser/Bounds.cs new file mode 100644 index 0000000000..c94f53c10d --- /dev/null +++ b/CefSharp/DevTools/Browser/Bounds.cs @@ -0,0 +1,75 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// Browser window bounds information + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Bounds : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The offset from the left edge of the screen to the window in pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("left"), IsRequired = (false))] + public int? Left + { + get; + set; + } + + /// + /// The offset from the top edge of the screen to the window in pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("top"), IsRequired = (false))] + public int? Top + { + get; + set; + } + + /// + /// The window width in pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("width"), IsRequired = (false))] + public int? Width + { + get; + set; + } + + /// + /// The window height in pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("height"), IsRequired = (false))] + public int? Height + { + get; + set; + } + + public CefSharp.DevTools.Browser.WindowState? WindowState + { + get + { + return (CefSharp.DevTools.Browser.WindowState? )(StringToEnum(typeof(CefSharp.DevTools.Browser.WindowState? ), windowState)); + } + + set + { + windowState = (EnumToString(value)); + } + } + + /// + /// The window state. Default to normal. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("windowState"), IsRequired = (false))] + internal string windowState + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/Browser.cs b/CefSharp/DevTools/Browser/Browser.cs new file mode 100644 index 0000000000..17fa9842cc --- /dev/null +++ b/CefSharp/DevTools/Browser/Browser.cs @@ -0,0 +1,293 @@ +// Copyright © 2020 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.DevTools.Browser +{ + using System.Linq; + + /// + /// The Browser domain defines methods and events for browser managing. + /// + public partial class Browser : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Browser(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateSetPermission(CefSharp.DevTools.Browser.PermissionDescriptor permission, CefSharp.DevTools.Browser.PermissionSetting setting, string origin = null, string browserContextId = null); + /// + /// Set permission settings for given origin. + /// + /// Descriptor of permission to override. + /// Setting of the permission. + /// Origin the permission applies to, all origins if not specified. + /// Context to override. When omitted, default browser context is used. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetPermissionAsync(CefSharp.DevTools.Browser.PermissionDescriptor permission, CefSharp.DevTools.Browser.PermissionSetting setting, string origin = null, string browserContextId = null) + { + ValidateSetPermission(permission, setting, origin, browserContextId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("permission", permission.ToDictionary()); + dict.Add("setting", this.EnumToString(setting)); + if (!(string.IsNullOrEmpty(origin))) + { + dict.Add("origin", origin); + } + + if (!(string.IsNullOrEmpty(browserContextId))) + { + dict.Add("browserContextId", browserContextId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.setPermission", dict); + return methodResult; + } + + partial void ValidateGrantPermissions(CefSharp.DevTools.Browser.PermissionType[] permissions, string origin = null, string browserContextId = null); + /// + /// Grant specific permissions to the given origin and reject all others. + /// + /// permissions + /// Origin the permission applies to, all origins if not specified. + /// BrowserContext to override permissions. When omitted, default browser context is used. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task GrantPermissionsAsync(CefSharp.DevTools.Browser.PermissionType[] permissions, string origin = null, string browserContextId = null) + { + ValidateGrantPermissions(permissions, origin, browserContextId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("permissions", this.EnumToString(permissions)); + if (!(string.IsNullOrEmpty(origin))) + { + dict.Add("origin", origin); + } + + if (!(string.IsNullOrEmpty(browserContextId))) + { + dict.Add("browserContextId", browserContextId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.grantPermissions", dict); + return methodResult; + } + + partial void ValidateResetPermissions(string browserContextId = null); + /// + /// Reset all permission management for all origins. + /// + /// BrowserContext to reset permissions. When omitted, default browser context is used. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ResetPermissionsAsync(string browserContextId = null) + { + ValidateResetPermissions(browserContextId); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(browserContextId))) + { + dict.Add("browserContextId", browserContextId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.resetPermissions", dict); + return methodResult; + } + + partial void ValidateSetDownloadBehavior(string behavior, string browserContextId = null, string downloadPath = null); + /// + /// Set the behavior when downloading a file. + /// + /// Whether to allow all or deny all download requests, or use default Chrome behavior if + public async System.Threading.Tasks.Task SetDownloadBehaviorAsync(string behavior, string browserContextId = null, string downloadPath = null) + { + ValidateSetDownloadBehavior(behavior, browserContextId, downloadPath); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("behavior", behavior); + if (!(string.IsNullOrEmpty(browserContextId))) + { + dict.Add("browserContextId", browserContextId); + } + + if (!(string.IsNullOrEmpty(downloadPath))) + { + dict.Add("downloadPath", downloadPath); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.setDownloadBehavior", dict); + return methodResult; + } + + /// + /// Close browser gracefully. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task CloseAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.close", dict); + return methodResult; + } + + /// + /// Crashes browser on the main thread. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task CrashAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.crash", dict); + return methodResult; + } + + /// + /// Crashes GPU process. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task CrashGpuProcessAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.crashGpuProcess", dict); + return methodResult; + } + + /// + /// Returns version information. + /// + /// returns System.Threading.Tasks.Task<GetVersionResponse> + public async System.Threading.Tasks.Task GetVersionAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.getVersion", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns the command line switches for the browser process if, and only if + /// --enable-automation is on the commandline. + /// + /// returns System.Threading.Tasks.Task<GetBrowserCommandLineResponse> + public async System.Threading.Tasks.Task GetBrowserCommandLineAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.getBrowserCommandLine", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetHistograms(string query = null, bool? delta = null); + /// + /// Get Chrome histograms. + /// + /// Requested substring in name. Only histograms which have query as a + public async System.Threading.Tasks.Task GetHistogramsAsync(string query = null, bool? delta = null) + { + ValidateGetHistograms(query, delta); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(query))) + { + dict.Add("query", query); + } + + if (delta.HasValue) + { + dict.Add("delta", delta.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.getHistograms", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetHistogram(string name, bool? delta = null); + /// + /// Get a Chrome histogram by name. + /// + /// Requested histogram name. + /// If true, retrieve delta since last call. + /// returns System.Threading.Tasks.Task<GetHistogramResponse> + public async System.Threading.Tasks.Task GetHistogramAsync(string name, bool? delta = null) + { + ValidateGetHistogram(name, delta); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("name", name); + if (delta.HasValue) + { + dict.Add("delta", delta.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.getHistogram", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetWindowBounds(int windowId); + /// + /// Get position and size of the browser window. + /// + /// Browser window id. + /// returns System.Threading.Tasks.Task<GetWindowBoundsResponse> + public async System.Threading.Tasks.Task GetWindowBoundsAsync(int windowId) + { + ValidateGetWindowBounds(windowId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("windowId", windowId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.getWindowBounds", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetWindowForTarget(string targetId = null); + /// + /// Get the browser window that contains the devtools target. + /// + /// Devtools agent host id. If called as a part of the session, associated targetId is used. + /// returns System.Threading.Tasks.Task<GetWindowForTargetResponse> + public async System.Threading.Tasks.Task GetWindowForTargetAsync(string targetId = null) + { + ValidateGetWindowForTarget(targetId); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(targetId))) + { + dict.Add("targetId", targetId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.getWindowForTarget", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetWindowBounds(int windowId, CefSharp.DevTools.Browser.Bounds bounds); + /// + /// Set position and/or size of the browser window. + /// + /// Browser window id. + /// New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined + public async System.Threading.Tasks.Task SetWindowBoundsAsync(int windowId, CefSharp.DevTools.Browser.Bounds bounds) + { + ValidateSetWindowBounds(windowId, bounds); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("windowId", windowId); + dict.Add("bounds", bounds.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.setWindowBounds", dict); + return methodResult; + } + + partial void ValidateSetDockTile(string badgeLabel = null, byte[] image = null); + /// + /// Set dock tile details, platform-specific. + /// + /// badgeLabel + /// Png encoded image. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetDockTileAsync(string badgeLabel = null, byte[] image = null) + { + ValidateSetDockTile(badgeLabel, image); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(badgeLabel))) + { + dict.Add("badgeLabel", badgeLabel); + } + + if ((image) != (null)) + { + dict.Add("image", ToBase64String(image)); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.setDockTile", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/Bucket.cs b/CefSharp/DevTools/Browser/Bucket.cs new file mode 100644 index 0000000000..b8852325bf --- /dev/null +++ b/CefSharp/DevTools/Browser/Bucket.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// Chrome histogram bucket. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Bucket : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Minimum value (inclusive). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("low"), IsRequired = (true))] + public int Low + { + get; + set; + } + + /// + /// Maximum value (exclusive). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("high"), IsRequired = (true))] + public int High + { + get; + set; + } + + /// + /// Number of samples. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("count"), IsRequired = (true))] + public int Count + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/Enums/PermissionSetting.cs b/CefSharp/DevTools/Browser/Enums/PermissionSetting.cs new file mode 100644 index 0000000000..6c03d262d3 --- /dev/null +++ b/CefSharp/DevTools/Browser/Enums/PermissionSetting.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// PermissionSetting + /// + public enum PermissionSetting + { + /// + /// granted + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("granted"))] + Granted, + /// + /// denied + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("denied"))] + Denied, + /// + /// prompt + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("prompt"))] + Prompt + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/Enums/PermissionType.cs b/CefSharp/DevTools/Browser/Enums/PermissionType.cs new file mode 100644 index 0000000000..17e408e00b --- /dev/null +++ b/CefSharp/DevTools/Browser/Enums/PermissionType.cs @@ -0,0 +1,117 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// PermissionType + /// + public enum PermissionType + { + /// + /// accessibilityEvents + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("accessibilityEvents"))] + AccessibilityEvents, + /// + /// audioCapture + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("audioCapture"))] + AudioCapture, + /// + /// backgroundSync + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("backgroundSync"))] + BackgroundSync, + /// + /// backgroundFetch + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("backgroundFetch"))] + BackgroundFetch, + /// + /// clipboardReadWrite + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("clipboardReadWrite"))] + ClipboardReadWrite, + /// + /// clipboardSanitizedWrite + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("clipboardSanitizedWrite"))] + ClipboardSanitizedWrite, + /// + /// durableStorage + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("durableStorage"))] + DurableStorage, + /// + /// flash + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("flash"))] + Flash, + /// + /// geolocation + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("geolocation"))] + Geolocation, + /// + /// midi + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("midi"))] + Midi, + /// + /// midiSysex + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("midiSysex"))] + MidiSysex, + /// + /// nfc + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("nfc"))] + Nfc, + /// + /// notifications + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("notifications"))] + Notifications, + /// + /// paymentHandler + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("paymentHandler"))] + PaymentHandler, + /// + /// periodicBackgroundSync + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("periodicBackgroundSync"))] + PeriodicBackgroundSync, + /// + /// protectedMediaIdentifier + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("protectedMediaIdentifier"))] + ProtectedMediaIdentifier, + /// + /// sensors + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("sensors"))] + Sensors, + /// + /// videoCapture + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("videoCapture"))] + VideoCapture, + /// + /// idleDetection + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("idleDetection"))] + IdleDetection, + /// + /// wakeLockScreen + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("wakeLockScreen"))] + WakeLockScreen, + /// + /// wakeLockSystem + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("wakeLockSystem"))] + WakeLockSystem + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/Enums/WindowState.cs b/CefSharp/DevTools/Browser/Enums/WindowState.cs new file mode 100644 index 0000000000..a35033a0be --- /dev/null +++ b/CefSharp/DevTools/Browser/Enums/WindowState.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// The state of the browser window. + /// + public enum WindowState + { + /// + /// normal + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("normal"))] + Normal, + /// + /// minimized + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("minimized"))] + Minimized, + /// + /// maximized + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("maximized"))] + Maximized, + /// + /// fullscreen + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("fullscreen"))] + Fullscreen + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/GetBrowserCommandLineResponse.cs b/CefSharp/DevTools/Browser/GetBrowserCommandLineResponse.cs new file mode 100644 index 0000000000..f4692b9a81 --- /dev/null +++ b/CefSharp/DevTools/Browser/GetBrowserCommandLineResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// GetBrowserCommandLineResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetBrowserCommandLineResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] arguments + { + get; + set; + } + + /// + /// arguments + /// + public string[] Arguments + { + get + { + return arguments; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/GetHistogramResponse.cs b/CefSharp/DevTools/Browser/GetHistogramResponse.cs new file mode 100644 index 0000000000..e42cc9cbfc --- /dev/null +++ b/CefSharp/DevTools/Browser/GetHistogramResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// GetHistogramResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetHistogramResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Browser.Histogram histogram + { + get; + set; + } + + /// + /// histogram + /// + public CefSharp.DevTools.Browser.Histogram Histogram + { + get + { + return histogram; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/GetHistogramsResponse.cs b/CefSharp/DevTools/Browser/GetHistogramsResponse.cs new file mode 100644 index 0000000000..03f3701c33 --- /dev/null +++ b/CefSharp/DevTools/Browser/GetHistogramsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// GetHistogramsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetHistogramsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList histograms + { + get; + set; + } + + /// + /// histograms + /// + public System.Collections.Generic.IList Histograms + { + get + { + return histograms; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/GetVersionResponse.cs b/CefSharp/DevTools/Browser/GetVersionResponse.cs new file mode 100644 index 0000000000..e6314d5f26 --- /dev/null +++ b/CefSharp/DevTools/Browser/GetVersionResponse.cs @@ -0,0 +1,102 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// GetVersionResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetVersionResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string protocolVersion + { + get; + set; + } + + /// + /// protocolVersion + /// + public string ProtocolVersion + { + get + { + return protocolVersion; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string product + { + get; + set; + } + + /// + /// product + /// + public string Product + { + get + { + return product; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string revision + { + get; + set; + } + + /// + /// revision + /// + public string Revision + { + get + { + return revision; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string userAgent + { + get; + set; + } + + /// + /// userAgent + /// + public string UserAgent + { + get + { + return userAgent; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string jsVersion + { + get; + set; + } + + /// + /// jsVersion + /// + public string JsVersion + { + get + { + return jsVersion; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/GetWindowBoundsResponse.cs b/CefSharp/DevTools/Browser/GetWindowBoundsResponse.cs new file mode 100644 index 0000000000..7e104306c9 --- /dev/null +++ b/CefSharp/DevTools/Browser/GetWindowBoundsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// GetWindowBoundsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetWindowBoundsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Browser.Bounds bounds + { + get; + set; + } + + /// + /// bounds + /// + public CefSharp.DevTools.Browser.Bounds Bounds + { + get + { + return bounds; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/GetWindowForTargetResponse.cs b/CefSharp/DevTools/Browser/GetWindowForTargetResponse.cs new file mode 100644 index 0000000000..70ba98de7b --- /dev/null +++ b/CefSharp/DevTools/Browser/GetWindowForTargetResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// GetWindowForTargetResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetWindowForTargetResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int windowId + { + get; + set; + } + + /// + /// windowId + /// + public int WindowId + { + get + { + return windowId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Browser.Bounds bounds + { + get; + set; + } + + /// + /// bounds + /// + public CefSharp.DevTools.Browser.Bounds Bounds + { + get + { + return bounds; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/Histogram.cs b/CefSharp/DevTools/Browser/Histogram.cs new file mode 100644 index 0000000000..497272420f --- /dev/null +++ b/CefSharp/DevTools/Browser/Histogram.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// Chrome histogram. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Histogram : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Sum of sample values. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sum"), IsRequired = (true))] + public int Sum + { + get; + set; + } + + /// + /// Total number of samples. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("count"), IsRequired = (true))] + public int Count + { + get; + set; + } + + /// + /// Buckets. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("buckets"), IsRequired = (true))] + public System.Collections.Generic.IList Buckets + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Browser/PermissionDescriptor.cs b/CefSharp/DevTools/Browser/PermissionDescriptor.cs new file mode 100644 index 0000000000..6c85c8a1fb --- /dev/null +++ b/CefSharp/DevTools/Browser/PermissionDescriptor.cs @@ -0,0 +1,65 @@ +// Copyright © 2020 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.DevTools.Browser +{ + /// + /// Definition of PermissionDescriptor defined in the Permissions API: + /// https://w3c.github.io/permissions/#dictdef-permissiondescriptor. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PermissionDescriptor : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name of permission. + /// See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// For "midi" permission, may also specify sysex control. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sysex"), IsRequired = (false))] + public bool? Sysex + { + get; + set; + } + + /// + /// For "push" permission, may specify userVisibleOnly. + /// Note that userVisibleOnly = true is the only currently supported type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("userVisibleOnly"), IsRequired = (false))] + public bool? UserVisibleOnly + { + get; + set; + } + + /// + /// For "wake-lock" permission, must specify type as either "screen" or "system". + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (false))] + public string Type + { + get; + set; + } + + /// + /// For "clipboard" permission, may specify allowWithoutSanitization. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("allowWithoutSanitization"), IsRequired = (false))] + public bool? AllowWithoutSanitization + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/AddRuleResponse.cs b/CefSharp/DevTools/CSS/AddRuleResponse.cs new file mode 100644 index 0000000000..10fab456bb --- /dev/null +++ b/CefSharp/DevTools/CSS/AddRuleResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// AddRuleResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AddRuleResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.CSS.CSSRule rule + { + get; + set; + } + + /// + /// rule + /// + public CefSharp.DevTools.CSS.CSSRule Rule + { + get + { + return rule; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CSS.cs b/CefSharp/DevTools/CSS/CSS.cs new file mode 100644 index 0000000000..a3baa63cc1 --- /dev/null +++ b/CefSharp/DevTools/CSS/CSS.cs @@ -0,0 +1,362 @@ +// Copyright © 2020 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.DevTools.CSS +{ + using System.Linq; + + /// + /// This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) + /// have an associated `id` used in subsequent operations on the related object. Each object type has + /// a specific `id` structure, and those are not interchangeable between objects of different kinds. + /// CSS objects can be loaded using the `get*ForNode()` calls (which accept a DOM node id). A client + /// can also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and + /// subsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods. + /// + public partial class CSS : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public CSS(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateAddRule(string styleSheetId, string ruleText, CefSharp.DevTools.CSS.SourceRange location); + /// + /// Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the + /// position specified by `location`. + /// + /// The css style sheet identifier where a new rule should be inserted. + /// The text of a new rule. + /// Text position of a new rule in the target style sheet. + /// returns System.Threading.Tasks.Task<AddRuleResponse> + public async System.Threading.Tasks.Task AddRuleAsync(string styleSheetId, string ruleText, CefSharp.DevTools.CSS.SourceRange location) + { + ValidateAddRule(styleSheetId, ruleText, location); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("styleSheetId", styleSheetId); + dict.Add("ruleText", ruleText); + dict.Add("location", location.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.addRule", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateCollectClassNames(string styleSheetId); + /// + /// Returns all class names from specified stylesheet. + /// + /// styleSheetId + /// returns System.Threading.Tasks.Task<CollectClassNamesResponse> + public async System.Threading.Tasks.Task CollectClassNamesAsync(string styleSheetId) + { + ValidateCollectClassNames(styleSheetId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("styleSheetId", styleSheetId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.collectClassNames", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateCreateStyleSheet(string frameId); + /// + /// Creates a new special "via-inspector" stylesheet in the frame with given `frameId`. + /// + /// Identifier of the frame where "via-inspector" stylesheet should be created. + /// returns System.Threading.Tasks.Task<CreateStyleSheetResponse> + public async System.Threading.Tasks.Task CreateStyleSheetAsync(string frameId) + { + ValidateCreateStyleSheet(frameId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("frameId", frameId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.createStyleSheet", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Disables the CSS agent for the given page. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.disable", dict); + return methodResult; + } + + /// + /// Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been + /// enabled until the result of this command is received. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.enable", dict); + return methodResult; + } + + partial void ValidateForcePseudoState(int nodeId, string[] forcedPseudoClasses); + /// + /// Ensures that the given node will have specified pseudo-classes whenever its style is computed by + /// the browser. + /// + /// The element id for which to force the pseudo state. + /// Element pseudo classes to force when computing the element's style. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ForcePseudoStateAsync(int nodeId, string[] forcedPseudoClasses) + { + ValidateForcePseudoState(nodeId, forcedPseudoClasses); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("forcedPseudoClasses", forcedPseudoClasses); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.forcePseudoState", dict); + return methodResult; + } + + partial void ValidateGetBackgroundColors(int nodeId); + /// + /// GetBackgroundColors + /// + /// Id of the node to get background colors for. + /// returns System.Threading.Tasks.Task<GetBackgroundColorsResponse> + public async System.Threading.Tasks.Task GetBackgroundColorsAsync(int nodeId) + { + ValidateGetBackgroundColors(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.getBackgroundColors", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetComputedStyleForNode(int nodeId); + /// + /// Returns the computed style for a DOM node identified by `nodeId`. + /// + /// nodeId + /// returns System.Threading.Tasks.Task<GetComputedStyleForNodeResponse> + public async System.Threading.Tasks.Task GetComputedStyleForNodeAsync(int nodeId) + { + ValidateGetComputedStyleForNode(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.getComputedStyleForNode", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetInlineStylesForNode(int nodeId); + /// + /// Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM + /// attributes) for a DOM node identified by `nodeId`. + /// + /// nodeId + /// returns System.Threading.Tasks.Task<GetInlineStylesForNodeResponse> + public async System.Threading.Tasks.Task GetInlineStylesForNodeAsync(int nodeId) + { + ValidateGetInlineStylesForNode(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.getInlineStylesForNode", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetMatchedStylesForNode(int nodeId); + /// + /// Returns requested styles for a DOM node identified by `nodeId`. + /// + /// nodeId + /// returns System.Threading.Tasks.Task<GetMatchedStylesForNodeResponse> + public async System.Threading.Tasks.Task GetMatchedStylesForNodeAsync(int nodeId) + { + ValidateGetMatchedStylesForNode(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.getMatchedStylesForNode", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns all media queries parsed by the rendering engine. + /// + /// returns System.Threading.Tasks.Task<GetMediaQueriesResponse> + public async System.Threading.Tasks.Task GetMediaQueriesAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.getMediaQueries", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetPlatformFontsForNode(int nodeId); + /// + /// Requests information about platform fonts which we used to render child TextNodes in the given + /// node. + /// + /// nodeId + /// returns System.Threading.Tasks.Task<GetPlatformFontsForNodeResponse> + public async System.Threading.Tasks.Task GetPlatformFontsForNodeAsync(int nodeId) + { + ValidateGetPlatformFontsForNode(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.getPlatformFontsForNode", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetStyleSheetText(string styleSheetId); + /// + /// Returns the current textual content for a stylesheet. + /// + /// styleSheetId + /// returns System.Threading.Tasks.Task<GetStyleSheetTextResponse> + public async System.Threading.Tasks.Task GetStyleSheetTextAsync(string styleSheetId) + { + ValidateGetStyleSheetText(styleSheetId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("styleSheetId", styleSheetId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.getStyleSheetText", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetEffectivePropertyValueForNode(int nodeId, string propertyName, string value); + /// + /// Find a rule with the given active property for the given node and set the new value for this + /// property + /// + /// The element id for which to set property. + /// propertyName + /// value + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetEffectivePropertyValueForNodeAsync(int nodeId, string propertyName, string value) + { + ValidateSetEffectivePropertyValueForNode(nodeId, propertyName, value); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("propertyName", propertyName); + dict.Add("value", value); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.setEffectivePropertyValueForNode", dict); + return methodResult; + } + + partial void ValidateSetKeyframeKey(string styleSheetId, CefSharp.DevTools.CSS.SourceRange range, string keyText); + /// + /// Modifies the keyframe rule key text. + /// + /// styleSheetId + /// range + /// keyText + /// returns System.Threading.Tasks.Task<SetKeyframeKeyResponse> + public async System.Threading.Tasks.Task SetKeyframeKeyAsync(string styleSheetId, CefSharp.DevTools.CSS.SourceRange range, string keyText) + { + ValidateSetKeyframeKey(styleSheetId, range, keyText); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("styleSheetId", styleSheetId); + dict.Add("range", range.ToDictionary()); + dict.Add("keyText", keyText); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.setKeyframeKey", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetMediaText(string styleSheetId, CefSharp.DevTools.CSS.SourceRange range, string text); + /// + /// Modifies the rule selector. + /// + /// styleSheetId + /// range + /// text + /// returns System.Threading.Tasks.Task<SetMediaTextResponse> + public async System.Threading.Tasks.Task SetMediaTextAsync(string styleSheetId, CefSharp.DevTools.CSS.SourceRange range, string text) + { + ValidateSetMediaText(styleSheetId, range, text); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("styleSheetId", styleSheetId); + dict.Add("range", range.ToDictionary()); + dict.Add("text", text); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.setMediaText", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetRuleSelector(string styleSheetId, CefSharp.DevTools.CSS.SourceRange range, string selector); + /// + /// Modifies the rule selector. + /// + /// styleSheetId + /// range + /// selector + /// returns System.Threading.Tasks.Task<SetRuleSelectorResponse> + public async System.Threading.Tasks.Task SetRuleSelectorAsync(string styleSheetId, CefSharp.DevTools.CSS.SourceRange range, string selector) + { + ValidateSetRuleSelector(styleSheetId, range, selector); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("styleSheetId", styleSheetId); + dict.Add("range", range.ToDictionary()); + dict.Add("selector", selector); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.setRuleSelector", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetStyleSheetText(string styleSheetId, string text); + /// + /// Sets the new stylesheet text. + /// + /// styleSheetId + /// text + /// returns System.Threading.Tasks.Task<SetStyleSheetTextResponse> + public async System.Threading.Tasks.Task SetStyleSheetTextAsync(string styleSheetId, string text) + { + ValidateSetStyleSheetText(styleSheetId, text); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("styleSheetId", styleSheetId); + dict.Add("text", text); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.setStyleSheetText", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetStyleTexts(System.Collections.Generic.IList edits); + /// + /// Applies specified style edits one after another in the given order. + /// + /// edits + /// returns System.Threading.Tasks.Task<SetStyleTextsResponse> + public async System.Threading.Tasks.Task SetStyleTextsAsync(System.Collections.Generic.IList edits) + { + ValidateSetStyleTexts(edits); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("edits", edits.Select(x => x.ToDictionary())); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.setStyleTexts", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Enables the selector recording. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartRuleUsageTrackingAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.startRuleUsageTracking", dict); + return methodResult; + } + + /// + /// Stop tracking rule usage and return the list of rules that were used since last call to + /// `takeCoverageDelta` (or since start of coverage instrumentation) + /// + /// returns System.Threading.Tasks.Task<StopRuleUsageTrackingResponse> + public async System.Threading.Tasks.Task StopRuleUsageTrackingAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.stopRuleUsageTracking", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Obtain list of rules that became used since last call to this method (or since start of coverage + /// instrumentation) + /// + /// returns System.Threading.Tasks.Task<TakeCoverageDeltaResponse> + public async System.Threading.Tasks.Task TakeCoverageDeltaAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("CSS.takeCoverageDelta", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CSSComputedStyleProperty.cs b/CefSharp/DevTools/CSS/CSSComputedStyleProperty.cs new file mode 100644 index 0000000000..9c34231107 --- /dev/null +++ b/CefSharp/DevTools/CSS/CSSComputedStyleProperty.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSSComputedStyleProperty + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CSSComputedStyleProperty : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Computed style property name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Computed style property value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CSSKeyframeRule.cs b/CefSharp/DevTools/CSS/CSSKeyframeRule.cs new file mode 100644 index 0000000000..b28560a425 --- /dev/null +++ b/CefSharp/DevTools/CSS/CSSKeyframeRule.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSS keyframe rule representation. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CSSKeyframeRule : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The css style sheet identifier (absent for user agent stylesheet and user-specified + /// stylesheet rules) this rule came from. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("styleSheetId"), IsRequired = (false))] + public string StyleSheetId + { + get; + set; + } + + public CefSharp.DevTools.CSS.StyleSheetOrigin Origin + { + get + { + return (CefSharp.DevTools.CSS.StyleSheetOrigin)(StringToEnum(typeof(CefSharp.DevTools.CSS.StyleSheetOrigin), origin)); + } + + set + { + origin = (EnumToString(value)); + } + } + + /// + /// Parent stylesheet's origin. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("origin"), IsRequired = (true))] + internal string origin + { + get; + set; + } + + /// + /// Associated key text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyText"), IsRequired = (true))] + public CefSharp.DevTools.CSS.Value KeyText + { + get; + set; + } + + /// + /// Associated style declaration. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("style"), IsRequired = (true))] + public CefSharp.DevTools.CSS.CSSStyle Style + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CSSKeyframesRule.cs b/CefSharp/DevTools/CSS/CSSKeyframesRule.cs new file mode 100644 index 0000000000..358c65cf69 --- /dev/null +++ b/CefSharp/DevTools/CSS/CSSKeyframesRule.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSS keyframes rule representation. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CSSKeyframesRule : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Animation name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("animationName"), IsRequired = (true))] + public CefSharp.DevTools.CSS.Value AnimationName + { + get; + set; + } + + /// + /// List of keyframes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyframes"), IsRequired = (true))] + public System.Collections.Generic.IList Keyframes + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CSSMedia.cs b/CefSharp/DevTools/CSS/CSSMedia.cs new file mode 100644 index 0000000000..a4acc14fe3 --- /dev/null +++ b/CefSharp/DevTools/CSS/CSSMedia.cs @@ -0,0 +1,76 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSS media rule descriptor. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CSSMedia : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Media query text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("text"), IsRequired = (true))] + public string Text + { + get; + set; + } + + /// + /// Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if + /// specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked + /// stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline + /// stylesheet's STYLE tag. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("source"), IsRequired = (true))] + public string Source + { + get; + set; + } + + /// + /// URL of the document containing the media query description. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sourceURL"), IsRequired = (false))] + public string SourceURL + { + get; + set; + } + + /// + /// The associated rule (@media or @import) header range in the enclosing stylesheet (if + /// available). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("range"), IsRequired = (false))] + public CefSharp.DevTools.CSS.SourceRange Range + { + get; + set; + } + + /// + /// Identifier of the stylesheet containing this object (if exists). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("styleSheetId"), IsRequired = (false))] + public string StyleSheetId + { + get; + set; + } + + /// + /// Array of media queries. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mediaList"), IsRequired = (false))] + public System.Collections.Generic.IList MediaList + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CSSProperty.cs b/CefSharp/DevTools/CSS/CSSProperty.cs new file mode 100644 index 0000000000..ac647e3008 --- /dev/null +++ b/CefSharp/DevTools/CSS/CSSProperty.cs @@ -0,0 +1,92 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSS property declaration data. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CSSProperty : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The property name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// The property value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + + /// + /// Whether the property has "!important" annotation (implies `false` if absent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("important"), IsRequired = (false))] + public bool? Important + { + get; + set; + } + + /// + /// Whether the property is implicit (implies `false` if absent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("implicit"), IsRequired = (false))] + public bool? Implicit + { + get; + set; + } + + /// + /// The full property text as specified in the style. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("text"), IsRequired = (false))] + public string Text + { + get; + set; + } + + /// + /// Whether the property is understood by the browser (implies `true` if absent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("parsedOk"), IsRequired = (false))] + public bool? ParsedOk + { + get; + set; + } + + /// + /// Whether the property is disabled by the user (present for source-based properties only). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("disabled"), IsRequired = (false))] + public bool? Disabled + { + get; + set; + } + + /// + /// The entire property range in the enclosing style declaration (if available). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("range"), IsRequired = (false))] + public CefSharp.DevTools.CSS.SourceRange Range + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CSSRule.cs b/CefSharp/DevTools/CSS/CSSRule.cs new file mode 100644 index 0000000000..6a28b05727 --- /dev/null +++ b/CefSharp/DevTools/CSS/CSSRule.cs @@ -0,0 +1,77 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSS rule representation. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CSSRule : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The css style sheet identifier (absent for user agent stylesheet and user-specified + /// stylesheet rules) this rule came from. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("styleSheetId"), IsRequired = (false))] + public string StyleSheetId + { + get; + set; + } + + /// + /// Rule selector data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("selectorList"), IsRequired = (true))] + public CefSharp.DevTools.CSS.SelectorList SelectorList + { + get; + set; + } + + public CefSharp.DevTools.CSS.StyleSheetOrigin Origin + { + get + { + return (CefSharp.DevTools.CSS.StyleSheetOrigin)(StringToEnum(typeof(CefSharp.DevTools.CSS.StyleSheetOrigin), origin)); + } + + set + { + origin = (EnumToString(value)); + } + } + + /// + /// Parent stylesheet's origin. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("origin"), IsRequired = (true))] + internal string origin + { + get; + set; + } + + /// + /// Associated style declaration. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("style"), IsRequired = (true))] + public CefSharp.DevTools.CSS.CSSStyle Style + { + get; + set; + } + + /// + /// Media list array (for rules involving media queries). The array enumerates media queries + /// starting with the innermost one, going outwards. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("media"), IsRequired = (false))] + public System.Collections.Generic.IList Media + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CSSStyle.cs b/CefSharp/DevTools/CSS/CSSStyle.cs new file mode 100644 index 0000000000..78e0aa1952 --- /dev/null +++ b/CefSharp/DevTools/CSS/CSSStyle.cs @@ -0,0 +1,63 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSS style representation. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CSSStyle : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The css style sheet identifier (absent for user agent stylesheet and user-specified + /// stylesheet rules) this rule came from. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("styleSheetId"), IsRequired = (false))] + public string StyleSheetId + { + get; + set; + } + + /// + /// CSS properties in the style. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cssProperties"), IsRequired = (true))] + public System.Collections.Generic.IList CssProperties + { + get; + set; + } + + /// + /// Computed values for all shorthands found in the style. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("shorthandEntries"), IsRequired = (true))] + public System.Collections.Generic.IList ShorthandEntries + { + get; + set; + } + + /// + /// Style declaration text (if available). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cssText"), IsRequired = (false))] + public string CssText + { + get; + set; + } + + /// + /// Style declaration range in the enclosing stylesheet (if available). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("range"), IsRequired = (false))] + public CefSharp.DevTools.CSS.SourceRange Range + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CSSStyleSheetHeader.cs b/CefSharp/DevTools/CSS/CSSStyleSheetHeader.cs new file mode 100644 index 0000000000..f1c33b2adb --- /dev/null +++ b/CefSharp/DevTools/CSS/CSSStyleSheetHeader.cs @@ -0,0 +1,189 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSS stylesheet metainformation. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CSSStyleSheetHeader : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The stylesheet identifier. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("styleSheetId"), IsRequired = (true))] + public string StyleSheetId + { + get; + set; + } + + /// + /// Owner frame identifier. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frameId"), IsRequired = (true))] + public string FrameId + { + get; + set; + } + + /// + /// Stylesheet resource URL. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sourceURL"), IsRequired = (true))] + public string SourceURL + { + get; + set; + } + + /// + /// URL of source map associated with the stylesheet (if any). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sourceMapURL"), IsRequired = (false))] + public string SourceMapURL + { + get; + set; + } + + public CefSharp.DevTools.CSS.StyleSheetOrigin Origin + { + get + { + return (CefSharp.DevTools.CSS.StyleSheetOrigin)(StringToEnum(typeof(CefSharp.DevTools.CSS.StyleSheetOrigin), origin)); + } + + set + { + origin = (EnumToString(value)); + } + } + + /// + /// Stylesheet origin. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("origin"), IsRequired = (true))] + internal string origin + { + get; + set; + } + + /// + /// Stylesheet title. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("title"), IsRequired = (true))] + public string Title + { + get; + set; + } + + /// + /// The backend id for the owner node of the stylesheet. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("ownerNode"), IsRequired = (false))] + public int? OwnerNode + { + get; + set; + } + + /// + /// Denotes whether the stylesheet is disabled. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("disabled"), IsRequired = (true))] + public bool Disabled + { + get; + set; + } + + /// + /// Whether the sourceURL field value comes from the sourceURL comment. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("hasSourceURL"), IsRequired = (false))] + public bool? HasSourceURL + { + get; + set; + } + + /// + /// Whether this stylesheet is created for STYLE tag by parser. This flag is not set for + /// document.written STYLE tags. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isInline"), IsRequired = (true))] + public bool IsInline + { + get; + set; + } + + /// + /// Whether this stylesheet is mutable. Inline stylesheets become mutable + /// after they have been modified via CSSOM API. + /// element's stylesheets are never mutable. Constructed stylesheets + /// (new CSSStyleSheet()) are mutable immediately after creation. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isMutable"), IsRequired = (true))] + public bool IsMutable + { + get; + set; + } + + /// + /// Line offset of the stylesheet within the resource (zero based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("startLine"), IsRequired = (true))] + public long StartLine + { + get; + set; + } + + /// + /// Column offset of the stylesheet within the resource (zero based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("startColumn"), IsRequired = (true))] + public long StartColumn + { + get; + set; + } + + /// + /// Size of the content (in characters). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("length"), IsRequired = (true))] + public long Length + { + get; + set; + } + + /// + /// Line offset of the end of the stylesheet within the resource (zero based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("endLine"), IsRequired = (true))] + public long EndLine + { + get; + set; + } + + /// + /// Column offset of the end of the stylesheet within the resource (zero based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("endColumn"), IsRequired = (true))] + public long EndColumn + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CollectClassNamesResponse.cs b/CefSharp/DevTools/CSS/CollectClassNamesResponse.cs new file mode 100644 index 0000000000..64089c6926 --- /dev/null +++ b/CefSharp/DevTools/CSS/CollectClassNamesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CollectClassNamesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CollectClassNamesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] classNames + { + get; + set; + } + + /// + /// classNames + /// + public string[] ClassNames + { + get + { + return classNames; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/CreateStyleSheetResponse.cs b/CefSharp/DevTools/CSS/CreateStyleSheetResponse.cs new file mode 100644 index 0000000000..8b592804ea --- /dev/null +++ b/CefSharp/DevTools/CSS/CreateStyleSheetResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CreateStyleSheetResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CreateStyleSheetResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string styleSheetId + { + get; + set; + } + + /// + /// styleSheetId + /// + public string StyleSheetId + { + get + { + return styleSheetId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/Enums/StyleSheetOrigin.cs b/CefSharp/DevTools/CSS/Enums/StyleSheetOrigin.cs new file mode 100644 index 0000000000..6af4735b79 --- /dev/null +++ b/CefSharp/DevTools/CSS/Enums/StyleSheetOrigin.cs @@ -0,0 +1,34 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent + /// stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via + /// inspector" rules), "regular" for regular stylesheets. + /// + public enum StyleSheetOrigin + { + /// + /// injected + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("injected"))] + Injected, + /// + /// user-agent + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("user-agent"))] + UserAgent, + /// + /// inspector + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("inspector"))] + Inspector, + /// + /// regular + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("regular"))] + Regular + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/FontFace.cs b/CefSharp/DevTools/CSS/FontFace.cs new file mode 100644 index 0000000000..533e6d7788 --- /dev/null +++ b/CefSharp/DevTools/CSS/FontFace.cs @@ -0,0 +1,92 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions + /// + [System.Runtime.Serialization.DataContractAttribute] + public class FontFace : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The font-family. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fontFamily"), IsRequired = (true))] + public string FontFamily + { + get; + set; + } + + /// + /// The font-style. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fontStyle"), IsRequired = (true))] + public string FontStyle + { + get; + set; + } + + /// + /// The font-variant. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fontVariant"), IsRequired = (true))] + public string FontVariant + { + get; + set; + } + + /// + /// The font-weight. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fontWeight"), IsRequired = (true))] + public string FontWeight + { + get; + set; + } + + /// + /// The font-stretch. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fontStretch"), IsRequired = (true))] + public string FontStretch + { + get; + set; + } + + /// + /// The unicode-range. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("unicodeRange"), IsRequired = (true))] + public string UnicodeRange + { + get; + set; + } + + /// + /// The src. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("src"), IsRequired = (true))] + public string Src + { + get; + set; + } + + /// + /// The resolved platform font family + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("platformFontFamily"), IsRequired = (true))] + public string PlatformFontFamily + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/GetBackgroundColorsResponse.cs b/CefSharp/DevTools/CSS/GetBackgroundColorsResponse.cs new file mode 100644 index 0000000000..52c47a3015 --- /dev/null +++ b/CefSharp/DevTools/CSS/GetBackgroundColorsResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// GetBackgroundColorsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetBackgroundColorsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] backgroundColors + { + get; + set; + } + + /// + /// backgroundColors + /// + public string[] BackgroundColors + { + get + { + return backgroundColors; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string computedFontSize + { + get; + set; + } + + /// + /// computedFontSize + /// + public string ComputedFontSize + { + get + { + return computedFontSize; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string computedFontWeight + { + get; + set; + } + + /// + /// computedFontWeight + /// + public string ComputedFontWeight + { + get + { + return computedFontWeight; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/GetComputedStyleForNodeResponse.cs b/CefSharp/DevTools/CSS/GetComputedStyleForNodeResponse.cs new file mode 100644 index 0000000000..b779f83d3e --- /dev/null +++ b/CefSharp/DevTools/CSS/GetComputedStyleForNodeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// GetComputedStyleForNodeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetComputedStyleForNodeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList computedStyle + { + get; + set; + } + + /// + /// computedStyle + /// + public System.Collections.Generic.IList ComputedStyle + { + get + { + return computedStyle; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/GetInlineStylesForNodeResponse.cs b/CefSharp/DevTools/CSS/GetInlineStylesForNodeResponse.cs new file mode 100644 index 0000000000..8b7fa07ba4 --- /dev/null +++ b/CefSharp/DevTools/CSS/GetInlineStylesForNodeResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// GetInlineStylesForNodeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetInlineStylesForNodeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.CSS.CSSStyle inlineStyle + { + get; + set; + } + + /// + /// inlineStyle + /// + public CefSharp.DevTools.CSS.CSSStyle InlineStyle + { + get + { + return inlineStyle; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.CSS.CSSStyle attributesStyle + { + get; + set; + } + + /// + /// attributesStyle + /// + public CefSharp.DevTools.CSS.CSSStyle AttributesStyle + { + get + { + return attributesStyle; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/GetMatchedStylesForNodeResponse.cs b/CefSharp/DevTools/CSS/GetMatchedStylesForNodeResponse.cs new file mode 100644 index 0000000000..fdbd1f0d78 --- /dev/null +++ b/CefSharp/DevTools/CSS/GetMatchedStylesForNodeResponse.cs @@ -0,0 +1,120 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// GetMatchedStylesForNodeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetMatchedStylesForNodeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.CSS.CSSStyle inlineStyle + { + get; + set; + } + + /// + /// inlineStyle + /// + public CefSharp.DevTools.CSS.CSSStyle InlineStyle + { + get + { + return inlineStyle; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.CSS.CSSStyle attributesStyle + { + get; + set; + } + + /// + /// attributesStyle + /// + public CefSharp.DevTools.CSS.CSSStyle AttributesStyle + { + get + { + return attributesStyle; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList matchedCSSRules + { + get; + set; + } + + /// + /// matchedCSSRules + /// + public System.Collections.Generic.IList MatchedCSSRules + { + get + { + return matchedCSSRules; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList pseudoElements + { + get; + set; + } + + /// + /// pseudoElements + /// + public System.Collections.Generic.IList PseudoElements + { + get + { + return pseudoElements; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList inherited + { + get; + set; + } + + /// + /// inherited + /// + public System.Collections.Generic.IList Inherited + { + get + { + return inherited; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList cssKeyframesRules + { + get; + set; + } + + /// + /// cssKeyframesRules + /// + public System.Collections.Generic.IList CssKeyframesRules + { + get + { + return cssKeyframesRules; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/GetMediaQueriesResponse.cs b/CefSharp/DevTools/CSS/GetMediaQueriesResponse.cs new file mode 100644 index 0000000000..9e9c43830a --- /dev/null +++ b/CefSharp/DevTools/CSS/GetMediaQueriesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// GetMediaQueriesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetMediaQueriesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList medias + { + get; + set; + } + + /// + /// medias + /// + public System.Collections.Generic.IList Medias + { + get + { + return medias; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/GetPlatformFontsForNodeResponse.cs b/CefSharp/DevTools/CSS/GetPlatformFontsForNodeResponse.cs new file mode 100644 index 0000000000..894a4109f0 --- /dev/null +++ b/CefSharp/DevTools/CSS/GetPlatformFontsForNodeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// GetPlatformFontsForNodeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetPlatformFontsForNodeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList fonts + { + get; + set; + } + + /// + /// fonts + /// + public System.Collections.Generic.IList Fonts + { + get + { + return fonts; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/GetStyleSheetTextResponse.cs b/CefSharp/DevTools/CSS/GetStyleSheetTextResponse.cs new file mode 100644 index 0000000000..d67d49d011 --- /dev/null +++ b/CefSharp/DevTools/CSS/GetStyleSheetTextResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// GetStyleSheetTextResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetStyleSheetTextResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string text + { + get; + set; + } + + /// + /// text + /// + public string Text + { + get + { + return text; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/InheritedStyleEntry.cs b/CefSharp/DevTools/CSS/InheritedStyleEntry.cs new file mode 100644 index 0000000000..4d6dd17e93 --- /dev/null +++ b/CefSharp/DevTools/CSS/InheritedStyleEntry.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Inherited CSS rule collection from ancestor node. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class InheritedStyleEntry : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The ancestor node's inline style, if any, in the style inheritance chain. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("inlineStyle"), IsRequired = (false))] + public CefSharp.DevTools.CSS.CSSStyle InlineStyle + { + get; + set; + } + + /// + /// Matches of CSS rules matching the ancestor node in the style inheritance chain. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("matchedCSSRules"), IsRequired = (true))] + public System.Collections.Generic.IList MatchedCSSRules + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/MediaQuery.cs b/CefSharp/DevTools/CSS/MediaQuery.cs new file mode 100644 index 0000000000..af80daf5db --- /dev/null +++ b/CefSharp/DevTools/CSS/MediaQuery.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Media query descriptor. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class MediaQuery : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Array of media query expressions. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("expressions"), IsRequired = (true))] + public System.Collections.Generic.IList Expressions + { + get; + set; + } + + /// + /// Whether the media query condition is satisfied. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("active"), IsRequired = (true))] + public bool Active + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/MediaQueryExpression.cs b/CefSharp/DevTools/CSS/MediaQueryExpression.cs new file mode 100644 index 0000000000..fd06937de1 --- /dev/null +++ b/CefSharp/DevTools/CSS/MediaQueryExpression.cs @@ -0,0 +1,62 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Media query expression descriptor. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class MediaQueryExpression : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Media query expression value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public long Value + { + get; + set; + } + + /// + /// Media query expression units. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("unit"), IsRequired = (true))] + public string Unit + { + get; + set; + } + + /// + /// Media query expression feature. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("feature"), IsRequired = (true))] + public string Feature + { + get; + set; + } + + /// + /// The associated range of the value text in the enclosing stylesheet (if available). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("valueRange"), IsRequired = (false))] + public CefSharp.DevTools.CSS.SourceRange ValueRange + { + get; + set; + } + + /// + /// Computed length of media query expression (if applicable). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("computedLength"), IsRequired = (false))] + public long? ComputedLength + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/PlatformFontUsage.cs b/CefSharp/DevTools/CSS/PlatformFontUsage.cs new file mode 100644 index 0000000000..fee752f0c4 --- /dev/null +++ b/CefSharp/DevTools/CSS/PlatformFontUsage.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Information about amount of glyphs that were rendered with given font. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PlatformFontUsage : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Font's family name reported by platform. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("familyName"), IsRequired = (true))] + public string FamilyName + { + get; + set; + } + + /// + /// Indicates if the font was downloaded or resolved locally. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isCustomFont"), IsRequired = (true))] + public bool IsCustomFont + { + get; + set; + } + + /// + /// Amount of glyphs that were rendered with this font. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("glyphCount"), IsRequired = (true))] + public long GlyphCount + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/PseudoElementMatches.cs b/CefSharp/DevTools/CSS/PseudoElementMatches.cs new file mode 100644 index 0000000000..fcfa7ef939 --- /dev/null +++ b/CefSharp/DevTools/CSS/PseudoElementMatches.cs @@ -0,0 +1,45 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSS rule collection for a single pseudo style. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PseudoElementMatches : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.DOM.PseudoType PseudoType + { + get + { + return (CefSharp.DevTools.DOM.PseudoType)(StringToEnum(typeof(CefSharp.DevTools.DOM.PseudoType), pseudoType)); + } + + set + { + pseudoType = (EnumToString(value)); + } + } + + /// + /// Pseudo element type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pseudoType"), IsRequired = (true))] + internal string pseudoType + { + get; + set; + } + + /// + /// Matches of CSS rules applicable to the pseudo style. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("matches"), IsRequired = (true))] + public System.Collections.Generic.IList Matches + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/RuleMatch.cs b/CefSharp/DevTools/CSS/RuleMatch.cs new file mode 100644 index 0000000000..24de106d93 --- /dev/null +++ b/CefSharp/DevTools/CSS/RuleMatch.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Match data for a CSS rule. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RuleMatch : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// CSS rule in the match. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("rule"), IsRequired = (true))] + public CefSharp.DevTools.CSS.CSSRule Rule + { + get; + set; + } + + /// + /// Matching selector indices in the rule's selectorList selectors (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("matchingSelectors"), IsRequired = (true))] + public int[] MatchingSelectors + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/RuleUsage.cs b/CefSharp/DevTools/CSS/RuleUsage.cs new file mode 100644 index 0000000000..b9b1237503 --- /dev/null +++ b/CefSharp/DevTools/CSS/RuleUsage.cs @@ -0,0 +1,53 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// CSS coverage information. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RuleUsage : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The css style sheet identifier (absent for user agent stylesheet and user-specified + /// stylesheet rules) this rule came from. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("styleSheetId"), IsRequired = (true))] + public string StyleSheetId + { + get; + set; + } + + /// + /// Offset of the start of the rule (including selector) from the beginning of the stylesheet. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("startOffset"), IsRequired = (true))] + public long StartOffset + { + get; + set; + } + + /// + /// Offset of the end of the rule body from the beginning of the stylesheet. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("endOffset"), IsRequired = (true))] + public long EndOffset + { + get; + set; + } + + /// + /// Indicates whether the rule was actually used by some element in the page. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("used"), IsRequired = (true))] + public bool Used + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/SelectorList.cs b/CefSharp/DevTools/CSS/SelectorList.cs new file mode 100644 index 0000000000..22e7131c7e --- /dev/null +++ b/CefSharp/DevTools/CSS/SelectorList.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Selector list data. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SelectorList : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Selectors in the list. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("selectors"), IsRequired = (true))] + public System.Collections.Generic.IList Selectors + { + get; + set; + } + + /// + /// Rule selector text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("text"), IsRequired = (true))] + public string Text + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/SetKeyframeKeyResponse.cs b/CefSharp/DevTools/CSS/SetKeyframeKeyResponse.cs new file mode 100644 index 0000000000..73e56ac0a4 --- /dev/null +++ b/CefSharp/DevTools/CSS/SetKeyframeKeyResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// SetKeyframeKeyResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetKeyframeKeyResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.CSS.Value keyText + { + get; + set; + } + + /// + /// keyText + /// + public CefSharp.DevTools.CSS.Value KeyText + { + get + { + return keyText; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/SetMediaTextResponse.cs b/CefSharp/DevTools/CSS/SetMediaTextResponse.cs new file mode 100644 index 0000000000..529b95f189 --- /dev/null +++ b/CefSharp/DevTools/CSS/SetMediaTextResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// SetMediaTextResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetMediaTextResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.CSS.CSSMedia media + { + get; + set; + } + + /// + /// media + /// + public CefSharp.DevTools.CSS.CSSMedia Media + { + get + { + return media; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/SetRuleSelectorResponse.cs b/CefSharp/DevTools/CSS/SetRuleSelectorResponse.cs new file mode 100644 index 0000000000..0f7da2ee9c --- /dev/null +++ b/CefSharp/DevTools/CSS/SetRuleSelectorResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// SetRuleSelectorResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetRuleSelectorResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.CSS.SelectorList selectorList + { + get; + set; + } + + /// + /// selectorList + /// + public CefSharp.DevTools.CSS.SelectorList SelectorList + { + get + { + return selectorList; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/SetStyleSheetTextResponse.cs b/CefSharp/DevTools/CSS/SetStyleSheetTextResponse.cs new file mode 100644 index 0000000000..c702d74d62 --- /dev/null +++ b/CefSharp/DevTools/CSS/SetStyleSheetTextResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// SetStyleSheetTextResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetStyleSheetTextResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string sourceMapURL + { + get; + set; + } + + /// + /// sourceMapURL + /// + public string SourceMapURL + { + get + { + return sourceMapURL; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/SetStyleTextsResponse.cs b/CefSharp/DevTools/CSS/SetStyleTextsResponse.cs new file mode 100644 index 0000000000..b41c70491e --- /dev/null +++ b/CefSharp/DevTools/CSS/SetStyleTextsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// SetStyleTextsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetStyleTextsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList styles + { + get; + set; + } + + /// + /// styles + /// + public System.Collections.Generic.IList Styles + { + get + { + return styles; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/ShorthandEntry.cs b/CefSharp/DevTools/CSS/ShorthandEntry.cs new file mode 100644 index 0000000000..f42764ec07 --- /dev/null +++ b/CefSharp/DevTools/CSS/ShorthandEntry.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// ShorthandEntry + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ShorthandEntry : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Shorthand name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Shorthand value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + + /// + /// Whether the property has "!important" annotation (implies `false` if absent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("important"), IsRequired = (false))] + public bool? Important + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/SourceRange.cs b/CefSharp/DevTools/CSS/SourceRange.cs new file mode 100644 index 0000000000..4476216d16 --- /dev/null +++ b/CefSharp/DevTools/CSS/SourceRange.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Text range within a resource. All numbers are zero-based. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SourceRange : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Start line of range. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("startLine"), IsRequired = (true))] + public int StartLine + { + get; + set; + } + + /// + /// Start column of range (inclusive). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("startColumn"), IsRequired = (true))] + public int StartColumn + { + get; + set; + } + + /// + /// End line of range + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("endLine"), IsRequired = (true))] + public int EndLine + { + get; + set; + } + + /// + /// End column of range (exclusive). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("endColumn"), IsRequired = (true))] + public int EndColumn + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/StopRuleUsageTrackingResponse.cs b/CefSharp/DevTools/CSS/StopRuleUsageTrackingResponse.cs new file mode 100644 index 0000000000..3d1eebef34 --- /dev/null +++ b/CefSharp/DevTools/CSS/StopRuleUsageTrackingResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// StopRuleUsageTrackingResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class StopRuleUsageTrackingResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList ruleUsage + { + get; + set; + } + + /// + /// ruleUsage + /// + public System.Collections.Generic.IList RuleUsage + { + get + { + return ruleUsage; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/StyleDeclarationEdit.cs b/CefSharp/DevTools/CSS/StyleDeclarationEdit.cs new file mode 100644 index 0000000000..20cf7bec41 --- /dev/null +++ b/CefSharp/DevTools/CSS/StyleDeclarationEdit.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// A descriptor of operation to mutate style declaration text. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class StyleDeclarationEdit : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The css style sheet identifier. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("styleSheetId"), IsRequired = (true))] + public string StyleSheetId + { + get; + set; + } + + /// + /// The range of the style text in the enclosing stylesheet. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("range"), IsRequired = (true))] + public CefSharp.DevTools.CSS.SourceRange Range + { + get; + set; + } + + /// + /// New style text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("text"), IsRequired = (true))] + public string Text + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/TakeCoverageDeltaResponse.cs b/CefSharp/DevTools/CSS/TakeCoverageDeltaResponse.cs new file mode 100644 index 0000000000..da19fa08f7 --- /dev/null +++ b/CefSharp/DevTools/CSS/TakeCoverageDeltaResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// TakeCoverageDeltaResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TakeCoverageDeltaResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList coverage + { + get; + set; + } + + /// + /// coverage + /// + public System.Collections.Generic.IList Coverage + { + get + { + return coverage; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal long timestamp + { + get; + set; + } + + /// + /// timestamp + /// + public long Timestamp + { + get + { + return timestamp; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CSS/Value.cs b/CefSharp/DevTools/CSS/Value.cs new file mode 100644 index 0000000000..d590d178c9 --- /dev/null +++ b/CefSharp/DevTools/CSS/Value.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.CSS +{ + /// + /// Data for a simple selector (these are delimited by commas in a selector list). + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Value : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Value text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("text"), IsRequired = (true))] + public string Text + { + get; + set; + } + + /// + /// Value range in the underlying resource (if available). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("range"), IsRequired = (false))] + public CefSharp.DevTools.CSS.SourceRange Range + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CacheStorage/Cache.cs b/CefSharp/DevTools/CacheStorage/Cache.cs new file mode 100644 index 0000000000..f7b2fedbd5 --- /dev/null +++ b/CefSharp/DevTools/CacheStorage/Cache.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.CacheStorage +{ + /// + /// Cache identifier. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Cache : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// An opaque unique id of the cache. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cacheId"), IsRequired = (true))] + public string CacheId + { + get; + set; + } + + /// + /// Security origin of the cache. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("securityOrigin"), IsRequired = (true))] + public string SecurityOrigin + { + get; + set; + } + + /// + /// The name of the cache. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cacheName"), IsRequired = (true))] + public string CacheName + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CacheStorage/CacheStorage.cs b/CefSharp/DevTools/CacheStorage/CacheStorage.cs new file mode 100644 index 0000000000..511e581f3d --- /dev/null +++ b/CefSharp/DevTools/CacheStorage/CacheStorage.cs @@ -0,0 +1,118 @@ +// Copyright © 2020 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.DevTools.CacheStorage +{ + using System.Linq; + + /// + /// CacheStorage + /// + public partial class CacheStorage : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public CacheStorage(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateDeleteCache(string cacheId); + /// + /// Deletes a cache. + /// + /// Id of cache for deletion. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DeleteCacheAsync(string cacheId) + { + ValidateDeleteCache(cacheId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("cacheId", cacheId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.deleteCache", dict); + return methodResult; + } + + partial void ValidateDeleteEntry(string cacheId, string request); + /// + /// Deletes a cache entry. + /// + /// Id of cache where the entry will be deleted. + /// URL spec of the request. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DeleteEntryAsync(string cacheId, string request) + { + ValidateDeleteEntry(cacheId, request); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("cacheId", cacheId); + dict.Add("request", request); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.deleteEntry", dict); + return methodResult; + } + + partial void ValidateRequestCacheNames(string securityOrigin); + /// + /// Requests cache names. + /// + /// Security origin. + /// returns System.Threading.Tasks.Task<RequestCacheNamesResponse> + public async System.Threading.Tasks.Task RequestCacheNamesAsync(string securityOrigin) + { + ValidateRequestCacheNames(securityOrigin); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("securityOrigin", securityOrigin); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.requestCacheNames", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateRequestCachedResponse(string cacheId, string requestURL, System.Collections.Generic.IList requestHeaders); + /// + /// Fetches cache entry. + /// + /// Id of cache that contains the entry. + /// URL spec of the request. + /// headers of the request. + /// returns System.Threading.Tasks.Task<RequestCachedResponseResponse> + public async System.Threading.Tasks.Task RequestCachedResponseAsync(string cacheId, string requestURL, System.Collections.Generic.IList requestHeaders) + { + ValidateRequestCachedResponse(cacheId, requestURL, requestHeaders); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("cacheId", cacheId); + dict.Add("requestURL", requestURL); + dict.Add("requestHeaders", requestHeaders.Select(x => x.ToDictionary())); + var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.requestCachedResponse", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateRequestEntries(string cacheId, int? skipCount = null, int? pageSize = null, string pathFilter = null); + /// + /// Requests data from cache. + /// + /// ID of cache to get entries from. + /// Number of records to skip. + /// Number of records to fetch. + /// If present, only return the entries containing this substring in the path + /// returns System.Threading.Tasks.Task<RequestEntriesResponse> + public async System.Threading.Tasks.Task RequestEntriesAsync(string cacheId, int? skipCount = null, int? pageSize = null, string pathFilter = null) + { + ValidateRequestEntries(cacheId, skipCount, pageSize, pathFilter); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("cacheId", cacheId); + if (skipCount.HasValue) + { + dict.Add("skipCount", skipCount.Value); + } + + if (pageSize.HasValue) + { + dict.Add("pageSize", pageSize.Value); + } + + if (!(string.IsNullOrEmpty(pathFilter))) + { + dict.Add("pathFilter", pathFilter); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("CacheStorage.requestEntries", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CacheStorage/CachedResponse.cs b/CefSharp/DevTools/CacheStorage/CachedResponse.cs new file mode 100644 index 0000000000..72a83a1927 --- /dev/null +++ b/CefSharp/DevTools/CacheStorage/CachedResponse.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.CacheStorage +{ + /// + /// Cached response + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CachedResponse : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Entry content, base64-encoded. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("body"), IsRequired = (true))] + public byte[] Body + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CacheStorage/DataEntry.cs b/CefSharp/DevTools/CacheStorage/DataEntry.cs new file mode 100644 index 0000000000..48545b4550 --- /dev/null +++ b/CefSharp/DevTools/CacheStorage/DataEntry.cs @@ -0,0 +1,105 @@ +// Copyright © 2020 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.DevTools.CacheStorage +{ + /// + /// Data entry. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class DataEntry : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Request URL. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestURL"), IsRequired = (true))] + public string RequestURL + { + get; + set; + } + + /// + /// Request method. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestMethod"), IsRequired = (true))] + public string RequestMethod + { + get; + set; + } + + /// + /// Request headers + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestHeaders"), IsRequired = (true))] + public System.Collections.Generic.IList RequestHeaders + { + get; + set; + } + + /// + /// Number of seconds since epoch. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("responseTime"), IsRequired = (true))] + public long ResponseTime + { + get; + set; + } + + /// + /// HTTP response status code. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("responseStatus"), IsRequired = (true))] + public int ResponseStatus + { + get; + set; + } + + /// + /// HTTP response status text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("responseStatusText"), IsRequired = (true))] + public string ResponseStatusText + { + get; + set; + } + + public CefSharp.DevTools.CacheStorage.CachedResponseType ResponseType + { + get + { + return (CefSharp.DevTools.CacheStorage.CachedResponseType)(StringToEnum(typeof(CefSharp.DevTools.CacheStorage.CachedResponseType), responseType)); + } + + set + { + responseType = (EnumToString(value)); + } + } + + /// + /// HTTP response type + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("responseType"), IsRequired = (true))] + internal string responseType + { + get; + set; + } + + /// + /// Response headers + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("responseHeaders"), IsRequired = (true))] + public System.Collections.Generic.IList ResponseHeaders + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CacheStorage/Enums/CachedResponseType.cs b/CefSharp/DevTools/CacheStorage/Enums/CachedResponseType.cs new file mode 100644 index 0000000000..374f5f8df2 --- /dev/null +++ b/CefSharp/DevTools/CacheStorage/Enums/CachedResponseType.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.CacheStorage +{ + /// + /// type of HTTP response cached + /// + public enum CachedResponseType + { + /// + /// basic + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("basic"))] + Basic, + /// + /// cors + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("cors"))] + Cors, + /// + /// default + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("default"))] + Default, + /// + /// error + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("error"))] + Error, + /// + /// opaqueResponse + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("opaqueResponse"))] + OpaqueResponse, + /// + /// opaqueRedirect + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("opaqueRedirect"))] + OpaqueRedirect + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CacheStorage/Header.cs b/CefSharp/DevTools/CacheStorage/Header.cs new file mode 100644 index 0000000000..407080acbc --- /dev/null +++ b/CefSharp/DevTools/CacheStorage/Header.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.CacheStorage +{ + /// + /// Header + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Header : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Value + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CacheStorage/RequestCacheNamesResponse.cs b/CefSharp/DevTools/CacheStorage/RequestCacheNamesResponse.cs new file mode 100644 index 0000000000..5a58a25efe --- /dev/null +++ b/CefSharp/DevTools/CacheStorage/RequestCacheNamesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CacheStorage +{ + /// + /// RequestCacheNamesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestCacheNamesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList caches + { + get; + set; + } + + /// + /// caches + /// + public System.Collections.Generic.IList Caches + { + get + { + return caches; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CacheStorage/RequestCachedResponseResponse.cs b/CefSharp/DevTools/CacheStorage/RequestCachedResponseResponse.cs new file mode 100644 index 0000000000..c54beb8a07 --- /dev/null +++ b/CefSharp/DevTools/CacheStorage/RequestCachedResponseResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.CacheStorage +{ + /// + /// RequestCachedResponseResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestCachedResponseResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.CacheStorage.CachedResponse response + { + get; + set; + } + + /// + /// response + /// + public CefSharp.DevTools.CacheStorage.CachedResponse Response + { + get + { + return response; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/CacheStorage/RequestEntriesResponse.cs b/CefSharp/DevTools/CacheStorage/RequestEntriesResponse.cs new file mode 100644 index 0000000000..5b426c8af1 --- /dev/null +++ b/CefSharp/DevTools/CacheStorage/RequestEntriesResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.CacheStorage +{ + /// + /// RequestEntriesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestEntriesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList cacheDataEntries + { + get; + set; + } + + /// + /// cacheDataEntries + /// + public System.Collections.Generic.IList CacheDataEntries + { + get + { + return cacheDataEntries; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal long returnCount + { + get; + set; + } + + /// + /// returnCount + /// + public long ReturnCount + { + get + { + return returnCount; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Cast/Cast.cs b/CefSharp/DevTools/Cast/Cast.cs new file mode 100644 index 0000000000..03e170742e --- /dev/null +++ b/CefSharp/DevTools/Cast/Cast.cs @@ -0,0 +1,100 @@ +// Copyright © 2020 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.DevTools.Cast +{ + using System.Linq; + + /// + /// A domain for interacting with Cast, Presentation API, and Remote Playback API + /// functionalities. + /// + public partial class Cast : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Cast(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateEnable(string presentationUrl = null); + /// + /// Starts observing for sinks that can be used for tab mirroring, and if set, + /// sinks compatible with |presentationUrl| as well. When sinks are found, a + /// |sinksUpdated| event is fired. + /// Also starts observing for issue messages. When an issue is added or removed, + /// an |issueUpdated| event is fired. + /// + /// presentationUrl + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync(string presentationUrl = null) + { + ValidateEnable(presentationUrl); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(presentationUrl))) + { + dict.Add("presentationUrl", presentationUrl); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.enable", dict); + return methodResult; + } + + /// + /// Stops observing for sinks and issues. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.disable", dict); + return methodResult; + } + + partial void ValidateSetSinkToUse(string sinkName); + /// + /// Sets a sink to be used when the web page requests the browser to choose a + /// sink via Presentation API, Remote Playback API, or Cast SDK. + /// + /// sinkName + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetSinkToUseAsync(string sinkName) + { + ValidateSetSinkToUse(sinkName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("sinkName", sinkName); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.setSinkToUse", dict); + return methodResult; + } + + partial void ValidateStartTabMirroring(string sinkName); + /// + /// Starts mirroring the tab to the sink. + /// + /// sinkName + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartTabMirroringAsync(string sinkName) + { + ValidateStartTabMirroring(sinkName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("sinkName", sinkName); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.startTabMirroring", dict); + return methodResult; + } + + partial void ValidateStopCasting(string sinkName); + /// + /// Stops the active Cast session on the sink. + /// + /// sinkName + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopCastingAsync(string sinkName) + { + ValidateStopCasting(sinkName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("sinkName", sinkName); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.stopCasting", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Cast/Sink.cs b/CefSharp/DevTools/Cast/Sink.cs new file mode 100644 index 0000000000..2bc84cec1f --- /dev/null +++ b/CefSharp/DevTools/Cast/Sink.cs @@ -0,0 +1,43 @@ +// Copyright © 2020 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.DevTools.Cast +{ + /// + /// Sink + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Sink : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Id + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("id"), IsRequired = (true))] + public string Id + { + get; + set; + } + + /// + /// Text describing the current session. Present only if there is an active + /// session on the sink. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("session"), IsRequired = (false))] + public string Session + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/BackendNode.cs b/CefSharp/DevTools/DOM/BackendNode.cs new file mode 100644 index 0000000000..c5142679d3 --- /dev/null +++ b/CefSharp/DevTools/DOM/BackendNode.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// Backend node with a friendly name. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class BackendNode : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// `Node`'s nodeType. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeType"), IsRequired = (true))] + public int NodeType + { + get; + set; + } + + /// + /// `Node`'s nodeName. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeName"), IsRequired = (true))] + public string NodeName + { + get; + set; + } + + /// + /// BackendNodeId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("backendNodeId"), IsRequired = (true))] + public int BackendNodeId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/BoxModel.cs b/CefSharp/DevTools/DOM/BoxModel.cs new file mode 100644 index 0000000000..ab39fa69b6 --- /dev/null +++ b/CefSharp/DevTools/DOM/BoxModel.cs @@ -0,0 +1,82 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// Box model. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class BoxModel : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Content box + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("content"), IsRequired = (true))] + public long[] Content + { + get; + set; + } + + /// + /// Padding box + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("padding"), IsRequired = (true))] + public long[] Padding + { + get; + set; + } + + /// + /// Border box + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("border"), IsRequired = (true))] + public long[] Border + { + get; + set; + } + + /// + /// Margin box + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("margin"), IsRequired = (true))] + public long[] Margin + { + get; + set; + } + + /// + /// Node width + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("width"), IsRequired = (true))] + public int Width + { + get; + set; + } + + /// + /// Node height + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("height"), IsRequired = (true))] + public int Height + { + get; + set; + } + + /// + /// Shape outside coordinates + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("shapeOutside"), IsRequired = (false))] + public CefSharp.DevTools.DOM.ShapeOutsideInfo ShapeOutside + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/CollectClassNamesFromSubtreeResponse.cs b/CefSharp/DevTools/DOM/CollectClassNamesFromSubtreeResponse.cs new file mode 100644 index 0000000000..5a378166fa --- /dev/null +++ b/CefSharp/DevTools/DOM/CollectClassNamesFromSubtreeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// CollectClassNamesFromSubtreeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CollectClassNamesFromSubtreeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] classNames + { + get; + set; + } + + /// + /// classNames + /// + public string[] ClassNames + { + get + { + return classNames; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/CopyToResponse.cs b/CefSharp/DevTools/DOM/CopyToResponse.cs new file mode 100644 index 0000000000..4f17e0be1d --- /dev/null +++ b/CefSharp/DevTools/DOM/CopyToResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// CopyToResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CopyToResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int nodeId + { + get; + set; + } + + /// + /// nodeId + /// + public int NodeId + { + get + { + return nodeId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/DOM.cs b/CefSharp/DevTools/DOM/DOM.cs new file mode 100644 index 0000000000..b730395788 --- /dev/null +++ b/CefSharp/DevTools/DOM/DOM.cs @@ -0,0 +1,922 @@ +// Copyright © 2020 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.DevTools.DOM +{ + using System.Linq; + + /// + /// This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object + /// that has an `id`. This `id` can be used to get additional information on the Node, resolve it into + /// the JavaScript object wrapper, etc. It is important that client receives DOM events only for the + /// nodes that are known to the client. Backend keeps track of the nodes that were sent to the client + /// and never sends the same node twice. It is client's responsibility to collect information about + /// the nodes that were sent to the client.

Note that `iframe` owner elements will return + /// corresponding document elements as their child nodes.

+ ///
+ public partial class DOM : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public DOM(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateCollectClassNamesFromSubtree(int nodeId); + /// + /// Collects class names for the node with given id and all of it's child nodes. + /// + /// Id of the node to collect class names. + /// returns System.Threading.Tasks.Task<CollectClassNamesFromSubtreeResponse> + public async System.Threading.Tasks.Task CollectClassNamesFromSubtreeAsync(int nodeId) + { + ValidateCollectClassNamesFromSubtree(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.collectClassNamesFromSubtree", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateCopyTo(int nodeId, int targetNodeId, int? insertBeforeNodeId = null); + /// + /// Creates a deep copy of the specified node and places it into the target container before the + /// given anchor. + /// + /// Id of the node to copy. + /// Id of the element to drop the copy into. + /// Drop the copy before this node (if absent, the copy becomes the last child of + public async System.Threading.Tasks.Task CopyToAsync(int nodeId, int targetNodeId, int? insertBeforeNodeId = null) + { + ValidateCopyTo(nodeId, targetNodeId, insertBeforeNodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("targetNodeId", targetNodeId); + if (insertBeforeNodeId.HasValue) + { + dict.Add("insertBeforeNodeId", insertBeforeNodeId.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.copyTo", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateDescribeNode(int? nodeId = null, int? backendNodeId = null, string objectId = null, int? depth = null, bool? pierce = null); + /// + /// Describes node given its id, does not require domain to be enabled. Does not start tracking any + /// objects, can be used for automation. + /// + /// Identifier of the node. + /// Identifier of the backend node. + /// JavaScript object id of the node wrapper. + /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the + public async System.Threading.Tasks.Task DescribeNodeAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null, int? depth = null, bool? pierce = null) + { + ValidateDescribeNode(nodeId, backendNodeId, objectId, depth, pierce); + var dict = new System.Collections.Generic.Dictionary(); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + if (depth.HasValue) + { + dict.Add("depth", depth.Value); + } + + if (pierce.HasValue) + { + dict.Add("pierce", pierce.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.describeNode", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateScrollIntoViewIfNeeded(int? nodeId = null, int? backendNodeId = null, string objectId = null, CefSharp.DevTools.DOM.Rect rect = null); + /// + /// Scrolls the specified rect of the given node into view if not already visible. + /// Note: exactly one between nodeId, backendNodeId and objectId should be passed + /// to identify the node. + /// + /// Identifier of the node. + /// Identifier of the backend node. + /// JavaScript object id of the node wrapper. + /// The rect to be scrolled into view, relative to the node's border box, in CSS pixels. + public async System.Threading.Tasks.Task ScrollIntoViewIfNeededAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null, CefSharp.DevTools.DOM.Rect rect = null) + { + ValidateScrollIntoViewIfNeeded(nodeId, backendNodeId, objectId, rect); + var dict = new System.Collections.Generic.Dictionary(); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + if ((rect) != (null)) + { + dict.Add("rect", rect.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.scrollIntoViewIfNeeded", dict); + return methodResult; + } + + /// + /// Disables DOM agent for the given page. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.disable", dict); + return methodResult; + } + + partial void ValidateDiscardSearchResults(string searchId); + /// + /// Discards search results from the session with the given id. `getSearchResults` should no longer + /// be called for that search. + /// + /// Unique search session identifier. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DiscardSearchResultsAsync(string searchId) + { + ValidateDiscardSearchResults(searchId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("searchId", searchId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.discardSearchResults", dict); + return methodResult; + } + + /// + /// Enables DOM agent for the given page. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.enable", dict); + return methodResult; + } + + partial void ValidateFocus(int? nodeId = null, int? backendNodeId = null, string objectId = null); + /// + /// Focuses the given element. + /// + /// Identifier of the node. + /// Identifier of the backend node. + /// JavaScript object id of the node wrapper. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task FocusAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null) + { + ValidateFocus(nodeId, backendNodeId, objectId); + var dict = new System.Collections.Generic.Dictionary(); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.focus", dict); + return methodResult; + } + + partial void ValidateGetAttributes(int nodeId); + /// + /// Returns attributes for the specified node. + /// + /// Id of the node to retrieve attibutes for. + /// returns System.Threading.Tasks.Task<GetAttributesResponse> + public async System.Threading.Tasks.Task GetAttributesAsync(int nodeId) + { + ValidateGetAttributes(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getAttributes", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetBoxModel(int? nodeId = null, int? backendNodeId = null, string objectId = null); + /// + /// Returns boxes for the given node. + /// + /// Identifier of the node. + /// Identifier of the backend node. + /// JavaScript object id of the node wrapper. + /// returns System.Threading.Tasks.Task<GetBoxModelResponse> + public async System.Threading.Tasks.Task GetBoxModelAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null) + { + ValidateGetBoxModel(nodeId, backendNodeId, objectId); + var dict = new System.Collections.Generic.Dictionary(); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getBoxModel", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetContentQuads(int? nodeId = null, int? backendNodeId = null, string objectId = null); + /// + /// Returns quads that describe node position on the page. This method + /// might return multiple quads for inline nodes. + /// + /// Identifier of the node. + /// Identifier of the backend node. + /// JavaScript object id of the node wrapper. + /// returns System.Threading.Tasks.Task<GetContentQuadsResponse> + public async System.Threading.Tasks.Task GetContentQuadsAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null) + { + ValidateGetContentQuads(nodeId, backendNodeId, objectId); + var dict = new System.Collections.Generic.Dictionary(); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getContentQuads", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetDocument(int? depth = null, bool? pierce = null); + /// + /// Returns the root DOM node (and optionally the subtree) to the caller. + /// + /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the + public async System.Threading.Tasks.Task GetDocumentAsync(int? depth = null, bool? pierce = null) + { + ValidateGetDocument(depth, pierce); + var dict = new System.Collections.Generic.Dictionary(); + if (depth.HasValue) + { + dict.Add("depth", depth.Value); + } + + if (pierce.HasValue) + { + dict.Add("pierce", pierce.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getDocument", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetFlattenedDocument(int? depth = null, bool? pierce = null); + /// + /// Returns the root DOM node (and optionally the subtree) to the caller. + /// + /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the + public async System.Threading.Tasks.Task GetFlattenedDocumentAsync(int? depth = null, bool? pierce = null) + { + ValidateGetFlattenedDocument(depth, pierce); + var dict = new System.Collections.Generic.Dictionary(); + if (depth.HasValue) + { + dict.Add("depth", depth.Value); + } + + if (pierce.HasValue) + { + dict.Add("pierce", pierce.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getFlattenedDocument", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetNodeForLocation(int x, int y, bool? includeUserAgentShadowDOM = null, bool? ignorePointerEventsNone = null); + /// + /// Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is + /// either returned or not. + /// + /// X coordinate. + /// Y coordinate. + /// False to skip to the nearest non-UA shadow root ancestor (default: false). + /// Whether to ignore pointer-events: none on elements and hit test them. + /// returns System.Threading.Tasks.Task<GetNodeForLocationResponse> + public async System.Threading.Tasks.Task GetNodeForLocationAsync(int x, int y, bool? includeUserAgentShadowDOM = null, bool? ignorePointerEventsNone = null) + { + ValidateGetNodeForLocation(x, y, includeUserAgentShadowDOM, ignorePointerEventsNone); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("x", x); + dict.Add("y", y); + if (includeUserAgentShadowDOM.HasValue) + { + dict.Add("includeUserAgentShadowDOM", includeUserAgentShadowDOM.Value); + } + + if (ignorePointerEventsNone.HasValue) + { + dict.Add("ignorePointerEventsNone", ignorePointerEventsNone.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getNodeForLocation", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetOuterHTML(int? nodeId = null, int? backendNodeId = null, string objectId = null); + /// + /// Returns node's HTML markup. + /// + /// Identifier of the node. + /// Identifier of the backend node. + /// JavaScript object id of the node wrapper. + /// returns System.Threading.Tasks.Task<GetOuterHTMLResponse> + public async System.Threading.Tasks.Task GetOuterHTMLAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null) + { + ValidateGetOuterHTML(nodeId, backendNodeId, objectId); + var dict = new System.Collections.Generic.Dictionary(); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getOuterHTML", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetRelayoutBoundary(int nodeId); + /// + /// Returns the id of the nearest ancestor that is a relayout boundary. + /// + /// Id of the node. + /// returns System.Threading.Tasks.Task<GetRelayoutBoundaryResponse> + public async System.Threading.Tasks.Task GetRelayoutBoundaryAsync(int nodeId) + { + ValidateGetRelayoutBoundary(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getRelayoutBoundary", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetSearchResults(string searchId, int fromIndex, int toIndex); + /// + /// Returns search results from given `fromIndex` to given `toIndex` from the search with the given + /// identifier. + /// + /// Unique search session identifier. + /// Start index of the search result to be returned. + /// End index of the search result to be returned. + /// returns System.Threading.Tasks.Task<GetSearchResultsResponse> + public async System.Threading.Tasks.Task GetSearchResultsAsync(string searchId, int fromIndex, int toIndex) + { + ValidateGetSearchResults(searchId, fromIndex, toIndex); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("searchId", searchId); + dict.Add("fromIndex", fromIndex); + dict.Add("toIndex", toIndex); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getSearchResults", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Hides any highlight. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task HideHighlightAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.hideHighlight", dict); + return methodResult; + } + + /// + /// Highlights DOM node. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task HighlightNodeAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.highlightNode", dict); + return methodResult; + } + + /// + /// Highlights given rectangle. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task HighlightRectAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.highlightRect", dict); + return methodResult; + } + + /// + /// Marks last undoable state. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task MarkUndoableStateAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.markUndoableState", dict); + return methodResult; + } + + partial void ValidateMoveTo(int nodeId, int targetNodeId, int? insertBeforeNodeId = null); + /// + /// Moves node into the new container, places it before the given anchor. + /// + /// Id of the node to move. + /// Id of the element to drop the moved node into. + /// Drop node before this one (if absent, the moved node becomes the last child of + public async System.Threading.Tasks.Task MoveToAsync(int nodeId, int targetNodeId, int? insertBeforeNodeId = null) + { + ValidateMoveTo(nodeId, targetNodeId, insertBeforeNodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("targetNodeId", targetNodeId); + if (insertBeforeNodeId.HasValue) + { + dict.Add("insertBeforeNodeId", insertBeforeNodeId.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.moveTo", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidatePerformSearch(string query, bool? includeUserAgentShadowDOM = null); + /// + /// Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or + /// `cancelSearch` to end this search session. + /// + /// Plain text or query selector or XPath search query. + /// True to search in user agent shadow DOM. + /// returns System.Threading.Tasks.Task<PerformSearchResponse> + public async System.Threading.Tasks.Task PerformSearchAsync(string query, bool? includeUserAgentShadowDOM = null) + { + ValidatePerformSearch(query, includeUserAgentShadowDOM); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("query", query); + if (includeUserAgentShadowDOM.HasValue) + { + dict.Add("includeUserAgentShadowDOM", includeUserAgentShadowDOM.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.performSearch", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidatePushNodeByPathToFrontend(string path); + /// + /// Requests that the node is sent to the caller given its path. // FIXME, use XPath + /// + /// Path to node in the proprietary format. + /// returns System.Threading.Tasks.Task<PushNodeByPathToFrontendResponse> + public async System.Threading.Tasks.Task PushNodeByPathToFrontendAsync(string path) + { + ValidatePushNodeByPathToFrontend(path); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("path", path); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.pushNodeByPathToFrontend", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidatePushNodesByBackendIdsToFrontend(int[] backendNodeIds); + /// + /// Requests that a batch of nodes is sent to the caller given their backend node ids. + /// + /// The array of backend node ids. + /// returns System.Threading.Tasks.Task<PushNodesByBackendIdsToFrontendResponse> + public async System.Threading.Tasks.Task PushNodesByBackendIdsToFrontendAsync(int[] backendNodeIds) + { + ValidatePushNodesByBackendIdsToFrontend(backendNodeIds); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("backendNodeIds", backendNodeIds); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.pushNodesByBackendIdsToFrontend", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateQuerySelector(int nodeId, string selector); + /// + /// Executes `querySelector` on a given node. + /// + /// Id of the node to query upon. + /// Selector string. + /// returns System.Threading.Tasks.Task<QuerySelectorResponse> + public async System.Threading.Tasks.Task QuerySelectorAsync(int nodeId, string selector) + { + ValidateQuerySelector(nodeId, selector); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("selector", selector); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.querySelector", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateQuerySelectorAll(int nodeId, string selector); + /// + /// Executes `querySelectorAll` on a given node. + /// + /// Id of the node to query upon. + /// Selector string. + /// returns System.Threading.Tasks.Task<QuerySelectorAllResponse> + public async System.Threading.Tasks.Task QuerySelectorAllAsync(int nodeId, string selector) + { + ValidateQuerySelectorAll(nodeId, selector); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("selector", selector); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.querySelectorAll", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Re-does the last undone action. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RedoAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.redo", dict); + return methodResult; + } + + partial void ValidateRemoveAttribute(int nodeId, string name); + /// + /// Removes attribute with given name from an element with given id. + /// + /// Id of the element to remove attribute from. + /// Name of the attribute to remove. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveAttributeAsync(int nodeId, string name) + { + ValidateRemoveAttribute(nodeId, name); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("name", name); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.removeAttribute", dict); + return methodResult; + } + + partial void ValidateRemoveNode(int nodeId); + /// + /// Removes node with given id. + /// + /// Id of the node to remove. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveNodeAsync(int nodeId) + { + ValidateRemoveNode(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.removeNode", dict); + return methodResult; + } + + partial void ValidateRequestChildNodes(int nodeId, int? depth = null, bool? pierce = null); + /// + /// Requests that children of the node with given id are returned to the caller in form of + /// `setChildNodes` events where not only immediate children are retrieved, but all children down to + /// the specified depth. + /// + /// Id of the node to get children for. + /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the + public async System.Threading.Tasks.Task RequestChildNodesAsync(int nodeId, int? depth = null, bool? pierce = null) + { + ValidateRequestChildNodes(nodeId, depth, pierce); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + if (depth.HasValue) + { + dict.Add("depth", depth.Value); + } + + if (pierce.HasValue) + { + dict.Add("pierce", pierce.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.requestChildNodes", dict); + return methodResult; + } + + partial void ValidateRequestNode(string objectId); + /// + /// Requests that the node is sent to the caller given the JavaScript node object reference. All + /// nodes that form the path from the node to the root are also sent to the client as a series of + /// `setChildNodes` notifications. + /// + /// JavaScript object id to convert into node. + /// returns System.Threading.Tasks.Task<RequestNodeResponse> + public async System.Threading.Tasks.Task RequestNodeAsync(string objectId) + { + ValidateRequestNode(objectId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectId", objectId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.requestNode", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateResolveNode(int? nodeId = null, int? backendNodeId = null, string objectGroup = null, int? executionContextId = null); + /// + /// Resolves the JavaScript node object for a given NodeId or BackendNodeId. + /// + /// Id of the node to resolve. + /// Backend identifier of the node to resolve. + /// Symbolic group name that can be used to release multiple objects. + /// Execution context in which to resolve the node. + /// returns System.Threading.Tasks.Task<ResolveNodeResponse> + public async System.Threading.Tasks.Task ResolveNodeAsync(int? nodeId = null, int? backendNodeId = null, string objectGroup = null, int? executionContextId = null) + { + ValidateResolveNode(nodeId, backendNodeId, objectGroup, executionContextId); + var dict = new System.Collections.Generic.Dictionary(); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectGroup))) + { + dict.Add("objectGroup", objectGroup); + } + + if (executionContextId.HasValue) + { + dict.Add("executionContextId", executionContextId.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.resolveNode", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetAttributeValue(int nodeId, string name, string value); + /// + /// Sets attribute for an element with given id. + /// + /// Id of the element to set attribute for. + /// Attribute name. + /// Attribute value. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetAttributeValueAsync(int nodeId, string name, string value) + { + ValidateSetAttributeValue(nodeId, name, value); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("name", name); + dict.Add("value", value); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setAttributeValue", dict); + return methodResult; + } + + partial void ValidateSetAttributesAsText(int nodeId, string text, string name = null); + /// + /// Sets attributes on element with given id. This method is useful when user edits some existing + /// attribute value and types in several attribute name/value pairs. + /// + /// Id of the element to set attributes for. + /// Text with a number of attributes. Will parse this text using HTML parser. + /// Attribute name to replace with new attributes derived from text in case text parsed + public async System.Threading.Tasks.Task SetAttributesAsTextAsync(int nodeId, string text, string name = null) + { + ValidateSetAttributesAsText(nodeId, text, name); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("text", text); + if (!(string.IsNullOrEmpty(name))) + { + dict.Add("name", name); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setAttributesAsText", dict); + return methodResult; + } + + partial void ValidateSetFileInputFiles(string[] files, int? nodeId = null, int? backendNodeId = null, string objectId = null); + /// + /// Sets files for the given file input element. + /// + /// Array of file paths to set. + /// Identifier of the node. + /// Identifier of the backend node. + /// JavaScript object id of the node wrapper. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetFileInputFilesAsync(string[] files, int? nodeId = null, int? backendNodeId = null, string objectId = null) + { + ValidateSetFileInputFiles(files, nodeId, backendNodeId, objectId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("files", files); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setFileInputFiles", dict); + return methodResult; + } + + partial void ValidateSetNodeStackTracesEnabled(bool enable); + /// + /// Sets if stack traces should be captured for Nodes. See `Node.getNodeStackTraces`. Default is disabled. + /// + /// Enable or disable. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetNodeStackTracesEnabledAsync(bool enable) + { + ValidateSetNodeStackTracesEnabled(enable); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enable", enable); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setNodeStackTracesEnabled", dict); + return methodResult; + } + + partial void ValidateGetNodeStackTraces(int nodeId); + /// + /// Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation. + /// + /// Id of the node to get stack traces for. + /// returns System.Threading.Tasks.Task<GetNodeStackTracesResponse> + public async System.Threading.Tasks.Task GetNodeStackTracesAsync(int nodeId) + { + ValidateGetNodeStackTraces(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getNodeStackTraces", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetFileInfo(string objectId); + /// + /// Returns file information for the given + /// File wrapper. + /// + /// JavaScript object id of the node wrapper. + /// returns System.Threading.Tasks.Task<GetFileInfoResponse> + public async System.Threading.Tasks.Task GetFileInfoAsync(string objectId) + { + ValidateGetFileInfo(objectId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectId", objectId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getFileInfo", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetInspectedNode(int nodeId); + /// + /// Enables console to refer to the node with given id via $x (see Command Line API for more details + /// $x functions). + /// + /// DOM node id to be accessible by means of $x command line API. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetInspectedNodeAsync(int nodeId) + { + ValidateSetInspectedNode(nodeId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setInspectedNode", dict); + return methodResult; + } + + partial void ValidateSetNodeName(int nodeId, string name); + /// + /// Sets node name for a node with given id. + /// + /// Id of the node to set name for. + /// New node's name. + /// returns System.Threading.Tasks.Task<SetNodeNameResponse> + public async System.Threading.Tasks.Task SetNodeNameAsync(int nodeId, string name) + { + ValidateSetNodeName(nodeId, name); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("name", name); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setNodeName", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetNodeValue(int nodeId, string value); + /// + /// Sets node value for a node with given id. + /// + /// Id of the node to set value for. + /// New node's value. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetNodeValueAsync(int nodeId, string value) + { + ValidateSetNodeValue(nodeId, value); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("value", value); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setNodeValue", dict); + return methodResult; + } + + partial void ValidateSetOuterHTML(int nodeId, string outerHTML); + /// + /// Sets node HTML markup, returns new node id. + /// + /// Id of the node to set markup for. + /// Outer HTML markup to set. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetOuterHTMLAsync(int nodeId, string outerHTML) + { + ValidateSetOuterHTML(nodeId, outerHTML); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("outerHTML", outerHTML); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setOuterHTML", dict); + return methodResult; + } + + /// + /// Undoes the last performed action. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task UndoAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.undo", dict); + return methodResult; + } + + partial void ValidateGetFrameOwner(string frameId); + /// + /// Returns iframe node that owns iframe with the given domain. + /// + /// frameId + /// returns System.Threading.Tasks.Task<GetFrameOwnerResponse> + public async System.Threading.Tasks.Task GetFrameOwnerAsync(string frameId) + { + ValidateGetFrameOwner(frameId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("frameId", frameId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getFrameOwner", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/DescribeNodeResponse.cs b/CefSharp/DevTools/DOM/DescribeNodeResponse.cs new file mode 100644 index 0000000000..a96cefc904 --- /dev/null +++ b/CefSharp/DevTools/DOM/DescribeNodeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// DescribeNodeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class DescribeNodeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.DOM.Node node + { + get; + set; + } + + /// + /// node + /// + public CefSharp.DevTools.DOM.Node Node + { + get + { + return node; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/Enums/PseudoType.cs b/CefSharp/DevTools/DOM/Enums/PseudoType.cs new file mode 100644 index 0000000000..478efd7e5b --- /dev/null +++ b/CefSharp/DevTools/DOM/Enums/PseudoType.cs @@ -0,0 +1,92 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// Pseudo element type. + /// + public enum PseudoType + { + /// + /// first-line + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("first-line"))] + FirstLine, + /// + /// first-letter + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("first-letter"))] + FirstLetter, + /// + /// before + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("before"))] + Before, + /// + /// after + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("after"))] + After, + /// + /// marker + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("marker"))] + Marker, + /// + /// backdrop + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("backdrop"))] + Backdrop, + /// + /// selection + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("selection"))] + Selection, + /// + /// first-line-inherited + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("first-line-inherited"))] + FirstLineInherited, + /// + /// scrollbar + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("scrollbar"))] + Scrollbar, + /// + /// scrollbar-thumb + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("scrollbar-thumb"))] + ScrollbarThumb, + /// + /// scrollbar-button + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("scrollbar-button"))] + ScrollbarButton, + /// + /// scrollbar-track + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("scrollbar-track"))] + ScrollbarTrack, + /// + /// scrollbar-track-piece + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("scrollbar-track-piece"))] + ScrollbarTrackPiece, + /// + /// scrollbar-corner + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("scrollbar-corner"))] + ScrollbarCorner, + /// + /// resizer + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("resizer"))] + Resizer, + /// + /// input-list-button + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("input-list-button"))] + InputListButton + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/Enums/ShadowRootType.cs b/CefSharp/DevTools/DOM/Enums/ShadowRootType.cs new file mode 100644 index 0000000000..1cb152952a --- /dev/null +++ b/CefSharp/DevTools/DOM/Enums/ShadowRootType.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// Shadow root type. + /// + public enum ShadowRootType + { + /// + /// user-agent + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("user-agent"))] + UserAgent, + /// + /// open + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("open"))] + Open, + /// + /// closed + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("closed"))] + Closed + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetAttributesResponse.cs b/CefSharp/DevTools/DOM/GetAttributesResponse.cs new file mode 100644 index 0000000000..a826ce3470 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetAttributesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetAttributesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetAttributesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] attributes + { + get; + set; + } + + /// + /// attributes + /// + public string[] Attributes + { + get + { + return attributes; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetBoxModelResponse.cs b/CefSharp/DevTools/DOM/GetBoxModelResponse.cs new file mode 100644 index 0000000000..d87ac0a5b5 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetBoxModelResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetBoxModelResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetBoxModelResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.DOM.BoxModel model + { + get; + set; + } + + /// + /// model + /// + public CefSharp.DevTools.DOM.BoxModel Model + { + get + { + return model; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetContentQuadsResponse.cs b/CefSharp/DevTools/DOM/GetContentQuadsResponse.cs new file mode 100644 index 0000000000..ddc3b526ef --- /dev/null +++ b/CefSharp/DevTools/DOM/GetContentQuadsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetContentQuadsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetContentQuadsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal long[] quads + { + get; + set; + } + + /// + /// quads + /// + public long[] Quads + { + get + { + return quads; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetDocumentResponse.cs b/CefSharp/DevTools/DOM/GetDocumentResponse.cs new file mode 100644 index 0000000000..3abbe0df79 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetDocumentResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetDocumentResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetDocumentResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.DOM.Node root + { + get; + set; + } + + /// + /// root + /// + public CefSharp.DevTools.DOM.Node Root + { + get + { + return root; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetFileInfoResponse.cs b/CefSharp/DevTools/DOM/GetFileInfoResponse.cs new file mode 100644 index 0000000000..8d155c2810 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetFileInfoResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetFileInfoResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetFileInfoResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string path + { + get; + set; + } + + /// + /// path + /// + public string Path + { + get + { + return path; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetFlattenedDocumentResponse.cs b/CefSharp/DevTools/DOM/GetFlattenedDocumentResponse.cs new file mode 100644 index 0000000000..f8b2884db8 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetFlattenedDocumentResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetFlattenedDocumentResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetFlattenedDocumentResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList nodes + { + get; + set; + } + + /// + /// nodes + /// + public System.Collections.Generic.IList Nodes + { + get + { + return nodes; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetFrameOwnerResponse.cs b/CefSharp/DevTools/DOM/GetFrameOwnerResponse.cs new file mode 100644 index 0000000000..d7e1b5b7de --- /dev/null +++ b/CefSharp/DevTools/DOM/GetFrameOwnerResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetFrameOwnerResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetFrameOwnerResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int backendNodeId + { + get; + set; + } + + /// + /// backendNodeId + /// + public int BackendNodeId + { + get + { + return backendNodeId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal int? nodeId + { + get; + set; + } + + /// + /// nodeId + /// + public int? NodeId + { + get + { + return nodeId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetNodeForLocationResponse.cs b/CefSharp/DevTools/DOM/GetNodeForLocationResponse.cs new file mode 100644 index 0000000000..e6eb1c5e18 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetNodeForLocationResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetNodeForLocationResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetNodeForLocationResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int backendNodeId + { + get; + set; + } + + /// + /// backendNodeId + /// + public int BackendNodeId + { + get + { + return backendNodeId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string frameId + { + get; + set; + } + + /// + /// frameId + /// + public string FrameId + { + get + { + return frameId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal int? nodeId + { + get; + set; + } + + /// + /// nodeId + /// + public int? NodeId + { + get + { + return nodeId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetNodeStackTracesResponse.cs b/CefSharp/DevTools/DOM/GetNodeStackTracesResponse.cs new file mode 100644 index 0000000000..ccc503ea33 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetNodeStackTracesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetNodeStackTracesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetNodeStackTracesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.StackTrace creation + { + get; + set; + } + + /// + /// creation + /// + public CefSharp.DevTools.Runtime.StackTrace Creation + { + get + { + return creation; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetOuterHTMLResponse.cs b/CefSharp/DevTools/DOM/GetOuterHTMLResponse.cs new file mode 100644 index 0000000000..b5628aada3 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetOuterHTMLResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetOuterHTMLResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetOuterHTMLResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string outerHTML + { + get; + set; + } + + /// + /// outerHTML + /// + public string OuterHTML + { + get + { + return outerHTML; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetRelayoutBoundaryResponse.cs b/CefSharp/DevTools/DOM/GetRelayoutBoundaryResponse.cs new file mode 100644 index 0000000000..451273a4b0 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetRelayoutBoundaryResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetRelayoutBoundaryResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetRelayoutBoundaryResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int nodeId + { + get; + set; + } + + /// + /// nodeId + /// + public int NodeId + { + get + { + return nodeId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/GetSearchResultsResponse.cs b/CefSharp/DevTools/DOM/GetSearchResultsResponse.cs new file mode 100644 index 0000000000..cbd96eee97 --- /dev/null +++ b/CefSharp/DevTools/DOM/GetSearchResultsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// GetSearchResultsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetSearchResultsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int[] nodeIds + { + get; + set; + } + + /// + /// nodeIds + /// + public int[] NodeIds + { + get + { + return nodeIds; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/MoveToResponse.cs b/CefSharp/DevTools/DOM/MoveToResponse.cs new file mode 100644 index 0000000000..d544618f61 --- /dev/null +++ b/CefSharp/DevTools/DOM/MoveToResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// MoveToResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class MoveToResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int nodeId + { + get; + set; + } + + /// + /// nodeId + /// + public int NodeId + { + get + { + return nodeId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/Node.cs b/CefSharp/DevTools/DOM/Node.cs new file mode 100644 index 0000000000..f4c4cdc3bf --- /dev/null +++ b/CefSharp/DevTools/DOM/Node.cs @@ -0,0 +1,321 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. + /// DOMNode is a base node mirror type. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Node : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Node identifier that is passed into the rest of the DOM messages as the `nodeId`. Backend + /// will only push node with given `id` once. It is aware of all requested nodes and will only + /// fire DOM events for nodes known to the client. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeId"), IsRequired = (true))] + public int NodeId + { + get; + set; + } + + /// + /// The id of the parent node if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("parentId"), IsRequired = (false))] + public int? ParentId + { + get; + set; + } + + /// + /// The BackendNodeId for this node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("backendNodeId"), IsRequired = (true))] + public int BackendNodeId + { + get; + set; + } + + /// + /// `Node`'s nodeType. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeType"), IsRequired = (true))] + public int NodeType + { + get; + set; + } + + /// + /// `Node`'s nodeName. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeName"), IsRequired = (true))] + public string NodeName + { + get; + set; + } + + /// + /// `Node`'s localName. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("localName"), IsRequired = (true))] + public string LocalName + { + get; + set; + } + + /// + /// `Node`'s nodeValue. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeValue"), IsRequired = (true))] + public string NodeValue + { + get; + set; + } + + /// + /// Child count for `Container` nodes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("childNodeCount"), IsRequired = (false))] + public int? ChildNodeCount + { + get; + set; + } + + /// + /// Child nodes of this node when requested with children. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("children"), IsRequired = (false))] + public System.Collections.Generic.IList Children + { + get; + set; + } + + /// + /// Attributes of the `Element` node in the form of flat array `[name1, value1, name2, value2]`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("attributes"), IsRequired = (false))] + public string[] Attributes + { + get; + set; + } + + /// + /// Document URL that `Document` or `FrameOwner` node points to. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("documentURL"), IsRequired = (false))] + public string DocumentURL + { + get; + set; + } + + /// + /// Base URL that `Document` or `FrameOwner` node uses for URL completion. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("baseURL"), IsRequired = (false))] + public string BaseURL + { + get; + set; + } + + /// + /// `DocumentType`'s publicId. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("publicId"), IsRequired = (false))] + public string PublicId + { + get; + set; + } + + /// + /// `DocumentType`'s systemId. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("systemId"), IsRequired = (false))] + public string SystemId + { + get; + set; + } + + /// + /// `DocumentType`'s internalSubset. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("internalSubset"), IsRequired = (false))] + public string InternalSubset + { + get; + set; + } + + /// + /// `Document`'s XML version in case of XML documents. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("xmlVersion"), IsRequired = (false))] + public string XmlVersion + { + get; + set; + } + + /// + /// `Attr`'s name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (false))] + public string Name + { + get; + set; + } + + /// + /// `Attr`'s value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public string Value + { + get; + set; + } + + public CefSharp.DevTools.DOM.PseudoType? PseudoType + { + get + { + return (CefSharp.DevTools.DOM.PseudoType? )(StringToEnum(typeof(CefSharp.DevTools.DOM.PseudoType? ), pseudoType)); + } + + set + { + pseudoType = (EnumToString(value)); + } + } + + /// + /// Pseudo element type for this node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pseudoType"), IsRequired = (false))] + internal string pseudoType + { + get; + set; + } + + public CefSharp.DevTools.DOM.ShadowRootType? ShadowRootType + { + get + { + return (CefSharp.DevTools.DOM.ShadowRootType? )(StringToEnum(typeof(CefSharp.DevTools.DOM.ShadowRootType? ), shadowRootType)); + } + + set + { + shadowRootType = (EnumToString(value)); + } + } + + /// + /// Shadow root type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("shadowRootType"), IsRequired = (false))] + internal string shadowRootType + { + get; + set; + } + + /// + /// Frame ID for frame owner elements. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frameId"), IsRequired = (false))] + public string FrameId + { + get; + set; + } + + /// + /// Content document for frame owner elements. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentDocument"), IsRequired = (false))] + public CefSharp.DevTools.DOM.Node ContentDocument + { + get; + set; + } + + /// + /// Shadow root list for given element host. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("shadowRoots"), IsRequired = (false))] + public System.Collections.Generic.IList ShadowRoots + { + get; + set; + } + + /// + /// Content document fragment for template elements. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("templateContent"), IsRequired = (false))] + public CefSharp.DevTools.DOM.Node TemplateContent + { + get; + set; + } + + /// + /// Pseudo elements associated with this node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pseudoElements"), IsRequired = (false))] + public System.Collections.Generic.IList PseudoElements + { + get; + set; + } + + /// + /// Import document for the HTMLImport links. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("importedDocument"), IsRequired = (false))] + public CefSharp.DevTools.DOM.Node ImportedDocument + { + get; + set; + } + + /// + /// Distributed nodes for given insertion point. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("distributedNodes"), IsRequired = (false))] + public System.Collections.Generic.IList DistributedNodes + { + get; + set; + } + + /// + /// Whether the node is SVG. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isSVG"), IsRequired = (false))] + public bool? IsSVG + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/PerformSearchResponse.cs b/CefSharp/DevTools/DOM/PerformSearchResponse.cs new file mode 100644 index 0000000000..818c8a8353 --- /dev/null +++ b/CefSharp/DevTools/DOM/PerformSearchResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// PerformSearchResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PerformSearchResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string searchId + { + get; + set; + } + + /// + /// searchId + /// + public string SearchId + { + get + { + return searchId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal int resultCount + { + get; + set; + } + + /// + /// resultCount + /// + public int ResultCount + { + get + { + return resultCount; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/PushNodeByPathToFrontendResponse.cs b/CefSharp/DevTools/DOM/PushNodeByPathToFrontendResponse.cs new file mode 100644 index 0000000000..81577f0c06 --- /dev/null +++ b/CefSharp/DevTools/DOM/PushNodeByPathToFrontendResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// PushNodeByPathToFrontendResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PushNodeByPathToFrontendResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int nodeId + { + get; + set; + } + + /// + /// nodeId + /// + public int NodeId + { + get + { + return nodeId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/PushNodesByBackendIdsToFrontendResponse.cs b/CefSharp/DevTools/DOM/PushNodesByBackendIdsToFrontendResponse.cs new file mode 100644 index 0000000000..76f4c169f1 --- /dev/null +++ b/CefSharp/DevTools/DOM/PushNodesByBackendIdsToFrontendResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// PushNodesByBackendIdsToFrontendResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PushNodesByBackendIdsToFrontendResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int[] nodeIds + { + get; + set; + } + + /// + /// nodeIds + /// + public int[] NodeIds + { + get + { + return nodeIds; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/QuerySelectorAllResponse.cs b/CefSharp/DevTools/DOM/QuerySelectorAllResponse.cs new file mode 100644 index 0000000000..a521484d63 --- /dev/null +++ b/CefSharp/DevTools/DOM/QuerySelectorAllResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// QuerySelectorAllResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class QuerySelectorAllResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int[] nodeIds + { + get; + set; + } + + /// + /// nodeIds + /// + public int[] NodeIds + { + get + { + return nodeIds; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/QuerySelectorResponse.cs b/CefSharp/DevTools/DOM/QuerySelectorResponse.cs new file mode 100644 index 0000000000..d98662b025 --- /dev/null +++ b/CefSharp/DevTools/DOM/QuerySelectorResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// QuerySelectorResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class QuerySelectorResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int nodeId + { + get; + set; + } + + /// + /// nodeId + /// + public int NodeId + { + get + { + return nodeId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/RGBA.cs b/CefSharp/DevTools/DOM/RGBA.cs new file mode 100644 index 0000000000..467ad18a88 --- /dev/null +++ b/CefSharp/DevTools/DOM/RGBA.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// A structure holding an RGBA color. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RGBA : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The red component, in the [0-255] range. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("r"), IsRequired = (true))] + public int R + { + get; + set; + } + + /// + /// The green component, in the [0-255] range. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("g"), IsRequired = (true))] + public int G + { + get; + set; + } + + /// + /// The blue component, in the [0-255] range. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("b"), IsRequired = (true))] + public int B + { + get; + set; + } + + /// + /// The alpha component, in the [0-1] range (default: 1). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("a"), IsRequired = (false))] + public long? A + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/Rect.cs b/CefSharp/DevTools/DOM/Rect.cs new file mode 100644 index 0000000000..74737cf519 --- /dev/null +++ b/CefSharp/DevTools/DOM/Rect.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// Rectangle. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Rect : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// X coordinate + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("x"), IsRequired = (true))] + public long X + { + get; + set; + } + + /// + /// Y coordinate + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("y"), IsRequired = (true))] + public long Y + { + get; + set; + } + + /// + /// Rectangle width + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("width"), IsRequired = (true))] + public long Width + { + get; + set; + } + + /// + /// Rectangle height + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("height"), IsRequired = (true))] + public long Height + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/RequestNodeResponse.cs b/CefSharp/DevTools/DOM/RequestNodeResponse.cs new file mode 100644 index 0000000000..d0fa181998 --- /dev/null +++ b/CefSharp/DevTools/DOM/RequestNodeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// RequestNodeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestNodeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int nodeId + { + get; + set; + } + + /// + /// nodeId + /// + public int NodeId + { + get + { + return nodeId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/ResolveNodeResponse.cs b/CefSharp/DevTools/DOM/ResolveNodeResponse.cs new file mode 100644 index 0000000000..833fceca03 --- /dev/null +++ b/CefSharp/DevTools/DOM/ResolveNodeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// ResolveNodeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ResolveNodeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject @object + { + get; + set; + } + + /// + /// object + /// + public CefSharp.DevTools.Runtime.RemoteObject Object + { + get + { + return @object; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/SetNodeNameResponse.cs b/CefSharp/DevTools/DOM/SetNodeNameResponse.cs new file mode 100644 index 0000000000..349daab146 --- /dev/null +++ b/CefSharp/DevTools/DOM/SetNodeNameResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// SetNodeNameResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetNodeNameResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int nodeId + { + get; + set; + } + + /// + /// nodeId + /// + public int NodeId + { + get + { + return nodeId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOM/ShapeOutsideInfo.cs b/CefSharp/DevTools/DOM/ShapeOutsideInfo.cs new file mode 100644 index 0000000000..004d3f00ff --- /dev/null +++ b/CefSharp/DevTools/DOM/ShapeOutsideInfo.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.DOM +{ + /// + /// CSS Shape Outside details. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ShapeOutsideInfo : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Shape bounds + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("bounds"), IsRequired = (true))] + public long[] Bounds + { + get; + set; + } + + /// + /// Shape coordinate details + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("shape"), IsRequired = (true))] + public object[] Shape + { + get; + set; + } + + /// + /// Margin shape bounds + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("marginShape"), IsRequired = (true))] + public object[] MarginShape + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMDebugger/DOMDebugger.cs b/CefSharp/DevTools/DOMDebugger/DOMDebugger.cs new file mode 100644 index 0000000000..1fe957fd16 --- /dev/null +++ b/CefSharp/DevTools/DOMDebugger/DOMDebugger.cs @@ -0,0 +1,180 @@ +// Copyright © 2020 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.DevTools.DOMDebugger +{ + using System.Linq; + + /// + /// DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript + /// execution will stop on these operations as if there was a regular breakpoint set. + /// + public partial class DOMDebugger : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public DOMDebugger(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateGetEventListeners(string objectId, int? depth = null, bool? pierce = null); + /// + /// Returns event listeners of the given object. + /// + /// Identifier of the object to return listeners for. + /// The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the + public async System.Threading.Tasks.Task GetEventListenersAsync(string objectId, int? depth = null, bool? pierce = null) + { + ValidateGetEventListeners(objectId, depth, pierce); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectId", objectId); + if (depth.HasValue) + { + dict.Add("depth", depth.Value); + } + + if (pierce.HasValue) + { + dict.Add("pierce", pierce.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMDebugger.getEventListeners", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateRemoveDOMBreakpoint(int nodeId, CefSharp.DevTools.DOMDebugger.DOMBreakpointType type); + /// + /// Removes DOM breakpoint that was set using `setDOMBreakpoint`. + /// + /// Identifier of the node to remove breakpoint from. + /// Type of the breakpoint to remove. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveDOMBreakpointAsync(int nodeId, CefSharp.DevTools.DOMDebugger.DOMBreakpointType type) + { + ValidateRemoveDOMBreakpoint(nodeId, type); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("type", this.EnumToString(type)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMDebugger.removeDOMBreakpoint", dict); + return methodResult; + } + + partial void ValidateRemoveEventListenerBreakpoint(string eventName, string targetName = null); + /// + /// Removes breakpoint on particular DOM event. + /// + /// Event name. + /// EventTarget interface name. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveEventListenerBreakpointAsync(string eventName, string targetName = null) + { + ValidateRemoveEventListenerBreakpoint(eventName, targetName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("eventName", eventName); + if (!(string.IsNullOrEmpty(targetName))) + { + dict.Add("targetName", targetName); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMDebugger.removeEventListenerBreakpoint", dict); + return methodResult; + } + + partial void ValidateRemoveInstrumentationBreakpoint(string eventName); + /// + /// Removes breakpoint on particular native event. + /// + /// Instrumentation name to stop on. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveInstrumentationBreakpointAsync(string eventName) + { + ValidateRemoveInstrumentationBreakpoint(eventName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("eventName", eventName); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMDebugger.removeInstrumentationBreakpoint", dict); + return methodResult; + } + + partial void ValidateRemoveXHRBreakpoint(string url); + /// + /// Removes breakpoint from XMLHttpRequest. + /// + /// Resource URL substring. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveXHRBreakpointAsync(string url) + { + ValidateRemoveXHRBreakpoint(url); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("url", url); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMDebugger.removeXHRBreakpoint", dict); + return methodResult; + } + + partial void ValidateSetDOMBreakpoint(int nodeId, CefSharp.DevTools.DOMDebugger.DOMBreakpointType type); + /// + /// Sets breakpoint on particular operation with DOM. + /// + /// Identifier of the node to set breakpoint on. + /// Type of the operation to stop upon. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetDOMBreakpointAsync(int nodeId, CefSharp.DevTools.DOMDebugger.DOMBreakpointType type) + { + ValidateSetDOMBreakpoint(nodeId, type); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + dict.Add("type", this.EnumToString(type)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMDebugger.setDOMBreakpoint", dict); + return methodResult; + } + + partial void ValidateSetEventListenerBreakpoint(string eventName, string targetName = null); + /// + /// Sets breakpoint on particular DOM event. + /// + /// DOM Event name to stop on (any DOM event will do). + /// EventTarget interface name to stop on. If equal to `"*"` or not provided, will stop on any + public async System.Threading.Tasks.Task SetEventListenerBreakpointAsync(string eventName, string targetName = null) + { + ValidateSetEventListenerBreakpoint(eventName, targetName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("eventName", eventName); + if (!(string.IsNullOrEmpty(targetName))) + { + dict.Add("targetName", targetName); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMDebugger.setEventListenerBreakpoint", dict); + return methodResult; + } + + partial void ValidateSetInstrumentationBreakpoint(string eventName); + /// + /// Sets breakpoint on particular native event. + /// + /// Instrumentation name to stop on. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetInstrumentationBreakpointAsync(string eventName) + { + ValidateSetInstrumentationBreakpoint(eventName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("eventName", eventName); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMDebugger.setInstrumentationBreakpoint", dict); + return methodResult; + } + + partial void ValidateSetXHRBreakpoint(string url); + /// + /// Sets breakpoint on XMLHttpRequest. + /// + /// Resource URL substring. All XHRs having this substring in the URL will get stopped upon. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetXHRBreakpointAsync(string url) + { + ValidateSetXHRBreakpoint(url); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("url", url); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMDebugger.setXHRBreakpoint", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMDebugger/Enums/DOMBreakpointType.cs b/CefSharp/DevTools/DOMDebugger/Enums/DOMBreakpointType.cs new file mode 100644 index 0000000000..acef5d3276 --- /dev/null +++ b/CefSharp/DevTools/DOMDebugger/Enums/DOMBreakpointType.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.DOMDebugger +{ + /// + /// DOM breakpoint type. + /// + public enum DOMBreakpointType + { + /// + /// subtree-modified + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("subtree-modified"))] + SubtreeModified, + /// + /// attribute-modified + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("attribute-modified"))] + AttributeModified, + /// + /// node-removed + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("node-removed"))] + NodeRemoved + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMDebugger/EventListener.cs b/CefSharp/DevTools/DOMDebugger/EventListener.cs new file mode 100644 index 0000000000..1c4f86a267 --- /dev/null +++ b/CefSharp/DevTools/DOMDebugger/EventListener.cs @@ -0,0 +1,112 @@ +// Copyright © 2020 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.DevTools.DOMDebugger +{ + /// + /// Object event listener. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class EventListener : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// `EventListener`'s type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// `EventListener`'s useCapture. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("useCapture"), IsRequired = (true))] + public bool UseCapture + { + get; + set; + } + + /// + /// `EventListener`'s passive flag. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("passive"), IsRequired = (true))] + public bool Passive + { + get; + set; + } + + /// + /// `EventListener`'s once flag. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("once"), IsRequired = (true))] + public bool Once + { + get; + set; + } + + /// + /// Script id of the handler code. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptId"), IsRequired = (true))] + public string ScriptId + { + get; + set; + } + + /// + /// Line number in the script (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (true))] + public int LineNumber + { + get; + set; + } + + /// + /// Column number in the script (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("columnNumber"), IsRequired = (true))] + public int ColumnNumber + { + get; + set; + } + + /// + /// Event handler function value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("handler"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Handler + { + get; + set; + } + + /// + /// Event original handler function value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("originalHandler"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject OriginalHandler + { + get; + set; + } + + /// + /// Node the listener is added to (if any). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("backendNodeId"), IsRequired = (false))] + public int? BackendNodeId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMDebugger/GetEventListenersResponse.cs b/CefSharp/DevTools/DOMDebugger/GetEventListenersResponse.cs new file mode 100644 index 0000000000..c0403ed585 --- /dev/null +++ b/CefSharp/DevTools/DOMDebugger/GetEventListenersResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOMDebugger +{ + /// + /// GetEventListenersResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetEventListenersResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList listeners + { + get; + set; + } + + /// + /// listeners + /// + public System.Collections.Generic.IList Listeners + { + get + { + return listeners; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/CaptureSnapshotResponse.cs b/CefSharp/DevTools/DOMSnapshot/CaptureSnapshotResponse.cs new file mode 100644 index 0000000000..6e6542cb6e --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/CaptureSnapshotResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// CaptureSnapshotResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CaptureSnapshotResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList documents + { + get; + set; + } + + /// + /// documents + /// + public System.Collections.Generic.IList Documents + { + get + { + return documents; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] strings + { + get; + set; + } + + /// + /// strings + /// + public string[] Strings + { + get + { + return strings; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/ComputedStyle.cs b/CefSharp/DevTools/DOMSnapshot/ComputedStyle.cs new file mode 100644 index 0000000000..27b67f4e16 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/ComputedStyle.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// A subset of the full ComputedStyle as defined by the request whitelist. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ComputedStyle : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name/value pairs of computed style properties. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("properties"), IsRequired = (true))] + public System.Collections.Generic.IList Properties + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/DOMNode.cs b/CefSharp/DevTools/DOMSnapshot/DOMNode.cs new file mode 100644 index 0000000000..11bde8c080 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/DOMNode.cs @@ -0,0 +1,324 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// A Node in the DOM tree. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class DOMNode : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// `Node`'s nodeType. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeType"), IsRequired = (true))] + public int NodeType + { + get; + set; + } + + /// + /// `Node`'s nodeName. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeName"), IsRequired = (true))] + public string NodeName + { + get; + set; + } + + /// + /// `Node`'s nodeValue. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeValue"), IsRequired = (true))] + public string NodeValue + { + get; + set; + } + + /// + /// Only set for textarea elements, contains the text value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("textValue"), IsRequired = (false))] + public string TextValue + { + get; + set; + } + + /// + /// Only set for input elements, contains the input's associated text value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("inputValue"), IsRequired = (false))] + public string InputValue + { + get; + set; + } + + /// + /// Only set for radio and checkbox input elements, indicates if the element has been checked + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("inputChecked"), IsRequired = (false))] + public bool? InputChecked + { + get; + set; + } + + /// + /// Only set for option elements, indicates if the element has been selected + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("optionSelected"), IsRequired = (false))] + public bool? OptionSelected + { + get; + set; + } + + /// + /// `Node`'s id, corresponds to DOM.Node.backendNodeId. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("backendNodeId"), IsRequired = (true))] + public int BackendNodeId + { + get; + set; + } + + /// + /// The indexes of the node's child nodes in the `domNodes` array returned by `getSnapshot`, if + /// any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("childNodeIndexes"), IsRequired = (false))] + public int[] ChildNodeIndexes + { + get; + set; + } + + /// + /// Attributes of an `Element` node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("attributes"), IsRequired = (false))] + public System.Collections.Generic.IList Attributes + { + get; + set; + } + + /// + /// Indexes of pseudo elements associated with this node in the `domNodes` array returned by + /// `getSnapshot`, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pseudoElementIndexes"), IsRequired = (false))] + public int[] PseudoElementIndexes + { + get; + set; + } + + /// + /// The index of the node's related layout tree node in the `layoutTreeNodes` array returned by + /// `getSnapshot`, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("layoutNodeIndex"), IsRequired = (false))] + public int? LayoutNodeIndex + { + get; + set; + } + + /// + /// Document URL that `Document` or `FrameOwner` node points to. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("documentURL"), IsRequired = (false))] + public string DocumentURL + { + get; + set; + } + + /// + /// Base URL that `Document` or `FrameOwner` node uses for URL completion. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("baseURL"), IsRequired = (false))] + public string BaseURL + { + get; + set; + } + + /// + /// Only set for documents, contains the document's content language. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentLanguage"), IsRequired = (false))] + public string ContentLanguage + { + get; + set; + } + + /// + /// Only set for documents, contains the document's character set encoding. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("documentEncoding"), IsRequired = (false))] + public string DocumentEncoding + { + get; + set; + } + + /// + /// `DocumentType` node's publicId. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("publicId"), IsRequired = (false))] + public string PublicId + { + get; + set; + } + + /// + /// `DocumentType` node's systemId. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("systemId"), IsRequired = (false))] + public string SystemId + { + get; + set; + } + + /// + /// Frame ID for frame owner elements and also for the document node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frameId"), IsRequired = (false))] + public string FrameId + { + get; + set; + } + + /// + /// The index of a frame owner element's content document in the `domNodes` array returned by + /// `getSnapshot`, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentDocumentIndex"), IsRequired = (false))] + public int? ContentDocumentIndex + { + get; + set; + } + + public CefSharp.DevTools.DOM.PseudoType? PseudoType + { + get + { + return (CefSharp.DevTools.DOM.PseudoType? )(StringToEnum(typeof(CefSharp.DevTools.DOM.PseudoType? ), pseudoType)); + } + + set + { + pseudoType = (EnumToString(value)); + } + } + + /// + /// Type of a pseudo element node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pseudoType"), IsRequired = (false))] + internal string pseudoType + { + get; + set; + } + + public CefSharp.DevTools.DOM.ShadowRootType? ShadowRootType + { + get + { + return (CefSharp.DevTools.DOM.ShadowRootType? )(StringToEnum(typeof(CefSharp.DevTools.DOM.ShadowRootType? ), shadowRootType)); + } + + set + { + shadowRootType = (EnumToString(value)); + } + } + + /// + /// Shadow root type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("shadowRootType"), IsRequired = (false))] + internal string shadowRootType + { + get; + set; + } + + /// + /// Whether this DOM node responds to mouse clicks. This includes nodes that have had click + /// event listeners attached via JavaScript as well as anchor tags that naturally navigate when + /// clicked. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isClickable"), IsRequired = (false))] + public bool? IsClickable + { + get; + set; + } + + /// + /// Details of the node's event listeners, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("eventListeners"), IsRequired = (false))] + public System.Collections.Generic.IList EventListeners + { + get; + set; + } + + /// + /// The selected url for nodes with a srcset attribute. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("currentSourceURL"), IsRequired = (false))] + public string CurrentSourceURL + { + get; + set; + } + + /// + /// The url of the script (if any) that generates this node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("originURL"), IsRequired = (false))] + public string OriginURL + { + get; + set; + } + + /// + /// Scroll offsets, set when this node is a Document. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scrollOffsetX"), IsRequired = (false))] + public long? ScrollOffsetX + { + get; + set; + } + + /// + /// ScrollOffsetY + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scrollOffsetY"), IsRequired = (false))] + public long? ScrollOffsetY + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/DOMSnapshot.cs b/CefSharp/DevTools/DOMSnapshot/DOMSnapshot.cs new file mode 100644 index 0000000000..f166249c39 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/DOMSnapshot.cs @@ -0,0 +1,71 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + using System.Linq; + + /// + /// This domain facilitates obtaining document snapshots with DOM, layout, and style information. + /// + public partial class DOMSnapshot : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public DOMSnapshot(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disables DOM snapshot agent for the given page. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMSnapshot.disable", dict); + return methodResult; + } + + /// + /// Enables DOM snapshot agent for the given page. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMSnapshot.enable", dict); + return methodResult; + } + + partial void ValidateCaptureSnapshot(string[] computedStyles, bool? includePaintOrder = null, bool? includeDOMRects = null); + /// + /// Returns a document snapshot, including the full DOM tree of the root node (including iframes, + /// template contents, and imported documents) in a flattened array, as well as layout and + /// white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is + /// flattened. + /// + /// Whitelist of computed styles to return. + /// Whether to include layout object paint orders into the snapshot. + /// Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot + /// returns System.Threading.Tasks.Task<CaptureSnapshotResponse> + public async System.Threading.Tasks.Task CaptureSnapshotAsync(string[] computedStyles, bool? includePaintOrder = null, bool? includeDOMRects = null) + { + ValidateCaptureSnapshot(computedStyles, includePaintOrder, includeDOMRects); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("computedStyles", computedStyles); + if (includePaintOrder.HasValue) + { + dict.Add("includePaintOrder", includePaintOrder.Value); + } + + if (includeDOMRects.HasValue) + { + dict.Add("includeDOMRects", includeDOMRects.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMSnapshot.captureSnapshot", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/DocumentSnapshot.cs b/CefSharp/DevTools/DOMSnapshot/DocumentSnapshot.cs new file mode 100644 index 0000000000..ee9e7991a3 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/DocumentSnapshot.cs @@ -0,0 +1,162 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// Document snapshot. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class DocumentSnapshot : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Document URL that `Document` or `FrameOwner` node points to. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("documentURL"), IsRequired = (true))] + public int DocumentURL + { + get; + set; + } + + /// + /// Document title. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("title"), IsRequired = (true))] + public int Title + { + get; + set; + } + + /// + /// Base URL that `Document` or `FrameOwner` node uses for URL completion. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("baseURL"), IsRequired = (true))] + public int BaseURL + { + get; + set; + } + + /// + /// Contains the document's content language. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentLanguage"), IsRequired = (true))] + public int ContentLanguage + { + get; + set; + } + + /// + /// Contains the document's character set encoding. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("encodingName"), IsRequired = (true))] + public int EncodingName + { + get; + set; + } + + /// + /// `DocumentType` node's publicId. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("publicId"), IsRequired = (true))] + public int PublicId + { + get; + set; + } + + /// + /// `DocumentType` node's systemId. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("systemId"), IsRequired = (true))] + public int SystemId + { + get; + set; + } + + /// + /// Frame ID for frame owner elements and also for the document node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frameId"), IsRequired = (true))] + public int FrameId + { + get; + set; + } + + /// + /// A table with dom nodes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodes"), IsRequired = (true))] + public CefSharp.DevTools.DOMSnapshot.NodeTreeSnapshot Nodes + { + get; + set; + } + + /// + /// The nodes in the layout tree. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("layout"), IsRequired = (true))] + public CefSharp.DevTools.DOMSnapshot.LayoutTreeSnapshot Layout + { + get; + set; + } + + /// + /// The post-layout inline text nodes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("textBoxes"), IsRequired = (true))] + public CefSharp.DevTools.DOMSnapshot.TextBoxSnapshot TextBoxes + { + get; + set; + } + + /// + /// Horizontal scroll offset. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scrollOffsetX"), IsRequired = (false))] + public long? ScrollOffsetX + { + get; + set; + } + + /// + /// Vertical scroll offset. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scrollOffsetY"), IsRequired = (false))] + public long? ScrollOffsetY + { + get; + set; + } + + /// + /// Document content width. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentWidth"), IsRequired = (false))] + public long? ContentWidth + { + get; + set; + } + + /// + /// Document content height. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentHeight"), IsRequired = (false))] + public long? ContentHeight + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/InlineTextBox.cs b/CefSharp/DevTools/DOMSnapshot/InlineTextBox.cs new file mode 100644 index 0000000000..1af9f34e06 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/InlineTextBox.cs @@ -0,0 +1,45 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// Details of post layout rendered text positions. The exact layout should not be regarded as + /// stable and may change between versions. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class InlineTextBox : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The bounding box in document coordinates. Note that scroll offset of the document is ignored. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("boundingBox"), IsRequired = (true))] + public CefSharp.DevTools.DOM.Rect BoundingBox + { + get; + set; + } + + /// + /// The starting index in characters, for this post layout textbox substring. Characters that + /// would be represented as a surrogate pair in UTF-16 have length 2. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("startCharacterIndex"), IsRequired = (true))] + public int StartCharacterIndex + { + get; + set; + } + + /// + /// The number of characters in this post layout textbox substring. Characters that would be + /// represented as a surrogate pair in UTF-16 have length 2. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("numCharacters"), IsRequired = (true))] + public int NumCharacters + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/LayoutTreeNode.cs b/CefSharp/DevTools/DOMSnapshot/LayoutTreeNode.cs new file mode 100644 index 0000000000..e668474168 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/LayoutTreeNode.cs @@ -0,0 +1,84 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// Details of an element in the DOM tree with a LayoutObject. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class LayoutTreeNode : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The index of the related DOM node in the `domNodes` array returned by `getSnapshot`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("domNodeIndex"), IsRequired = (true))] + public int DomNodeIndex + { + get; + set; + } + + /// + /// The bounding box in document coordinates. Note that scroll offset of the document is ignored. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("boundingBox"), IsRequired = (true))] + public CefSharp.DevTools.DOM.Rect BoundingBox + { + get; + set; + } + + /// + /// Contents of the LayoutText, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("layoutText"), IsRequired = (false))] + public string LayoutText + { + get; + set; + } + + /// + /// The post-layout inline text nodes, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("inlineTextNodes"), IsRequired = (false))] + public System.Collections.Generic.IList InlineTextNodes + { + get; + set; + } + + /// + /// Index into the `computedStyles` array returned by `getSnapshot`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("styleIndex"), IsRequired = (false))] + public int? StyleIndex + { + get; + set; + } + + /// + /// Global paint order index, which is determined by the stacking order of the nodes. Nodes + /// that are painted together will have the same index. Only provided if includePaintOrder in + /// getSnapshot was true. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("paintOrder"), IsRequired = (false))] + public int? PaintOrder + { + get; + set; + } + + /// + /// Set to true to indicate the element begins a new stacking context. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isStackingContext"), IsRequired = (false))] + public bool? IsStackingContext + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/LayoutTreeSnapshot.cs b/CefSharp/DevTools/DOMSnapshot/LayoutTreeSnapshot.cs new file mode 100644 index 0000000000..c6508ff818 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/LayoutTreeSnapshot.cs @@ -0,0 +1,104 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// Table of details of an element in the DOM tree with a LayoutObject. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class LayoutTreeSnapshot : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Index of the corresponding node in the `NodeTreeSnapshot` array returned by `captureSnapshot`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeIndex"), IsRequired = (true))] + public int[] NodeIndex + { + get; + set; + } + + /// + /// Array of indexes specifying computed style strings, filtered according to the `computedStyles` parameter passed to `captureSnapshot`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("styles"), IsRequired = (true))] + public int[] Styles + { + get; + set; + } + + /// + /// The absolute position bounding box. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("bounds"), IsRequired = (true))] + public long[] Bounds + { + get; + set; + } + + /// + /// Contents of the LayoutText, if any. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("text"), IsRequired = (true))] + public int[] Text + { + get; + set; + } + + /// + /// Stacking context information. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("stackingContexts"), IsRequired = (true))] + public CefSharp.DevTools.DOMSnapshot.RareBooleanData StackingContexts + { + get; + set; + } + + /// + /// Global paint order index, which is determined by the stacking order of the nodes. Nodes + /// that are painted together will have the same index. Only provided if includePaintOrder in + /// captureSnapshot was true. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("paintOrders"), IsRequired = (false))] + public int[] PaintOrders + { + get; + set; + } + + /// + /// The offset rect of nodes. Only available when includeDOMRects is set to true + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("offsetRects"), IsRequired = (false))] + public long[] OffsetRects + { + get; + set; + } + + /// + /// The scroll rect of nodes. Only available when includeDOMRects is set to true + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scrollRects"), IsRequired = (false))] + public long[] ScrollRects + { + get; + set; + } + + /// + /// The client rect of nodes. Only available when includeDOMRects is set to true + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("clientRects"), IsRequired = (false))] + public long[] ClientRects + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/NameValue.cs b/CefSharp/DevTools/DOMSnapshot/NameValue.cs new file mode 100644 index 0000000000..fd5c853430 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/NameValue.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// A name/value pair. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class NameValue : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Attribute/property name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Attribute/property value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/NodeTreeSnapshot.cs b/CefSharp/DevTools/DOMSnapshot/NodeTreeSnapshot.cs new file mode 100644 index 0000000000..255a99efea --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/NodeTreeSnapshot.cs @@ -0,0 +1,164 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// Table containing nodes. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class NodeTreeSnapshot : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Parent node index. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("parentIndex"), IsRequired = (false))] + public int[] ParentIndex + { + get; + set; + } + + /// + /// `Node`'s nodeType. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeType"), IsRequired = (false))] + public int[] NodeType + { + get; + set; + } + + /// + /// `Node`'s nodeName. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeName"), IsRequired = (false))] + public int[] NodeName + { + get; + set; + } + + /// + /// `Node`'s nodeValue. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeValue"), IsRequired = (false))] + public int[] NodeValue + { + get; + set; + } + + /// + /// `Node`'s id, corresponds to DOM.Node.backendNodeId. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("backendNodeId"), IsRequired = (false))] + public int[] BackendNodeId + { + get; + set; + } + + /// + /// Attributes of an `Element` node. Flatten name, value pairs. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("attributes"), IsRequired = (false))] + public int[] Attributes + { + get; + set; + } + + /// + /// Only set for textarea elements, contains the text value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("textValue"), IsRequired = (false))] + public CefSharp.DevTools.DOMSnapshot.RareStringData TextValue + { + get; + set; + } + + /// + /// Only set for input elements, contains the input's associated text value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("inputValue"), IsRequired = (false))] + public CefSharp.DevTools.DOMSnapshot.RareStringData InputValue + { + get; + set; + } + + /// + /// Only set for radio and checkbox input elements, indicates if the element has been checked + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("inputChecked"), IsRequired = (false))] + public CefSharp.DevTools.DOMSnapshot.RareBooleanData InputChecked + { + get; + set; + } + + /// + /// Only set for option elements, indicates if the element has been selected + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("optionSelected"), IsRequired = (false))] + public CefSharp.DevTools.DOMSnapshot.RareBooleanData OptionSelected + { + get; + set; + } + + /// + /// The index of the document in the list of the snapshot documents. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentDocumentIndex"), IsRequired = (false))] + public CefSharp.DevTools.DOMSnapshot.RareIntegerData ContentDocumentIndex + { + get; + set; + } + + /// + /// Type of a pseudo element node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pseudoType"), IsRequired = (false))] + public CefSharp.DevTools.DOMSnapshot.RareStringData PseudoType + { + get; + set; + } + + /// + /// Whether this DOM node responds to mouse clicks. This includes nodes that have had click + /// event listeners attached via JavaScript as well as anchor tags that naturally navigate when + /// clicked. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isClickable"), IsRequired = (false))] + public CefSharp.DevTools.DOMSnapshot.RareBooleanData IsClickable + { + get; + set; + } + + /// + /// The selected url for nodes with a srcset attribute. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("currentSourceURL"), IsRequired = (false))] + public CefSharp.DevTools.DOMSnapshot.RareStringData CurrentSourceURL + { + get; + set; + } + + /// + /// The url of the script (if any) that generates this node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("originURL"), IsRequired = (false))] + public CefSharp.DevTools.DOMSnapshot.RareStringData OriginURL + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/RareBooleanData.cs b/CefSharp/DevTools/DOMSnapshot/RareBooleanData.cs new file mode 100644 index 0000000000..15a390d69e --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/RareBooleanData.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// RareBooleanData + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RareBooleanData : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Index + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("index"), IsRequired = (true))] + public int[] Index + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/RareIntegerData.cs b/CefSharp/DevTools/DOMSnapshot/RareIntegerData.cs new file mode 100644 index 0000000000..f7aea9e204 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/RareIntegerData.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// RareIntegerData + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RareIntegerData : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Index + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("index"), IsRequired = (true))] + public int[] Index + { + get; + set; + } + + /// + /// Value + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public int[] Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/RareStringData.cs b/CefSharp/DevTools/DOMSnapshot/RareStringData.cs new file mode 100644 index 0000000000..78b24b183b --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/RareStringData.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// Data that is only present on rare nodes. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RareStringData : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Index + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("index"), IsRequired = (true))] + public int[] Index + { + get; + set; + } + + /// + /// Value + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public int[] Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMSnapshot/TextBoxSnapshot.cs b/CefSharp/DevTools/DOMSnapshot/TextBoxSnapshot.cs new file mode 100644 index 0000000000..ed4a661783 --- /dev/null +++ b/CefSharp/DevTools/DOMSnapshot/TextBoxSnapshot.cs @@ -0,0 +1,55 @@ +// Copyright © 2020 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.DevTools.DOMSnapshot +{ + /// + /// Table of details of the post layout rendered text positions. The exact layout should not be regarded as + /// stable and may change between versions. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TextBoxSnapshot : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Index of the layout tree node that owns this box collection. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("layoutIndex"), IsRequired = (true))] + public int[] LayoutIndex + { + get; + set; + } + + /// + /// The absolute position bounding box. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("bounds"), IsRequired = (true))] + public long[] Bounds + { + get; + set; + } + + /// + /// The starting index in characters, for this post layout textbox substring. Characters that + /// would be represented as a surrogate pair in UTF-16 have length 2. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("start"), IsRequired = (true))] + public int[] Start + { + get; + set; + } + + /// + /// The number of characters in this post layout textbox substring. Characters that would be + /// represented as a surrogate pair in UTF-16 have length 2. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("length"), IsRequired = (true))] + public int[] Length + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMStorage/DOMStorage.cs b/CefSharp/DevTools/DOMStorage/DOMStorage.cs new file mode 100644 index 0000000000..ac08db32d4 --- /dev/null +++ b/CefSharp/DevTools/DOMStorage/DOMStorage.cs @@ -0,0 +1,107 @@ +// Copyright © 2020 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.DevTools.DOMStorage +{ + using System.Linq; + + /// + /// Query and modify DOM storage. + /// + public partial class DOMStorage : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public DOMStorage(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateClear(CefSharp.DevTools.DOMStorage.StorageId storageId); + /// + /// Clear + /// + /// storageId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearAsync(CefSharp.DevTools.DOMStorage.StorageId storageId) + { + ValidateClear(storageId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("storageId", storageId.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMStorage.clear", dict); + return methodResult; + } + + /// + /// Disables storage tracking, prevents storage events from being sent to the client. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMStorage.disable", dict); + return methodResult; + } + + /// + /// Enables storage tracking, storage events will now be delivered to the client. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMStorage.enable", dict); + return methodResult; + } + + partial void ValidateGetDOMStorageItems(CefSharp.DevTools.DOMStorage.StorageId storageId); + /// + /// GetDOMStorageItems + /// + /// storageId + /// returns System.Threading.Tasks.Task<GetDOMStorageItemsResponse> + public async System.Threading.Tasks.Task GetDOMStorageItemsAsync(CefSharp.DevTools.DOMStorage.StorageId storageId) + { + ValidateGetDOMStorageItems(storageId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("storageId", storageId.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMStorage.getDOMStorageItems", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateRemoveDOMStorageItem(CefSharp.DevTools.DOMStorage.StorageId storageId, string key); + /// + /// RemoveDOMStorageItem + /// + /// storageId + /// key + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveDOMStorageItemAsync(CefSharp.DevTools.DOMStorage.StorageId storageId, string key) + { + ValidateRemoveDOMStorageItem(storageId, key); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("storageId", storageId.ToDictionary()); + dict.Add("key", key); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMStorage.removeDOMStorageItem", dict); + return methodResult; + } + + partial void ValidateSetDOMStorageItem(CefSharp.DevTools.DOMStorage.StorageId storageId, string key, string value); + /// + /// SetDOMStorageItem + /// + /// storageId + /// key + /// value + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetDOMStorageItemAsync(CefSharp.DevTools.DOMStorage.StorageId storageId, string key, string value) + { + ValidateSetDOMStorageItem(storageId, key, value); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("storageId", storageId.ToDictionary()); + dict.Add("key", key); + dict.Add("value", value); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DOMStorage.setDOMStorageItem", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMStorage/GetDOMStorageItemsResponse.cs b/CefSharp/DevTools/DOMStorage/GetDOMStorageItemsResponse.cs new file mode 100644 index 0000000000..9fa83dac0a --- /dev/null +++ b/CefSharp/DevTools/DOMStorage/GetDOMStorageItemsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.DOMStorage +{ + /// + /// GetDOMStorageItemsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetDOMStorageItemsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] entries + { + get; + set; + } + + /// + /// entries + /// + public string[] Entries + { + get + { + return entries; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DOMStorage/StorageId.cs b/CefSharp/DevTools/DOMStorage/StorageId.cs new file mode 100644 index 0000000000..13312a5dee --- /dev/null +++ b/CefSharp/DevTools/DOMStorage/StorageId.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.DOMStorage +{ + /// + /// DOM Storage identifier. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class StorageId : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Security origin for the storage. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("securityOrigin"), IsRequired = (true))] + public string SecurityOrigin + { + get; + set; + } + + /// + /// Whether the storage is local storage (not session storage). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isLocalStorage"), IsRequired = (true))] + public bool IsLocalStorage + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Database/Database.cs b/CefSharp/DevTools/Database/Database.cs new file mode 100644 index 0000000000..1bbccf551a --- /dev/null +++ b/CefSharp/DevTools/Database/Database.cs @@ -0,0 +1,73 @@ +// Copyright © 2020 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.DevTools.Database +{ + using System.Linq; + + /// + /// Database + /// + public partial class Database : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Database(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disables database tracking, prevents database events from being sent to the client. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Database.disable", dict); + return methodResult; + } + + /// + /// Enables database tracking, database events will now be delivered to the client. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Database.enable", dict); + return methodResult; + } + + partial void ValidateExecuteSQL(string databaseId, string query); + /// + /// ExecuteSQL + /// + /// databaseId + /// query + /// returns System.Threading.Tasks.Task<ExecuteSQLResponse> + public async System.Threading.Tasks.Task ExecuteSQLAsync(string databaseId, string query) + { + ValidateExecuteSQL(databaseId, query); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseId", databaseId); + dict.Add("query", query); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Database.executeSQL", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetDatabaseTableNames(string databaseId); + /// + /// GetDatabaseTableNames + /// + /// databaseId + /// returns System.Threading.Tasks.Task<GetDatabaseTableNamesResponse> + public async System.Threading.Tasks.Task GetDatabaseTableNamesAsync(string databaseId) + { + ValidateGetDatabaseTableNames(databaseId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("databaseId", databaseId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Database.getDatabaseTableNames", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Database/Error.cs b/CefSharp/DevTools/Database/Error.cs new file mode 100644 index 0000000000..998db6470e --- /dev/null +++ b/CefSharp/DevTools/Database/Error.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Database +{ + /// + /// Database error. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Error : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Error message. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("message"), IsRequired = (true))] + public string Message + { + get; + set; + } + + /// + /// Error code. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("code"), IsRequired = (true))] + public int Code + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Database/ExecuteSQLResponse.cs b/CefSharp/DevTools/Database/ExecuteSQLResponse.cs new file mode 100644 index 0000000000..708d5164fb --- /dev/null +++ b/CefSharp/DevTools/Database/ExecuteSQLResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.Database +{ + /// + /// ExecuteSQLResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ExecuteSQLResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] columnNames + { + get; + set; + } + + /// + /// columnNames + /// + public string[] ColumnNames + { + get + { + return columnNames; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal object[] values + { + get; + set; + } + + /// + /// values + /// + public object[] Values + { + get + { + return values; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Database.Error sqlError + { + get; + set; + } + + /// + /// sqlError + /// + public CefSharp.DevTools.Database.Error SqlError + { + get + { + return sqlError; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Database/GetDatabaseTableNamesResponse.cs b/CefSharp/DevTools/Database/GetDatabaseTableNamesResponse.cs new file mode 100644 index 0000000000..54b04323ea --- /dev/null +++ b/CefSharp/DevTools/Database/GetDatabaseTableNamesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Database +{ + /// + /// GetDatabaseTableNamesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetDatabaseTableNamesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] tableNames + { + get; + set; + } + + /// + /// tableNames + /// + public string[] TableNames + { + get + { + return tableNames; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/BreakLocation.cs b/CefSharp/DevTools/Debugger/BreakLocation.cs new file mode 100644 index 0000000000..d3c23f1cb8 --- /dev/null +++ b/CefSharp/DevTools/Debugger/BreakLocation.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// BreakLocation + /// + [System.Runtime.Serialization.DataContractAttribute] + public class BreakLocation : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Script identifier as reported in the `Debugger.scriptParsed`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptId"), IsRequired = (true))] + public string ScriptId + { + get; + set; + } + + /// + /// Line number in the script (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (true))] + public int LineNumber + { + get; + set; + } + + /// + /// Column number in the script (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("columnNumber"), IsRequired = (false))] + public int? ColumnNumber + { + get; + set; + } + + /// + /// Type + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (false))] + public string Type + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/CallFrame.cs b/CefSharp/DevTools/Debugger/CallFrame.cs new file mode 100644 index 0000000000..b67a8b5080 --- /dev/null +++ b/CefSharp/DevTools/Debugger/CallFrame.cs @@ -0,0 +1,92 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// JavaScript call frame. Array of call frames form the call stack. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CallFrame : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Call frame identifier. This identifier is only valid while the virtual machine is paused. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("callFrameId"), IsRequired = (true))] + public string CallFrameId + { + get; + set; + } + + /// + /// Name of the JavaScript function called on this call frame. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("functionName"), IsRequired = (true))] + public string FunctionName + { + get; + set; + } + + /// + /// Location in the source code. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("functionLocation"), IsRequired = (false))] + public CefSharp.DevTools.Debugger.Location FunctionLocation + { + get; + set; + } + + /// + /// Location in the source code. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("location"), IsRequired = (true))] + public CefSharp.DevTools.Debugger.Location Location + { + get; + set; + } + + /// + /// JavaScript script name or url. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// Scope chain for this call frame. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scopeChain"), IsRequired = (true))] + public System.Collections.Generic.IList ScopeChain + { + get; + set; + } + + /// + /// `this` object for this call frame. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("this"), IsRequired = (true))] + public CefSharp.DevTools.Runtime.RemoteObject This + { + get; + set; + } + + /// + /// The value being returned, if the function is at return point. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("returnValue"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject ReturnValue + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/DebugSymbols.cs b/CefSharp/DevTools/Debugger/DebugSymbols.cs new file mode 100644 index 0000000000..9d1483f8b0 --- /dev/null +++ b/CefSharp/DevTools/Debugger/DebugSymbols.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// Debug symbols available for a wasm script. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class DebugSymbols : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Type of the debug symbols. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// URL of the external symbol source. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("externalURL"), IsRequired = (false))] + public string ExternalURL + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/Debugger.cs b/CefSharp/DevTools/Debugger/Debugger.cs new file mode 100644 index 0000000000..a5f7aca84f --- /dev/null +++ b/CefSharp/DevTools/Debugger/Debugger.cs @@ -0,0 +1,583 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + using System.Linq; + + /// + /// Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing + /// breakpoints, stepping through execution, exploring stack traces, etc. + /// + public partial class Debugger : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Debugger(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateContinueToLocation(CefSharp.DevTools.Debugger.Location location, string targetCallFrames = null); + /// + /// Continues execution until specific location is reached. + /// + /// Location to continue to. + /// targetCallFrames + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ContinueToLocationAsync(CefSharp.DevTools.Debugger.Location location, string targetCallFrames = null) + { + ValidateContinueToLocation(location, targetCallFrames); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("location", location.ToDictionary()); + if (!(string.IsNullOrEmpty(targetCallFrames))) + { + dict.Add("targetCallFrames", targetCallFrames); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.continueToLocation", dict); + return methodResult; + } + + /// + /// Disables debugger for given page. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.disable", dict); + return methodResult; + } + + partial void ValidateEnable(long? maxScriptsCacheSize = null); + /// + /// Enables debugger for the given page. Clients should not assume that the debugging has been + /// enabled until the result for this command is received. + /// + /// The maximum size in bytes of collected scripts (not referenced by other heap objects) + public async System.Threading.Tasks.Task EnableAsync(long? maxScriptsCacheSize = null) + { + ValidateEnable(maxScriptsCacheSize); + var dict = new System.Collections.Generic.Dictionary(); + if (maxScriptsCacheSize.HasValue) + { + dict.Add("maxScriptsCacheSize", maxScriptsCacheSize.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.enable", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateEvaluateOnCallFrame(string callFrameId, string expression, string objectGroup = null, bool? includeCommandLineAPI = null, bool? silent = null, bool? returnByValue = null, bool? generatePreview = null, bool? throwOnSideEffect = null, long? timeout = null); + /// + /// Evaluates expression on a given call frame. + /// + /// Call frame identifier to evaluate on. + /// Expression to evaluate. + /// String object group name to put result into (allows rapid releasing resulting object handles + public async System.Threading.Tasks.Task EvaluateOnCallFrameAsync(string callFrameId, string expression, string objectGroup = null, bool? includeCommandLineAPI = null, bool? silent = null, bool? returnByValue = null, bool? generatePreview = null, bool? throwOnSideEffect = null, long? timeout = null) + { + ValidateEvaluateOnCallFrame(callFrameId, expression, objectGroup, includeCommandLineAPI, silent, returnByValue, generatePreview, throwOnSideEffect, timeout); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("callFrameId", callFrameId); + dict.Add("expression", expression); + if (!(string.IsNullOrEmpty(objectGroup))) + { + dict.Add("objectGroup", objectGroup); + } + + if (includeCommandLineAPI.HasValue) + { + dict.Add("includeCommandLineAPI", includeCommandLineAPI.Value); + } + + if (silent.HasValue) + { + dict.Add("silent", silent.Value); + } + + if (returnByValue.HasValue) + { + dict.Add("returnByValue", returnByValue.Value); + } + + if (generatePreview.HasValue) + { + dict.Add("generatePreview", generatePreview.Value); + } + + if (throwOnSideEffect.HasValue) + { + dict.Add("throwOnSideEffect", throwOnSideEffect.Value); + } + + if (timeout.HasValue) + { + dict.Add("timeout", timeout.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.evaluateOnCallFrame", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateExecuteWasmEvaluator(string callFrameId, byte[] evaluator, long? timeout = null); + /// + /// Execute a Wasm Evaluator module on a given call frame. + /// + /// WebAssembly call frame identifier to evaluate on. + /// Code of the evaluator module. + /// Terminate execution after timing out (number of milliseconds). + /// returns System.Threading.Tasks.Task<ExecuteWasmEvaluatorResponse> + public async System.Threading.Tasks.Task ExecuteWasmEvaluatorAsync(string callFrameId, byte[] evaluator, long? timeout = null) + { + ValidateExecuteWasmEvaluator(callFrameId, evaluator, timeout); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("callFrameId", callFrameId); + dict.Add("evaluator", ToBase64String(evaluator)); + if (timeout.HasValue) + { + dict.Add("timeout", timeout.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.executeWasmEvaluator", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetPossibleBreakpoints(CefSharp.DevTools.Debugger.Location start, CefSharp.DevTools.Debugger.Location end = null, bool? restrictToFunction = null); + /// + /// Returns possible locations for breakpoint. scriptId in start and end range locations should be + /// the same. + /// + /// Start of range to search possible breakpoint locations in. + /// End of range to search possible breakpoint locations in (excluding). When not specified, end + public async System.Threading.Tasks.Task GetPossibleBreakpointsAsync(CefSharp.DevTools.Debugger.Location start, CefSharp.DevTools.Debugger.Location end = null, bool? restrictToFunction = null) + { + ValidateGetPossibleBreakpoints(start, end, restrictToFunction); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("start", start.ToDictionary()); + if ((end) != (null)) + { + dict.Add("end", end.ToDictionary()); + } + + if (restrictToFunction.HasValue) + { + dict.Add("restrictToFunction", restrictToFunction.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.getPossibleBreakpoints", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetScriptSource(string scriptId); + /// + /// Returns source for the script with given id. + /// + /// Id of the script to get source for. + /// returns System.Threading.Tasks.Task<GetScriptSourceResponse> + public async System.Threading.Tasks.Task GetScriptSourceAsync(string scriptId) + { + ValidateGetScriptSource(scriptId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scriptId", scriptId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.getScriptSource", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetStackTrace(CefSharp.DevTools.Runtime.StackTraceId stackTraceId); + /// + /// Returns stack trace with given `stackTraceId`. + /// + /// stackTraceId + /// returns System.Threading.Tasks.Task<GetStackTraceResponse> + public async System.Threading.Tasks.Task GetStackTraceAsync(CefSharp.DevTools.Runtime.StackTraceId stackTraceId) + { + ValidateGetStackTrace(stackTraceId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("stackTraceId", stackTraceId.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.getStackTrace", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Stops on the next JavaScript statement. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task PauseAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.pause", dict); + return methodResult; + } + + partial void ValidateRemoveBreakpoint(string breakpointId); + /// + /// Removes JavaScript breakpoint. + /// + /// breakpointId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveBreakpointAsync(string breakpointId) + { + ValidateRemoveBreakpoint(breakpointId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("breakpointId", breakpointId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.removeBreakpoint", dict); + return methodResult; + } + + partial void ValidateRestartFrame(string callFrameId); + /// + /// Restarts particular call frame from the beginning. + /// + /// Call frame identifier to evaluate on. + /// returns System.Threading.Tasks.Task<RestartFrameResponse> + public async System.Threading.Tasks.Task RestartFrameAsync(string callFrameId) + { + ValidateRestartFrame(callFrameId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("callFrameId", callFrameId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.restartFrame", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateResume(bool? terminateOnResume = null); + /// + /// Resumes JavaScript execution. + /// + /// Set to true to terminate execution upon resuming execution. In contrast + public async System.Threading.Tasks.Task ResumeAsync(bool? terminateOnResume = null) + { + ValidateResume(terminateOnResume); + var dict = new System.Collections.Generic.Dictionary(); + if (terminateOnResume.HasValue) + { + dict.Add("terminateOnResume", terminateOnResume.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.resume", dict); + return methodResult; + } + + partial void ValidateSearchInContent(string scriptId, string query, bool? caseSensitive = null, bool? isRegex = null); + /// + /// Searches for given string in script content. + /// + /// Id of the script to search in. + /// String to search for. + /// If true, search is case sensitive. + /// If true, treats string parameter as regex. + /// returns System.Threading.Tasks.Task<SearchInContentResponse> + public async System.Threading.Tasks.Task SearchInContentAsync(string scriptId, string query, bool? caseSensitive = null, bool? isRegex = null) + { + ValidateSearchInContent(scriptId, query, caseSensitive, isRegex); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scriptId", scriptId); + dict.Add("query", query); + if (caseSensitive.HasValue) + { + dict.Add("caseSensitive", caseSensitive.Value); + } + + if (isRegex.HasValue) + { + dict.Add("isRegex", isRegex.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.searchInContent", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetAsyncCallStackDepth(int maxDepth); + /// + /// Enables or disables async call stacks tracking. + /// + /// Maximum depth of async call stacks. Setting to `0` will effectively disable collecting async + public async System.Threading.Tasks.Task SetAsyncCallStackDepthAsync(int maxDepth) + { + ValidateSetAsyncCallStackDepth(maxDepth); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("maxDepth", maxDepth); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setAsyncCallStackDepth", dict); + return methodResult; + } + + partial void ValidateSetBlackboxPatterns(string[] patterns); + /// + /// Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in + /// scripts with url matching one of the patterns. VM will try to leave blackboxed script by + /// performing 'step in' several times, finally resorting to 'step out' if unsuccessful. + /// + /// Array of regexps that will be used to check script url for blackbox state. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetBlackboxPatternsAsync(string[] patterns) + { + ValidateSetBlackboxPatterns(patterns); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("patterns", patterns); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setBlackboxPatterns", dict); + return methodResult; + } + + partial void ValidateSetBlackboxedRanges(string scriptId, System.Collections.Generic.IList positions); + /// + /// Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted + /// scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. + /// Positions array contains positions where blackbox state is changed. First interval isn't + /// blackboxed. Array should be sorted. + /// + /// Id of the script. + /// positions + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetBlackboxedRangesAsync(string scriptId, System.Collections.Generic.IList positions) + { + ValidateSetBlackboxedRanges(scriptId, positions); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scriptId", scriptId); + dict.Add("positions", positions.Select(x => x.ToDictionary())); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setBlackboxedRanges", dict); + return methodResult; + } + + partial void ValidateSetBreakpoint(CefSharp.DevTools.Debugger.Location location, string condition = null); + /// + /// Sets JavaScript breakpoint at a given location. + /// + /// Location to set breakpoint in. + /// Expression to use as a breakpoint condition. When specified, debugger will only stop on the + public async System.Threading.Tasks.Task SetBreakpointAsync(CefSharp.DevTools.Debugger.Location location, string condition = null) + { + ValidateSetBreakpoint(location, condition); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("location", location.ToDictionary()); + if (!(string.IsNullOrEmpty(condition))) + { + dict.Add("condition", condition); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setBreakpoint", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetInstrumentationBreakpoint(string instrumentation); + /// + /// Sets instrumentation breakpoint. + /// + /// Instrumentation name. + /// returns System.Threading.Tasks.Task<SetInstrumentationBreakpointResponse> + public async System.Threading.Tasks.Task SetInstrumentationBreakpointAsync(string instrumentation) + { + ValidateSetInstrumentationBreakpoint(instrumentation); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("instrumentation", instrumentation); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setInstrumentationBreakpoint", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetBreakpointByUrl(int lineNumber, string url = null, string urlRegex = null, string scriptHash = null, int? columnNumber = null, string condition = null); + /// + /// Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this + /// command is issued, all existing parsed scripts will have breakpoints resolved and returned in + /// `locations` property. Further matching script parsing will result in subsequent + /// `breakpointResolved` events issued. This logical breakpoint will survive page reloads. + /// + /// Line number to set breakpoint at. + /// URL of the resources to set breakpoint on. + /// Regex pattern for the URLs of the resources to set breakpoints on. Either `url` or + public async System.Threading.Tasks.Task SetBreakpointByUrlAsync(int lineNumber, string url = null, string urlRegex = null, string scriptHash = null, int? columnNumber = null, string condition = null) + { + ValidateSetBreakpointByUrl(lineNumber, url, urlRegex, scriptHash, columnNumber, condition); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("lineNumber", lineNumber); + if (!(string.IsNullOrEmpty(url))) + { + dict.Add("url", url); + } + + if (!(string.IsNullOrEmpty(urlRegex))) + { + dict.Add("urlRegex", urlRegex); + } + + if (!(string.IsNullOrEmpty(scriptHash))) + { + dict.Add("scriptHash", scriptHash); + } + + if (columnNumber.HasValue) + { + dict.Add("columnNumber", columnNumber.Value); + } + + if (!(string.IsNullOrEmpty(condition))) + { + dict.Add("condition", condition); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setBreakpointByUrl", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetBreakpointOnFunctionCall(string objectId, string condition = null); + /// + /// Sets JavaScript breakpoint before each call to the given function. + /// If another function was created from the same source as a given one, + /// calling it will also trigger the breakpoint. + /// + /// Function object id. + /// Expression to use as a breakpoint condition. When specified, debugger will + public async System.Threading.Tasks.Task SetBreakpointOnFunctionCallAsync(string objectId, string condition = null) + { + ValidateSetBreakpointOnFunctionCall(objectId, condition); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectId", objectId); + if (!(string.IsNullOrEmpty(condition))) + { + dict.Add("condition", condition); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setBreakpointOnFunctionCall", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetBreakpointsActive(bool active); + /// + /// Activates / deactivates all breakpoints on the page. + /// + /// New value for breakpoints active state. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetBreakpointsActiveAsync(bool active) + { + ValidateSetBreakpointsActive(active); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("active", active); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setBreakpointsActive", dict); + return methodResult; + } + + partial void ValidateSetPauseOnExceptions(string state); + /// + /// Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or + /// no exceptions. Initial pause on exceptions state is `none`. + /// + /// Pause on exceptions mode. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetPauseOnExceptionsAsync(string state) + { + ValidateSetPauseOnExceptions(state); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("state", state); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setPauseOnExceptions", dict); + return methodResult; + } + + partial void ValidateSetReturnValue(CefSharp.DevTools.Runtime.CallArgument newValue); + /// + /// Changes return value in top frame. Available only at return break position. + /// + /// New return value. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetReturnValueAsync(CefSharp.DevTools.Runtime.CallArgument newValue) + { + ValidateSetReturnValue(newValue); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("newValue", newValue.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setReturnValue", dict); + return methodResult; + } + + partial void ValidateSetScriptSource(string scriptId, string scriptSource, bool? dryRun = null); + /// + /// Edits JavaScript source live. + /// + /// Id of the script to edit. + /// New content of the script. + /// If true the change will not actually be applied. Dry run may be used to get result + public async System.Threading.Tasks.Task SetScriptSourceAsync(string scriptId, string scriptSource, bool? dryRun = null) + { + ValidateSetScriptSource(scriptId, scriptSource, dryRun); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scriptId", scriptId); + dict.Add("scriptSource", scriptSource); + if (dryRun.HasValue) + { + dict.Add("dryRun", dryRun.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setScriptSource", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetSkipAllPauses(bool skip); + /// + /// Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). + /// + /// New value for skip pauses state. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetSkipAllPausesAsync(bool skip) + { + ValidateSetSkipAllPauses(skip); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("skip", skip); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setSkipAllPauses", dict); + return methodResult; + } + + partial void ValidateSetVariableValue(int scopeNumber, string variableName, CefSharp.DevTools.Runtime.CallArgument newValue, string callFrameId); + /// + /// Changes value of variable in a callframe. Object-based scopes are not supported and must be + /// mutated manually. + /// + /// 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' + public async System.Threading.Tasks.Task SetVariableValueAsync(int scopeNumber, string variableName, CefSharp.DevTools.Runtime.CallArgument newValue, string callFrameId) + { + ValidateSetVariableValue(scopeNumber, variableName, newValue, callFrameId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scopeNumber", scopeNumber); + dict.Add("variableName", variableName); + dict.Add("newValue", newValue.ToDictionary()); + dict.Add("callFrameId", callFrameId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.setVariableValue", dict); + return methodResult; + } + + partial void ValidateStepInto(bool? breakOnAsyncCall = null); + /// + /// Steps into the function call. + /// + /// Debugger will pause on the execution of the first async task which was scheduled + public async System.Threading.Tasks.Task StepIntoAsync(bool? breakOnAsyncCall = null) + { + ValidateStepInto(breakOnAsyncCall); + var dict = new System.Collections.Generic.Dictionary(); + if (breakOnAsyncCall.HasValue) + { + dict.Add("breakOnAsyncCall", breakOnAsyncCall.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.stepInto", dict); + return methodResult; + } + + /// + /// Steps out of the function call. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StepOutAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.stepOut", dict); + return methodResult; + } + + /// + /// Steps over the statement. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StepOverAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Debugger.stepOver", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/EnableResponse.cs b/CefSharp/DevTools/Debugger/EnableResponse.cs new file mode 100644 index 0000000000..b0deca6f89 --- /dev/null +++ b/CefSharp/DevTools/Debugger/EnableResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// EnableResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class EnableResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string debuggerId + { + get; + set; + } + + /// + /// debuggerId + /// + public string DebuggerId + { + get + { + return debuggerId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/Enums/ScriptLanguage.cs b/CefSharp/DevTools/Debugger/Enums/ScriptLanguage.cs new file mode 100644 index 0000000000..668c527574 --- /dev/null +++ b/CefSharp/DevTools/Debugger/Enums/ScriptLanguage.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// Enum of possible script languages. + /// + public enum ScriptLanguage + { + /// + /// JavaScript + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("JavaScript"))] + JavaScript, + /// + /// WebAssembly + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WebAssembly"))] + WebAssembly + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/EvaluateOnCallFrameResponse.cs b/CefSharp/DevTools/Debugger/EvaluateOnCallFrameResponse.cs new file mode 100644 index 0000000000..a0424a6d40 --- /dev/null +++ b/CefSharp/DevTools/Debugger/EvaluateOnCallFrameResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// EvaluateOnCallFrameResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class EvaluateOnCallFrameResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject result + { + get; + set; + } + + /// + /// result + /// + public CefSharp.DevTools.Runtime.RemoteObject Result + { + get + { + return result; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.ExceptionDetails exceptionDetails + { + get; + set; + } + + /// + /// exceptionDetails + /// + public CefSharp.DevTools.Runtime.ExceptionDetails ExceptionDetails + { + get + { + return exceptionDetails; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/ExecuteWasmEvaluatorResponse.cs b/CefSharp/DevTools/Debugger/ExecuteWasmEvaluatorResponse.cs new file mode 100644 index 0000000000..6cbed1f9d0 --- /dev/null +++ b/CefSharp/DevTools/Debugger/ExecuteWasmEvaluatorResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// ExecuteWasmEvaluatorResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ExecuteWasmEvaluatorResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject result + { + get; + set; + } + + /// + /// result + /// + public CefSharp.DevTools.Runtime.RemoteObject Result + { + get + { + return result; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.ExceptionDetails exceptionDetails + { + get; + set; + } + + /// + /// exceptionDetails + /// + public CefSharp.DevTools.Runtime.ExceptionDetails ExceptionDetails + { + get + { + return exceptionDetails; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/GetPossibleBreakpointsResponse.cs b/CefSharp/DevTools/Debugger/GetPossibleBreakpointsResponse.cs new file mode 100644 index 0000000000..386689fb6e --- /dev/null +++ b/CefSharp/DevTools/Debugger/GetPossibleBreakpointsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// GetPossibleBreakpointsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetPossibleBreakpointsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList locations + { + get; + set; + } + + /// + /// locations + /// + public System.Collections.Generic.IList Locations + { + get + { + return locations; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/GetScriptSourceResponse.cs b/CefSharp/DevTools/Debugger/GetScriptSourceResponse.cs new file mode 100644 index 0000000000..bc88c27743 --- /dev/null +++ b/CefSharp/DevTools/Debugger/GetScriptSourceResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// GetScriptSourceResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetScriptSourceResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string scriptSource + { + get; + set; + } + + /// + /// scriptSource + /// + public string ScriptSource + { + get + { + return scriptSource; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string bytecode + { + get; + set; + } + + /// + /// bytecode + /// + public byte[] Bytecode + { + get + { + return Convert(bytecode); + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/GetStackTraceResponse.cs b/CefSharp/DevTools/Debugger/GetStackTraceResponse.cs new file mode 100644 index 0000000000..2efc195032 --- /dev/null +++ b/CefSharp/DevTools/Debugger/GetStackTraceResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// GetStackTraceResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetStackTraceResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.StackTrace stackTrace + { + get; + set; + } + + /// + /// stackTrace + /// + public CefSharp.DevTools.Runtime.StackTrace StackTrace + { + get + { + return stackTrace; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/Location.cs b/CefSharp/DevTools/Debugger/Location.cs new file mode 100644 index 0000000000..12ef9dffd6 --- /dev/null +++ b/CefSharp/DevTools/Debugger/Location.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// Location in the source code. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Location : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Script identifier as reported in the `Debugger.scriptParsed`. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptId"), IsRequired = (true))] + public string ScriptId + { + get; + set; + } + + /// + /// Line number in the script (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (true))] + public int LineNumber + { + get; + set; + } + + /// + /// Column number in the script (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("columnNumber"), IsRequired = (false))] + public int? ColumnNumber + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/RestartFrameResponse.cs b/CefSharp/DevTools/Debugger/RestartFrameResponse.cs new file mode 100644 index 0000000000..99b6c1daa1 --- /dev/null +++ b/CefSharp/DevTools/Debugger/RestartFrameResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// RestartFrameResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RestartFrameResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList callFrames + { + get; + set; + } + + /// + /// callFrames + /// + public System.Collections.Generic.IList CallFrames + { + get + { + return callFrames; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.StackTrace asyncStackTrace + { + get; + set; + } + + /// + /// asyncStackTrace + /// + public CefSharp.DevTools.Runtime.StackTrace AsyncStackTrace + { + get + { + return asyncStackTrace; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.StackTraceId asyncStackTraceId + { + get; + set; + } + + /// + /// asyncStackTraceId + /// + public CefSharp.DevTools.Runtime.StackTraceId AsyncStackTraceId + { + get + { + return asyncStackTraceId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/Scope.cs b/CefSharp/DevTools/Debugger/Scope.cs new file mode 100644 index 0000000000..e76eb2bc0b --- /dev/null +++ b/CefSharp/DevTools/Debugger/Scope.cs @@ -0,0 +1,64 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// Scope description. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Scope : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Scope type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// Object representing the scope. For `global` and `with` scopes it represents the actual + /// object; for the rest of the scopes, it is artificial transient object enumerating scope + /// variables as its properties. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("object"), IsRequired = (true))] + public CefSharp.DevTools.Runtime.RemoteObject Object + { + get; + set; + } + + /// + /// Name + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (false))] + public string Name + { + get; + set; + } + + /// + /// Location in the source code where scope starts + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("startLocation"), IsRequired = (false))] + public CefSharp.DevTools.Debugger.Location StartLocation + { + get; + set; + } + + /// + /// Location in the source code where scope ends + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("endLocation"), IsRequired = (false))] + public CefSharp.DevTools.Debugger.Location EndLocation + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/ScriptPosition.cs b/CefSharp/DevTools/Debugger/ScriptPosition.cs new file mode 100644 index 0000000000..e9e4f8b2ef --- /dev/null +++ b/CefSharp/DevTools/Debugger/ScriptPosition.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// Location in the source code. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ScriptPosition : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// LineNumber + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (true))] + public int LineNumber + { + get; + set; + } + + /// + /// ColumnNumber + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("columnNumber"), IsRequired = (true))] + public int ColumnNumber + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/SearchInContentResponse.cs b/CefSharp/DevTools/Debugger/SearchInContentResponse.cs new file mode 100644 index 0000000000..ebc8242576 --- /dev/null +++ b/CefSharp/DevTools/Debugger/SearchInContentResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// SearchInContentResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SearchInContentResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList result + { + get; + set; + } + + /// + /// result + /// + public System.Collections.Generic.IList Result + { + get + { + return result; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/SearchMatch.cs b/CefSharp/DevTools/Debugger/SearchMatch.cs new file mode 100644 index 0000000000..e0abc310b7 --- /dev/null +++ b/CefSharp/DevTools/Debugger/SearchMatch.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// Search match for resource. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SearchMatch : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Line number in resource content. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (true))] + public long LineNumber + { + get; + set; + } + + /// + /// Line with match content. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineContent"), IsRequired = (true))] + public string LineContent + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/SetBreakpointByUrlResponse.cs b/CefSharp/DevTools/Debugger/SetBreakpointByUrlResponse.cs new file mode 100644 index 0000000000..2493ed2d04 --- /dev/null +++ b/CefSharp/DevTools/Debugger/SetBreakpointByUrlResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// SetBreakpointByUrlResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetBreakpointByUrlResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string breakpointId + { + get; + set; + } + + /// + /// breakpointId + /// + public string BreakpointId + { + get + { + return breakpointId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList locations + { + get; + set; + } + + /// + /// locations + /// + public System.Collections.Generic.IList Locations + { + get + { + return locations; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/SetBreakpointOnFunctionCallResponse.cs b/CefSharp/DevTools/Debugger/SetBreakpointOnFunctionCallResponse.cs new file mode 100644 index 0000000000..e56bada8e3 --- /dev/null +++ b/CefSharp/DevTools/Debugger/SetBreakpointOnFunctionCallResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// SetBreakpointOnFunctionCallResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetBreakpointOnFunctionCallResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string breakpointId + { + get; + set; + } + + /// + /// breakpointId + /// + public string BreakpointId + { + get + { + return breakpointId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/SetBreakpointResponse.cs b/CefSharp/DevTools/Debugger/SetBreakpointResponse.cs new file mode 100644 index 0000000000..bf8e7c0d8a --- /dev/null +++ b/CefSharp/DevTools/Debugger/SetBreakpointResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// SetBreakpointResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetBreakpointResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string breakpointId + { + get; + set; + } + + /// + /// breakpointId + /// + public string BreakpointId + { + get + { + return breakpointId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Debugger.Location actualLocation + { + get; + set; + } + + /// + /// actualLocation + /// + public CefSharp.DevTools.Debugger.Location ActualLocation + { + get + { + return actualLocation; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/SetInstrumentationBreakpointResponse.cs b/CefSharp/DevTools/Debugger/SetInstrumentationBreakpointResponse.cs new file mode 100644 index 0000000000..e6bc261d91 --- /dev/null +++ b/CefSharp/DevTools/Debugger/SetInstrumentationBreakpointResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// SetInstrumentationBreakpointResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetInstrumentationBreakpointResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string breakpointId + { + get; + set; + } + + /// + /// breakpointId + /// + public string BreakpointId + { + get + { + return breakpointId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Debugger/SetScriptSourceResponse.cs b/CefSharp/DevTools/Debugger/SetScriptSourceResponse.cs new file mode 100644 index 0000000000..2accce3feb --- /dev/null +++ b/CefSharp/DevTools/Debugger/SetScriptSourceResponse.cs @@ -0,0 +1,102 @@ +// Copyright © 2020 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.DevTools.Debugger +{ + /// + /// SetScriptSourceResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetScriptSourceResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList callFrames + { + get; + set; + } + + /// + /// callFrames + /// + public System.Collections.Generic.IList CallFrames + { + get + { + return callFrames; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal bool? stackChanged + { + get; + set; + } + + /// + /// stackChanged + /// + public bool? StackChanged + { + get + { + return stackChanged; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.StackTrace asyncStackTrace + { + get; + set; + } + + /// + /// asyncStackTrace + /// + public CefSharp.DevTools.Runtime.StackTrace AsyncStackTrace + { + get + { + return asyncStackTrace; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.StackTraceId asyncStackTraceId + { + get; + set; + } + + /// + /// asyncStackTraceId + /// + public CefSharp.DevTools.Runtime.StackTraceId AsyncStackTraceId + { + get + { + return asyncStackTraceId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.ExceptionDetails exceptionDetails + { + get; + set; + } + + /// + /// exceptionDetails + /// + public CefSharp.DevTools.Runtime.ExceptionDetails ExceptionDetails + { + get + { + return exceptionDetails; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DevToolsClient.Generated.cs b/CefSharp/DevTools/DevToolsClient.Generated.cs new file mode 100644 index 0000000000..ffb5fc788b --- /dev/null +++ b/CefSharp/DevTools/DevToolsClient.Generated.cs @@ -0,0 +1,613 @@ +// Copyright © 2020 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.DevTools +{ + /// + /// Generated DevToolsClient methods + /// + public partial class DevToolsClient + { + private CefSharp.DevTools.Accessibility.Accessibility _Accessibility; + public CefSharp.DevTools.Accessibility.Accessibility Accessibility + { + get + { + if ((_Accessibility) == (null)) + { + _Accessibility = (new CefSharp.DevTools.Accessibility.Accessibility(this)); + } + + return _Accessibility; + } + } + + private CefSharp.DevTools.Animation.Animation _Animation; + public CefSharp.DevTools.Animation.Animation Animation + { + get + { + if ((_Animation) == (null)) + { + _Animation = (new CefSharp.DevTools.Animation.Animation(this)); + } + + return _Animation; + } + } + + private CefSharp.DevTools.ApplicationCache.ApplicationCache _ApplicationCache; + public CefSharp.DevTools.ApplicationCache.ApplicationCache ApplicationCache + { + get + { + if ((_ApplicationCache) == (null)) + { + _ApplicationCache = (new CefSharp.DevTools.ApplicationCache.ApplicationCache(this)); + } + + return _ApplicationCache; + } + } + + private CefSharp.DevTools.Audits.Audits _Audits; + public CefSharp.DevTools.Audits.Audits Audits + { + get + { + if ((_Audits) == (null)) + { + _Audits = (new CefSharp.DevTools.Audits.Audits(this)); + } + + return _Audits; + } + } + + private CefSharp.DevTools.BackgroundService.BackgroundService _BackgroundService; + public CefSharp.DevTools.BackgroundService.BackgroundService BackgroundService + { + get + { + if ((_BackgroundService) == (null)) + { + _BackgroundService = (new CefSharp.DevTools.BackgroundService.BackgroundService(this)); + } + + return _BackgroundService; + } + } + + private CefSharp.DevTools.Browser.Browser _Browser; + public CefSharp.DevTools.Browser.Browser Browser + { + get + { + if ((_Browser) == (null)) + { + _Browser = (new CefSharp.DevTools.Browser.Browser(this)); + } + + return _Browser; + } + } + + private CefSharp.DevTools.CSS.CSS _CSS; + public CefSharp.DevTools.CSS.CSS CSS + { + get + { + if ((_CSS) == (null)) + { + _CSS = (new CefSharp.DevTools.CSS.CSS(this)); + } + + return _CSS; + } + } + + private CefSharp.DevTools.CacheStorage.CacheStorage _CacheStorage; + public CefSharp.DevTools.CacheStorage.CacheStorage CacheStorage + { + get + { + if ((_CacheStorage) == (null)) + { + _CacheStorage = (new CefSharp.DevTools.CacheStorage.CacheStorage(this)); + } + + return _CacheStorage; + } + } + + private CefSharp.DevTools.Cast.Cast _Cast; + public CefSharp.DevTools.Cast.Cast Cast + { + get + { + if ((_Cast) == (null)) + { + _Cast = (new CefSharp.DevTools.Cast.Cast(this)); + } + + return _Cast; + } + } + + private CefSharp.DevTools.DOM.DOM _DOM; + public CefSharp.DevTools.DOM.DOM DOM + { + get + { + if ((_DOM) == (null)) + { + _DOM = (new CefSharp.DevTools.DOM.DOM(this)); + } + + return _DOM; + } + } + + private CefSharp.DevTools.DOMDebugger.DOMDebugger _DOMDebugger; + public CefSharp.DevTools.DOMDebugger.DOMDebugger DOMDebugger + { + get + { + if ((_DOMDebugger) == (null)) + { + _DOMDebugger = (new CefSharp.DevTools.DOMDebugger.DOMDebugger(this)); + } + + return _DOMDebugger; + } + } + + private CefSharp.DevTools.DOMSnapshot.DOMSnapshot _DOMSnapshot; + public CefSharp.DevTools.DOMSnapshot.DOMSnapshot DOMSnapshot + { + get + { + if ((_DOMSnapshot) == (null)) + { + _DOMSnapshot = (new CefSharp.DevTools.DOMSnapshot.DOMSnapshot(this)); + } + + return _DOMSnapshot; + } + } + + private CefSharp.DevTools.DOMStorage.DOMStorage _DOMStorage; + public CefSharp.DevTools.DOMStorage.DOMStorage DOMStorage + { + get + { + if ((_DOMStorage) == (null)) + { + _DOMStorage = (new CefSharp.DevTools.DOMStorage.DOMStorage(this)); + } + + return _DOMStorage; + } + } + + private CefSharp.DevTools.Database.Database _Database; + public CefSharp.DevTools.Database.Database Database + { + get + { + if ((_Database) == (null)) + { + _Database = (new CefSharp.DevTools.Database.Database(this)); + } + + return _Database; + } + } + + private CefSharp.DevTools.DeviceOrientation.DeviceOrientation _DeviceOrientation; + public CefSharp.DevTools.DeviceOrientation.DeviceOrientation DeviceOrientation + { + get + { + if ((_DeviceOrientation) == (null)) + { + _DeviceOrientation = (new CefSharp.DevTools.DeviceOrientation.DeviceOrientation(this)); + } + + return _DeviceOrientation; + } + } + + private CefSharp.DevTools.Emulation.Emulation _Emulation; + public CefSharp.DevTools.Emulation.Emulation Emulation + { + get + { + if ((_Emulation) == (null)) + { + _Emulation = (new CefSharp.DevTools.Emulation.Emulation(this)); + } + + return _Emulation; + } + } + + private CefSharp.DevTools.HeadlessExperimental.HeadlessExperimental _HeadlessExperimental; + public CefSharp.DevTools.HeadlessExperimental.HeadlessExperimental HeadlessExperimental + { + get + { + if ((_HeadlessExperimental) == (null)) + { + _HeadlessExperimental = (new CefSharp.DevTools.HeadlessExperimental.HeadlessExperimental(this)); + } + + return _HeadlessExperimental; + } + } + + private CefSharp.DevTools.IO.IO _IO; + public CefSharp.DevTools.IO.IO IO + { + get + { + if ((_IO) == (null)) + { + _IO = (new CefSharp.DevTools.IO.IO(this)); + } + + return _IO; + } + } + + private CefSharp.DevTools.IndexedDB.IndexedDB _IndexedDB; + public CefSharp.DevTools.IndexedDB.IndexedDB IndexedDB + { + get + { + if ((_IndexedDB) == (null)) + { + _IndexedDB = (new CefSharp.DevTools.IndexedDB.IndexedDB(this)); + } + + return _IndexedDB; + } + } + + private CefSharp.DevTools.Input.Input _Input; + public CefSharp.DevTools.Input.Input Input + { + get + { + if ((_Input) == (null)) + { + _Input = (new CefSharp.DevTools.Input.Input(this)); + } + + return _Input; + } + } + + private CefSharp.DevTools.Inspector.Inspector _Inspector; + public CefSharp.DevTools.Inspector.Inspector Inspector + { + get + { + if ((_Inspector) == (null)) + { + _Inspector = (new CefSharp.DevTools.Inspector.Inspector(this)); + } + + return _Inspector; + } + } + + private CefSharp.DevTools.LayerTree.LayerTree _LayerTree; + public CefSharp.DevTools.LayerTree.LayerTree LayerTree + { + get + { + if ((_LayerTree) == (null)) + { + _LayerTree = (new CefSharp.DevTools.LayerTree.LayerTree(this)); + } + + return _LayerTree; + } + } + + private CefSharp.DevTools.Log.Log _Log; + public CefSharp.DevTools.Log.Log Log + { + get + { + if ((_Log) == (null)) + { + _Log = (new CefSharp.DevTools.Log.Log(this)); + } + + return _Log; + } + } + + private CefSharp.DevTools.Memory.Memory _Memory; + public CefSharp.DevTools.Memory.Memory Memory + { + get + { + if ((_Memory) == (null)) + { + _Memory = (new CefSharp.DevTools.Memory.Memory(this)); + } + + return _Memory; + } + } + + private CefSharp.DevTools.Network.Network _Network; + public CefSharp.DevTools.Network.Network Network + { + get + { + if ((_Network) == (null)) + { + _Network = (new CefSharp.DevTools.Network.Network(this)); + } + + return _Network; + } + } + + private CefSharp.DevTools.Overlay.Overlay _Overlay; + public CefSharp.DevTools.Overlay.Overlay Overlay + { + get + { + if ((_Overlay) == (null)) + { + _Overlay = (new CefSharp.DevTools.Overlay.Overlay(this)); + } + + return _Overlay; + } + } + + private CefSharp.DevTools.Page.Page _Page; + public CefSharp.DevTools.Page.Page Page + { + get + { + if ((_Page) == (null)) + { + _Page = (new CefSharp.DevTools.Page.Page(this)); + } + + return _Page; + } + } + + private CefSharp.DevTools.Performance.Performance _Performance; + public CefSharp.DevTools.Performance.Performance Performance + { + get + { + if ((_Performance) == (null)) + { + _Performance = (new CefSharp.DevTools.Performance.Performance(this)); + } + + return _Performance; + } + } + + private CefSharp.DevTools.Security.Security _Security; + public CefSharp.DevTools.Security.Security Security + { + get + { + if ((_Security) == (null)) + { + _Security = (new CefSharp.DevTools.Security.Security(this)); + } + + return _Security; + } + } + + private CefSharp.DevTools.ServiceWorker.ServiceWorker _ServiceWorker; + public CefSharp.DevTools.ServiceWorker.ServiceWorker ServiceWorker + { + get + { + if ((_ServiceWorker) == (null)) + { + _ServiceWorker = (new CefSharp.DevTools.ServiceWorker.ServiceWorker(this)); + } + + return _ServiceWorker; + } + } + + private CefSharp.DevTools.Storage.Storage _Storage; + public CefSharp.DevTools.Storage.Storage Storage + { + get + { + if ((_Storage) == (null)) + { + _Storage = (new CefSharp.DevTools.Storage.Storage(this)); + } + + return _Storage; + } + } + + private CefSharp.DevTools.SystemInfo.SystemInfo _SystemInfo; + public CefSharp.DevTools.SystemInfo.SystemInfo SystemInfo + { + get + { + if ((_SystemInfo) == (null)) + { + _SystemInfo = (new CefSharp.DevTools.SystemInfo.SystemInfo(this)); + } + + return _SystemInfo; + } + } + + private CefSharp.DevTools.Target.Target _Target; + public CefSharp.DevTools.Target.Target Target + { + get + { + if ((_Target) == (null)) + { + _Target = (new CefSharp.DevTools.Target.Target(this)); + } + + return _Target; + } + } + + private CefSharp.DevTools.Tethering.Tethering _Tethering; + public CefSharp.DevTools.Tethering.Tethering Tethering + { + get + { + if ((_Tethering) == (null)) + { + _Tethering = (new CefSharp.DevTools.Tethering.Tethering(this)); + } + + return _Tethering; + } + } + + private CefSharp.DevTools.Tracing.Tracing _Tracing; + public CefSharp.DevTools.Tracing.Tracing Tracing + { + get + { + if ((_Tracing) == (null)) + { + _Tracing = (new CefSharp.DevTools.Tracing.Tracing(this)); + } + + return _Tracing; + } + } + + private CefSharp.DevTools.Fetch.Fetch _Fetch; + public CefSharp.DevTools.Fetch.Fetch Fetch + { + get + { + if ((_Fetch) == (null)) + { + _Fetch = (new CefSharp.DevTools.Fetch.Fetch(this)); + } + + return _Fetch; + } + } + + private CefSharp.DevTools.WebAudio.WebAudio _WebAudio; + public CefSharp.DevTools.WebAudio.WebAudio WebAudio + { + get + { + if ((_WebAudio) == (null)) + { + _WebAudio = (new CefSharp.DevTools.WebAudio.WebAudio(this)); + } + + return _WebAudio; + } + } + + private CefSharp.DevTools.WebAuthn.WebAuthn _WebAuthn; + public CefSharp.DevTools.WebAuthn.WebAuthn WebAuthn + { + get + { + if ((_WebAuthn) == (null)) + { + _WebAuthn = (new CefSharp.DevTools.WebAuthn.WebAuthn(this)); + } + + return _WebAuthn; + } + } + + private CefSharp.DevTools.Media.Media _Media; + public CefSharp.DevTools.Media.Media Media + { + get + { + if ((_Media) == (null)) + { + _Media = (new CefSharp.DevTools.Media.Media(this)); + } + + return _Media; + } + } + + private CefSharp.DevTools.Debugger.Debugger _Debugger; + public CefSharp.DevTools.Debugger.Debugger Debugger + { + get + { + if ((_Debugger) == (null)) + { + _Debugger = (new CefSharp.DevTools.Debugger.Debugger(this)); + } + + return _Debugger; + } + } + + private CefSharp.DevTools.HeapProfiler.HeapProfiler _HeapProfiler; + public CefSharp.DevTools.HeapProfiler.HeapProfiler HeapProfiler + { + get + { + if ((_HeapProfiler) == (null)) + { + _HeapProfiler = (new CefSharp.DevTools.HeapProfiler.HeapProfiler(this)); + } + + return _HeapProfiler; + } + } + + private CefSharp.DevTools.Profiler.Profiler _Profiler; + public CefSharp.DevTools.Profiler.Profiler Profiler + { + get + { + if ((_Profiler) == (null)) + { + _Profiler = (new CefSharp.DevTools.Profiler.Profiler(this)); + } + + return _Profiler; + } + } + + private CefSharp.DevTools.Runtime.Runtime _Runtime; + public CefSharp.DevTools.Runtime.Runtime Runtime + { + get + { + if ((_Runtime) == (null)) + { + _Runtime = (new CefSharp.DevTools.Runtime.Runtime(this)); + } + + return _Runtime; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/DevToolsClient.cs b/CefSharp/DevTools/DevToolsClient.cs new file mode 100644 index 0000000000..0433730daa --- /dev/null +++ b/CefSharp/DevTools/DevToolsClient.cs @@ -0,0 +1,248 @@ +// Copyright © 2020 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; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using CefSharp.Callback; +using CefSharp.Internals; +using CefSharp.Internals.Tasks; + +namespace CefSharp.DevTools +{ + /// + /// DevTool Client + /// + public partial class DevToolsClient : IDevToolsMessageObserver, IDevToolsClient + { + private readonly ConcurrentDictionary> queuedCommandResults = new ConcurrentDictionary>(); + private int lastMessageId; + private IBrowser browser; + private IRegistration devToolsRegistration; + private bool devToolsAttached; + private SynchronizationContext syncContext; + + /// + /// DevToolsEvent + /// + public EventHandler DevToolsEvent; + + /// + /// Capture the current so + /// continuation executes on the original calling thread. If + /// is null for + /// + /// then the continuation will be run on the CEF UI Thread (by default + /// this is not the same as the WPF/WinForms UI Thread). + /// + public bool CaptureSyncContext { get; set; } + + /// + /// When not null provided + /// will be used to run the contination. Defaults to null + /// Setting this property will change + /// to false. + /// + public SynchronizationContext SyncContext + { + get { return syncContext; } + set + { + CaptureSyncContext = false; + syncContext = value; + } + } + + /// + /// DevToolsClient + /// + /// Browser associated with this DevTools client + public DevToolsClient(IBrowser browser) + { + this.browser = browser; + + lastMessageId = browser.Identifier * 100000; + CaptureSyncContext = true; + } + + /// + /// Store a reference to the IRegistration that's returned when + /// you register an observer. + /// + /// registration + public void SetDevToolsObserverRegistration(IRegistration devToolsRegistration) + { + this.devToolsRegistration = devToolsRegistration; + } + + /// + /// Execute a method call over the DevTools protocol. This method can be called on any thread. + /// See the DevTools protocol documentation at https://chromedevtools.github.io/devtools-protocol/ for details + /// of supported methods and the expected dictionary contents. + /// + /// is the method name + /// are the method parameters represented as a dictionary, + /// which may be empty. + /// return a Task that can be awaited to obtain the method result + public async Task ExecuteDevToolsMethodAsync(string method, IDictionary parameters = null) + { + if (browser == null || browser.IsDisposed) + { + //TODO: Queue up commands where possible + return new DevToolsMethodResponse { Success = false }; + } + + var messageId = Interlocked.Increment(ref lastMessageId); + + var taskCompletionSource = new SyncContextTaskCompletionSource(); + + taskCompletionSource.SyncContext = CaptureSyncContext ? SynchronizationContext.Current : syncContext; + + if (!queuedCommandResults.TryAdd(messageId, taskCompletionSource)) + { + throw new DevToolsClientException(string.Format("Unable to add MessageId {0} to queuedCommandResults ConcurrentDictionary.", messageId)); + } + + var browserHost = browser.GetHost(); + + //Currently on CEF UI Thread we can directly execute + if (CefThread.CurrentlyOnUiThread) + { + var returnedMessageId = browserHost.ExecuteDevToolsMethod(messageId, method, parameters); + if (returnedMessageId == 0) + { + return new DevToolsMethodResponse { Success = false }; + } + else if(returnedMessageId != messageId) + { + //For some reason our message Id's don't match + throw new DevToolsClientException(string.Format("Generated MessageId {0} doesn't match returned Message Id {1}", returnedMessageId, messageId)); + } + } + //ExecuteDevToolsMethod can only be called on the CEF UI Thread + else if (CefThread.CanExecuteOnUiThread) + { + var returnedMessageId = await CefThread.ExecuteOnUiThread(() => + { + return browserHost.ExecuteDevToolsMethod(messageId, method, parameters); + }).ConfigureAwait(false); + + if (returnedMessageId == 0) + { + return new DevToolsMethodResponse { Success = false }; + } + else if (returnedMessageId != messageId) + { + //For some reason our message Id's don't match + throw new DevToolsClientException(string.Format("Generated MessageId {0} doesn't match returned Message Id {1}", returnedMessageId, messageId)); + } + } + else + { + throw new DevToolsClientException("Unable to invoke ExecuteDevToolsMethod on CEF UI Thread."); + } + + return await taskCompletionSource.Task; + } + + void IDisposable.Dispose() + { + devToolsRegistration?.Dispose(); + devToolsRegistration = null; + browser = null; + } + + void IDevToolsMessageObserver.OnDevToolsAgentAttached(IBrowser browser) + { + devToolsAttached = true; + } + + void IDevToolsMessageObserver.OnDevToolsAgentDetached(IBrowser browser) + { + devToolsAttached = false; + } + + void IDevToolsMessageObserver.OnDevToolsEvent(IBrowser browser, string method, Stream parameters) + { + var evt = DevToolsEvent; + + //Only parse the data if we have an event handler + if (evt != null) + { + //TODO: Improve this + var memoryStream = new MemoryStream((int)parameters.Length); + parameters.CopyTo(memoryStream); + + var paramsAsJsonString = Encoding.UTF8.GetString(memoryStream.ToArray()); + + evt(this, new DevToolsEventArgs(method, paramsAsJsonString)); + } + } + + bool IDevToolsMessageObserver.OnDevToolsMessage(IBrowser browser, Stream message) + { + return false; + } + + void IDevToolsMessageObserver.OnDevToolsMethodResult(IBrowser browser, int messageId, bool success, Stream result) + { + var uiThread = CefThread.CurrentlyOnUiThread; + SyncContextTaskCompletionSource taskCompletionSource = null; + + if (queuedCommandResults.TryRemove(messageId, out taskCompletionSource)) + { + var methodResult = new DevToolsMethodResponse + { + Success = success, + MessageId = messageId + }; + + //TODO: Improve this + var memoryStream = new MemoryStream((int)result.Length); + + result.CopyTo(memoryStream); + + methodResult.ResponseAsJsonString = Encoding.UTF8.GetString(memoryStream.ToArray()); + + Action execute = null; + + if (success) + { + execute = () => + { + taskCompletionSource.TrySetResult(methodResult); + }; + } + else + { + execute = () => + { + var errorObj = methodResult.DeserializeJson(); + errorObj.MessageId = messageId; + + //Make sure continuation runs on Thread Pool + taskCompletionSource.TrySetException(new DevToolsClientException("DevTools Client Error :" + errorObj.Message, errorObj)); + }; + } + + var syncContext = taskCompletionSource.SyncContext; + if (syncContext == null) + { + execute(); + } + else + { + syncContext.Post(new SendOrPostCallback((o) => + { + execute(); + }), null); + } + } + } + } +} diff --git a/CefSharp/DevTools/DevToolsClientException.cs b/CefSharp/DevTools/DevToolsClientException.cs new file mode 100644 index 0000000000..ef05525e87 --- /dev/null +++ b/CefSharp/DevTools/DevToolsClientException.cs @@ -0,0 +1,58 @@ +// Copyright © 2020 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; + +namespace CefSharp.DevTools +{ + /// + /// The exception that is thrown when there's a problem executing a DevTools protocol method. + /// + public class DevToolsClientException : Exception + { + /// + /// Get the Error Response + /// + public DevToolsDomainErrorResponse Response + { + get; private set; + } + + /// + /// Initializes a new instance of the class with its message + /// string set to a default message. + /// + public DevToolsClientException() : base("Error occurred whilst executing DevTools protocol method") + { + } + + /// + /// Initializes a new instance of the class with a specified error message. + /// + /// message + public DevToolsClientException(string message) : base(message) + { + } + + /// + /// Initializes a new instance of the class with a specified error message. + /// + /// message + /// error response + public DevToolsClientException(string message, DevToolsDomainErrorResponse errorResponse) : base(message) + { + Response = errorResponse; + } + + /// + /// Initializes a new instance of the class with a specified error message + /// and an inner exception. + /// + /// message + /// inner exception + public DevToolsClientException(string message, Exception inner) : base(message, inner) + { + } + } +} diff --git a/CefSharp/DevTools/DevToolsDomainBase.cs b/CefSharp/DevTools/DevToolsDomainBase.cs new file mode 100644 index 0000000000..262a962739 --- /dev/null +++ b/CefSharp/DevTools/DevToolsDomainBase.cs @@ -0,0 +1,39 @@ +// Copyright © 2020 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; +using System.Collections.Generic; +using System.Runtime.Serialization; +using CefSharp.DevTools.Browser; + +namespace CefSharp.DevTools +{ + public abstract class DevToolsDomainBase + { + protected string EnumToString(Enum val) + { + var memInfo = val.GetType().GetMember(val.ToString()); + var dataMemberAttribute = (EnumMemberAttribute)Attribute.GetCustomAttribute(memInfo[0], typeof(EnumMemberAttribute), false); + + return dataMemberAttribute.Value; + } + + protected IEnumerable EnumToString(PermissionType[] values) + { + foreach (var val in values) + { + var memInfo = val.GetType().GetMember(val.ToString()); + var dataMemberAttribute = (EnumMemberAttribute)Attribute.GetCustomAttribute(memInfo[0], typeof(EnumMemberAttribute), false); + + yield return dataMemberAttribute.Value; + } + } + + protected string ToBase64String(byte[] bytes) + { + return Convert.ToBase64String(bytes); + } + } +} diff --git a/CefSharp/DevTools/DevToolsDomainEntityBase.cs b/CefSharp/DevTools/DevToolsDomainEntityBase.cs new file mode 100644 index 0000000000..81fcc4f4e8 --- /dev/null +++ b/CefSharp/DevTools/DevToolsDomainEntityBase.cs @@ -0,0 +1,140 @@ +// Copyright © 2020 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; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Runtime.Serialization; + +namespace CefSharp.DevTools +{ + [DataContract] + public abstract class DevToolsDomainEntityBase + { + public static object StringToEnum(Type enumType, string input) + { + if (enumType.IsArray) + { + if (string.IsNullOrEmpty(input) || input == "[]" || input == "[ ]") + { + return null; + //return Array.CreateInstance(enumType.GetElementType(), 0); + } + + var values = input.Substring(1, input.Length - 2).Split(','); + + var returnValues = Array.CreateInstance(enumType.GetElementType(), values.Length); + + for (int i = 0; i < values.Length; i++) + { + var str = values[i].Trim('\r', '\n', '"', ' '); + + var enumVal = StringToEnumInternal(enumType.GetElementType(), str); + + returnValues.SetValue(enumVal, i); + } + + return returnValues; + } + + if (enumType.IsGenericType && enumType.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + if (string.IsNullOrEmpty(input)) + { + return null; + } + + enumType = Nullable.GetUnderlyingType(enumType); + } + + return StringToEnumInternal(enumType, input); + } + + private static object StringToEnumInternal(Type enumType, string input) + { + foreach (var name in Enum.GetNames(enumType)) + { + var enumMemberAttribute = ((EnumMemberAttribute[])enumType.GetField(name).GetCustomAttributes(typeof(EnumMemberAttribute), true)).Single(); + if (enumMemberAttribute.Value == input) + { + return Enum.Parse(enumType, name); + } + } + + return (Enum.GetValues(enumType).GetValue(0)); + } + + public static string EnumToString(Enum e) + { + var memberInfo = e.GetType().GetMember(e.ToString()).FirstOrDefault(); + + var enumMemberAttribute = (EnumMemberAttribute)Attribute.GetCustomAttribute(memberInfo, typeof(EnumMemberAttribute), false); + + return enumMemberAttribute.Value; + } + + public static string EnumToString(Array enumArray) + { + var returnValue = "["; + + foreach (var e in enumArray) + { + var memberInfo = e.GetType().GetMember(e.ToString()).FirstOrDefault(); + + var enumMemberAttribute = (EnumMemberAttribute)Attribute.GetCustomAttribute(memberInfo, typeof(EnumMemberAttribute), false); + + returnValue += enumMemberAttribute.Value + ","; + } + + returnValue += returnValue.Substring(0, returnValue.Length - 1) + "]"; + + return returnValue; + } + + public IDictionary ToDictionary() + { + var dict = new Dictionary(); + + var properties = GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + + foreach (var prop in properties) + { + var dataMemberAttribute = (DataMemberAttribute)Attribute.GetCustomAttribute(prop, typeof(DataMemberAttribute), false); + + //Only add members that have DataMemberAttribute + if (dataMemberAttribute == null) + { + continue; + } + + var propertyName = dataMemberAttribute.Name; + var propertyRequired = dataMemberAttribute.IsRequired; + var propertyValue = prop.GetValue(this); + + if (propertyRequired && propertyValue == null) + { + throw new DevToolsClientException(prop.Name + " is required"); + } + + //Not required and value null, don't add to dictionary + if (propertyValue == null) + { + continue; + } + + var propertyValueType = propertyValue.GetType(); + + if (typeof(DevToolsDomainEntityBase).IsAssignableFrom(propertyValueType)) + { + propertyValue = ((DevToolsDomainEntityBase)(propertyValue)).ToDictionary(); + } + + dict.Add(propertyName, propertyValue); + } + + return dict; + } + } +} diff --git a/CefSharp/DevTools/DevToolsDomainErrorResponse.cs b/CefSharp/DevTools/DevToolsDomainErrorResponse.cs new file mode 100644 index 0000000000..4f19a35d98 --- /dev/null +++ b/CefSharp/DevTools/DevToolsDomainErrorResponse.cs @@ -0,0 +1,41 @@ +// Copyright © 2020 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.Runtime.Serialization; + +namespace CefSharp.DevTools +{ + /// + /// Error Message parsed from JSON + /// e.g. {"code":-32601,"message":"'Browser.getWindowForTarget' wasn't found"} + /// + public class DevToolsDomainErrorResponse + { + /// + /// Message Id + /// + [IgnoreDataMember] + public int MessageId { get; set; } + + /// + /// Error Code + /// + [DataMember(Name = "code", IsRequired = true)] + public int Code + { + get; + set; + } + + /// + /// Error Message + /// + [DataMember(Name = "message", IsRequired = true)] + public string Message + { + get; + set; + } + } +} diff --git a/CefSharp/DevTools/DevToolsDomainResponseBase.cs b/CefSharp/DevTools/DevToolsDomainResponseBase.cs new file mode 100644 index 0000000000..838b034a65 --- /dev/null +++ b/CefSharp/DevTools/DevToolsDomainResponseBase.cs @@ -0,0 +1,15 @@ +// Copyright © 2020 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.DevTools +{ + [System.Runtime.Serialization.DataContractAttribute] + public abstract class DevToolsDomainResponseBase + { + public byte[] Convert(string data) + { + return System.Convert.FromBase64String(data); + } + } +} diff --git a/CefSharp/DevTools/DevToolsEventArgs.cs b/CefSharp/DevTools/DevToolsEventArgs.cs new file mode 100644 index 0000000000..d0f5110f8b --- /dev/null +++ b/CefSharp/DevTools/DevToolsEventArgs.cs @@ -0,0 +1,31 @@ +// Copyright © 2020 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; + +namespace CefSharp.DevTools +{ + /// + /// DevTools Event EventAargs + /// + public class DevToolsEventArgs : EventArgs + { + /// + /// Method + /// + public string EventName { get; private set; } + + /// + /// Event paramaters as Json string + /// + public string ParametersAsJsonString { get; private set; } + + public DevToolsEventArgs(string eventName, string paramsAsJsonString) + { + EventName = eventName; + ParametersAsJsonString = paramsAsJsonString; + } + } +} diff --git a/CefSharp/DevTools/DevToolsMethodResponse.cs b/CefSharp/DevTools/DevToolsMethodResponse.cs new file mode 100644 index 0000000000..f25ccdd8bf --- /dev/null +++ b/CefSharp/DevTools/DevToolsMethodResponse.cs @@ -0,0 +1,47 @@ +// Copyright © 2020 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.IO; +using System.Runtime.Serialization.Json; +using System.Text; + +namespace CefSharp.DevTools +{ + /// + /// DevTools Method Response + /// + public class DevToolsMethodResponse + { + /// + /// MessageId + /// + public int MessageId { get; set; } + + /// + /// Success + /// + public bool Success { get; set; } + + /// + /// Method Response as Json string + /// + public string ResponseAsJsonString { get; set; } + + internal T DeserializeJson() + { + if (Success) + { + var bytes = Encoding.UTF8.GetBytes(ResponseAsJsonString); + using (var ms = new MemoryStream(bytes)) + { + var dcs = new DataContractJsonSerializer(typeof(T)); + return (T)dcs.ReadObject(ms); + } + } + + throw new DevToolsClientException(ResponseAsJsonString); + } + + } +} diff --git a/CefSharp/DevTools/DeviceOrientation/DeviceOrientation.cs b/CefSharp/DevTools/DeviceOrientation/DeviceOrientation.cs new file mode 100644 index 0000000000..6e39b92cf0 --- /dev/null +++ b/CefSharp/DevTools/DeviceOrientation/DeviceOrientation.cs @@ -0,0 +1,49 @@ +// Copyright © 2020 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.DevTools.DeviceOrientation +{ + using System.Linq; + + /// + /// DeviceOrientation + /// + public partial class DeviceOrientation : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public DeviceOrientation(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Clears the overridden Device Orientation. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearDeviceOrientationOverrideAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("DeviceOrientation.clearDeviceOrientationOverride", dict); + return methodResult; + } + + partial void ValidateSetDeviceOrientationOverride(long alpha, long beta, long gamma); + /// + /// Overrides the Device Orientation. + /// + /// Mock alpha + /// Mock beta + /// Mock gamma + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetDeviceOrientationOverrideAsync(long alpha, long beta, long gamma) + { + ValidateSetDeviceOrientationOverride(alpha, beta, gamma); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("alpha", alpha); + dict.Add("beta", beta); + dict.Add("gamma", gamma); + var methodResult = await _client.ExecuteDevToolsMethodAsync("DeviceOrientation.setDeviceOrientationOverride", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Emulation/CanEmulateResponse.cs b/CefSharp/DevTools/Emulation/CanEmulateResponse.cs new file mode 100644 index 0000000000..0cd72f39b4 --- /dev/null +++ b/CefSharp/DevTools/Emulation/CanEmulateResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Emulation +{ + /// + /// CanEmulateResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CanEmulateResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal bool result + { + get; + set; + } + + /// + /// result + /// + public bool Result + { + get + { + return result; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Emulation/Emulation.cs b/CefSharp/DevTools/Emulation/Emulation.cs new file mode 100644 index 0000000000..69934b9fe3 --- /dev/null +++ b/CefSharp/DevTools/Emulation/Emulation.cs @@ -0,0 +1,449 @@ +// Copyright © 2020 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.DevTools.Emulation +{ + using System.Linq; + + /// + /// This domain emulates different environments for the page. + /// + public partial class Emulation : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Emulation(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Tells whether emulation is supported. + /// + /// returns System.Threading.Tasks.Task<CanEmulateResponse> + public async System.Threading.Tasks.Task CanEmulateAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.canEmulate", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Clears the overriden device metrics. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearDeviceMetricsOverrideAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.clearDeviceMetricsOverride", dict); + return methodResult; + } + + /// + /// Clears the overriden Geolocation Position and Error. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearGeolocationOverrideAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.clearGeolocationOverride", dict); + return methodResult; + } + + /// + /// Requests that page scale factor is reset to initial values. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ResetPageScaleFactorAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.resetPageScaleFactor", dict); + return methodResult; + } + + partial void ValidateSetFocusEmulationEnabled(bool enabled); + /// + /// Enables or disables simulating a focused and active page. + /// + /// Whether to enable to disable focus emulation. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetFocusEmulationEnabledAsync(bool enabled) + { + ValidateSetFocusEmulationEnabled(enabled); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enabled", enabled); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setFocusEmulationEnabled", dict); + return methodResult; + } + + partial void ValidateSetCPUThrottlingRate(long rate); + /// + /// Enables CPU throttling to emulate slow CPUs. + /// + /// Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc). + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetCPUThrottlingRateAsync(long rate) + { + ValidateSetCPUThrottlingRate(rate); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("rate", rate); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setCPUThrottlingRate", dict); + return methodResult; + } + + partial void ValidateSetDefaultBackgroundColorOverride(CefSharp.DevTools.DOM.RGBA color = null); + /// + /// Sets or clears an override of the default background color of the frame. This override is used + /// if the content does not specify one. + /// + /// RGBA of the default background color. If not specified, any existing override will be + public async System.Threading.Tasks.Task SetDefaultBackgroundColorOverrideAsync(CefSharp.DevTools.DOM.RGBA color = null) + { + ValidateSetDefaultBackgroundColorOverride(color); + var dict = new System.Collections.Generic.Dictionary(); + if ((color) != (null)) + { + dict.Add("color", color.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setDefaultBackgroundColorOverride", dict); + return methodResult; + } + + partial void ValidateSetDeviceMetricsOverride(int width, int height, long deviceScaleFactor, bool mobile, long? scale = null, int? screenWidth = null, int? screenHeight = null, int? positionX = null, int? positionY = null, bool? dontSetVisibleSize = null, CefSharp.DevTools.Emulation.ScreenOrientation screenOrientation = null, CefSharp.DevTools.Page.Viewport viewport = null); + /// + /// Overrides the values of device screen dimensions (window.screen.width, window.screen.height, + /// window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media + /// query results). + /// + /// Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. + /// Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. + /// Overriding device scale factor value. 0 disables the override. + /// Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text + public async System.Threading.Tasks.Task SetDeviceMetricsOverrideAsync(int width, int height, long deviceScaleFactor, bool mobile, long? scale = null, int? screenWidth = null, int? screenHeight = null, int? positionX = null, int? positionY = null, bool? dontSetVisibleSize = null, CefSharp.DevTools.Emulation.ScreenOrientation screenOrientation = null, CefSharp.DevTools.Page.Viewport viewport = null) + { + ValidateSetDeviceMetricsOverride(width, height, deviceScaleFactor, mobile, scale, screenWidth, screenHeight, positionX, positionY, dontSetVisibleSize, screenOrientation, viewport); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("width", width); + dict.Add("height", height); + dict.Add("deviceScaleFactor", deviceScaleFactor); + dict.Add("mobile", mobile); + if (scale.HasValue) + { + dict.Add("scale", scale.Value); + } + + if (screenWidth.HasValue) + { + dict.Add("screenWidth", screenWidth.Value); + } + + if (screenHeight.HasValue) + { + dict.Add("screenHeight", screenHeight.Value); + } + + if (positionX.HasValue) + { + dict.Add("positionX", positionX.Value); + } + + if (positionY.HasValue) + { + dict.Add("positionY", positionY.Value); + } + + if (dontSetVisibleSize.HasValue) + { + dict.Add("dontSetVisibleSize", dontSetVisibleSize.Value); + } + + if ((screenOrientation) != (null)) + { + dict.Add("screenOrientation", screenOrientation.ToDictionary()); + } + + if ((viewport) != (null)) + { + dict.Add("viewport", viewport.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setDeviceMetricsOverride", dict); + return methodResult; + } + + partial void ValidateSetScrollbarsHidden(bool hidden); + /// + /// SetScrollbarsHidden + /// + /// Whether scrollbars should be always hidden. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetScrollbarsHiddenAsync(bool hidden) + { + ValidateSetScrollbarsHidden(hidden); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("hidden", hidden); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setScrollbarsHidden", dict); + return methodResult; + } + + partial void ValidateSetDocumentCookieDisabled(bool disabled); + /// + /// SetDocumentCookieDisabled + /// + /// Whether document.coookie API should be disabled. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetDocumentCookieDisabledAsync(bool disabled) + { + ValidateSetDocumentCookieDisabled(disabled); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("disabled", disabled); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setDocumentCookieDisabled", dict); + return methodResult; + } + + partial void ValidateSetEmitTouchEventsForMouse(bool enabled, string configuration = null); + /// + /// SetEmitTouchEventsForMouse + /// + /// Whether touch emulation based on mouse input should be enabled. + /// Touch/gesture events configuration. Default: current platform. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetEmitTouchEventsForMouseAsync(bool enabled, string configuration = null) + { + ValidateSetEmitTouchEventsForMouse(enabled, configuration); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enabled", enabled); + if (!(string.IsNullOrEmpty(configuration))) + { + dict.Add("configuration", configuration); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setEmitTouchEventsForMouse", dict); + return methodResult; + } + + partial void ValidateSetEmulatedMedia(string media = null, System.Collections.Generic.IList features = null); + /// + /// Emulates the given media type or media feature for CSS media queries. + /// + /// Media type to emulate. Empty string disables the override. + /// Media features to emulate. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetEmulatedMediaAsync(string media = null, System.Collections.Generic.IList features = null) + { + ValidateSetEmulatedMedia(media, features); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(media))) + { + dict.Add("media", media); + } + + if ((features) != (null)) + { + dict.Add("features", features.Select(x => x.ToDictionary())); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setEmulatedMedia", dict); + return methodResult; + } + + partial void ValidateSetEmulatedVisionDeficiency(string type); + /// + /// Emulates the given vision deficiency. + /// + /// Vision deficiency to emulate. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetEmulatedVisionDeficiencyAsync(string type) + { + ValidateSetEmulatedVisionDeficiency(type); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("type", type); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setEmulatedVisionDeficiency", dict); + return methodResult; + } + + partial void ValidateSetGeolocationOverride(long? latitude = null, long? longitude = null, long? accuracy = null); + /// + /// Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position + /// unavailable. + /// + /// Mock latitude + /// Mock longitude + /// Mock accuracy + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetGeolocationOverrideAsync(long? latitude = null, long? longitude = null, long? accuracy = null) + { + ValidateSetGeolocationOverride(latitude, longitude, accuracy); + var dict = new System.Collections.Generic.Dictionary(); + if (latitude.HasValue) + { + dict.Add("latitude", latitude.Value); + } + + if (longitude.HasValue) + { + dict.Add("longitude", longitude.Value); + } + + if (accuracy.HasValue) + { + dict.Add("accuracy", accuracy.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setGeolocationOverride", dict); + return methodResult; + } + + partial void ValidateSetPageScaleFactor(long pageScaleFactor); + /// + /// Sets a specified page scale factor. + /// + /// Page scale factor. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetPageScaleFactorAsync(long pageScaleFactor) + { + ValidateSetPageScaleFactor(pageScaleFactor); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("pageScaleFactor", pageScaleFactor); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setPageScaleFactor", dict); + return methodResult; + } + + partial void ValidateSetScriptExecutionDisabled(bool value); + /// + /// Switches script execution in the page. + /// + /// Whether script execution should be disabled in the page. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetScriptExecutionDisabledAsync(bool value) + { + ValidateSetScriptExecutionDisabled(value); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("value", value); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setScriptExecutionDisabled", dict); + return methodResult; + } + + partial void ValidateSetTouchEmulationEnabled(bool enabled, int? maxTouchPoints = null); + /// + /// Enables touch on platforms which do not support them. + /// + /// Whether the touch event emulation should be enabled. + /// Maximum touch points supported. Defaults to one. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetTouchEmulationEnabledAsync(bool enabled, int? maxTouchPoints = null) + { + ValidateSetTouchEmulationEnabled(enabled, maxTouchPoints); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enabled", enabled); + if (maxTouchPoints.HasValue) + { + dict.Add("maxTouchPoints", maxTouchPoints.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setTouchEmulationEnabled", dict); + return methodResult; + } + + partial void ValidateSetVirtualTimePolicy(CefSharp.DevTools.Emulation.VirtualTimePolicy policy, long? budget = null, int? maxVirtualTimeTaskStarvationCount = null, bool? waitForNavigation = null, long? initialVirtualTime = null); + /// + /// Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets + /// the current virtual time policy. Note this supersedes any previous time budget. + /// + /// policy + /// If set, after this many virtual milliseconds have elapsed virtual time will be paused and a + public async System.Threading.Tasks.Task SetVirtualTimePolicyAsync(CefSharp.DevTools.Emulation.VirtualTimePolicy policy, long? budget = null, int? maxVirtualTimeTaskStarvationCount = null, bool? waitForNavigation = null, long? initialVirtualTime = null) + { + ValidateSetVirtualTimePolicy(policy, budget, maxVirtualTimeTaskStarvationCount, waitForNavigation, initialVirtualTime); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("policy", this.EnumToString(policy)); + if (budget.HasValue) + { + dict.Add("budget", budget.Value); + } + + if (maxVirtualTimeTaskStarvationCount.HasValue) + { + dict.Add("maxVirtualTimeTaskStarvationCount", maxVirtualTimeTaskStarvationCount.Value); + } + + if (waitForNavigation.HasValue) + { + dict.Add("waitForNavigation", waitForNavigation.Value); + } + + if (initialVirtualTime.HasValue) + { + dict.Add("initialVirtualTime", initialVirtualTime.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setVirtualTimePolicy", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetLocaleOverride(string locale = null); + /// + /// Overrides default host system locale with the specified one. + /// + /// ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and + public async System.Threading.Tasks.Task SetLocaleOverrideAsync(string locale = null) + { + ValidateSetLocaleOverride(locale); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(locale))) + { + dict.Add("locale", locale); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setLocaleOverride", dict); + return methodResult; + } + + partial void ValidateSetTimezoneOverride(string timezoneId); + /// + /// Overrides default host system timezone with the specified one. + /// + /// The timezone identifier. If empty, disables the override and + public async System.Threading.Tasks.Task SetTimezoneOverrideAsync(string timezoneId) + { + ValidateSetTimezoneOverride(timezoneId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("timezoneId", timezoneId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setTimezoneOverride", dict); + return methodResult; + } + + partial void ValidateSetUserAgentOverride(string userAgent, string acceptLanguage = null, string platform = null, CefSharp.DevTools.Emulation.UserAgentMetadata userAgentMetadata = null); + /// + /// Allows overriding user agent with the given string. + /// + /// User agent to use. + /// Browser langugage to emulate. + /// The platform navigator.platform should return. + /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetUserAgentOverrideAsync(string userAgent, string acceptLanguage = null, string platform = null, CefSharp.DevTools.Emulation.UserAgentMetadata userAgentMetadata = null) + { + ValidateSetUserAgentOverride(userAgent, acceptLanguage, platform, userAgentMetadata); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("userAgent", userAgent); + if (!(string.IsNullOrEmpty(acceptLanguage))) + { + dict.Add("acceptLanguage", acceptLanguage); + } + + if (!(string.IsNullOrEmpty(platform))) + { + dict.Add("platform", platform); + } + + if ((userAgentMetadata) != (null)) + { + dict.Add("userAgentMetadata", userAgentMetadata.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Emulation.setUserAgentOverride", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Emulation/Enums/VirtualTimePolicy.cs b/CefSharp/DevTools/Emulation/Enums/VirtualTimePolicy.cs new file mode 100644 index 0000000000..2388924098 --- /dev/null +++ b/CefSharp/DevTools/Emulation/Enums/VirtualTimePolicy.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Emulation +{ + /// + /// advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to + /// allow the next delayed task (if any) to run; pause: The virtual time base may not advance; + /// pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending + /// resource fetches. + /// + public enum VirtualTimePolicy + { + /// + /// advance + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("advance"))] + Advance, + /// + /// pause + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("pause"))] + Pause, + /// + /// pauseIfNetworkFetchesPending + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("pauseIfNetworkFetchesPending"))] + PauseIfNetworkFetchesPending + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Emulation/MediaFeature.cs b/CefSharp/DevTools/Emulation/MediaFeature.cs new file mode 100644 index 0000000000..53e73d67ba --- /dev/null +++ b/CefSharp/DevTools/Emulation/MediaFeature.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Emulation +{ + /// + /// MediaFeature + /// + [System.Runtime.Serialization.DataContractAttribute] + public class MediaFeature : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Value + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Emulation/ScreenOrientation.cs b/CefSharp/DevTools/Emulation/ScreenOrientation.cs new file mode 100644 index 0000000000..6d3fa0e9b8 --- /dev/null +++ b/CefSharp/DevTools/Emulation/ScreenOrientation.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Emulation +{ + /// + /// Screen orientation. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ScreenOrientation : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Orientation type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// Orientation angle. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("angle"), IsRequired = (true))] + public int Angle + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Emulation/SetVirtualTimePolicyResponse.cs b/CefSharp/DevTools/Emulation/SetVirtualTimePolicyResponse.cs new file mode 100644 index 0000000000..40cdbfa72d --- /dev/null +++ b/CefSharp/DevTools/Emulation/SetVirtualTimePolicyResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Emulation +{ + /// + /// SetVirtualTimePolicyResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetVirtualTimePolicyResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal long virtualTimeTicksBase + { + get; + set; + } + + /// + /// virtualTimeTicksBase + /// + public long VirtualTimeTicksBase + { + get + { + return virtualTimeTicksBase; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Emulation/UserAgentBrandVersion.cs b/CefSharp/DevTools/Emulation/UserAgentBrandVersion.cs new file mode 100644 index 0000000000..e8b93be529 --- /dev/null +++ b/CefSharp/DevTools/Emulation/UserAgentBrandVersion.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Emulation +{ + /// + /// Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints + /// + [System.Runtime.Serialization.DataContractAttribute] + public class UserAgentBrandVersion : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Brand + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("brand"), IsRequired = (true))] + public string Brand + { + get; + set; + } + + /// + /// Version + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("version"), IsRequired = (true))] + public string Version + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Emulation/UserAgentMetadata.cs b/CefSharp/DevTools/Emulation/UserAgentMetadata.cs new file mode 100644 index 0000000000..72c74794b0 --- /dev/null +++ b/CefSharp/DevTools/Emulation/UserAgentMetadata.cs @@ -0,0 +1,82 @@ +// Copyright © 2020 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.DevTools.Emulation +{ + /// + /// Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints + /// + [System.Runtime.Serialization.DataContractAttribute] + public class UserAgentMetadata : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Brands + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("brands"), IsRequired = (true))] + public System.Collections.Generic.IList Brands + { + get; + set; + } + + /// + /// FullVersion + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fullVersion"), IsRequired = (true))] + public string FullVersion + { + get; + set; + } + + /// + /// Platform + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("platform"), IsRequired = (true))] + public string Platform + { + get; + set; + } + + /// + /// PlatformVersion + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("platformVersion"), IsRequired = (true))] + public string PlatformVersion + { + get; + set; + } + + /// + /// Architecture + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("architecture"), IsRequired = (true))] + public string Architecture + { + get; + set; + } + + /// + /// Model + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("model"), IsRequired = (true))] + public string Model + { + get; + set; + } + + /// + /// Mobile + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mobile"), IsRequired = (true))] + public bool Mobile + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Fetch/AuthChallenge.cs b/CefSharp/DevTools/Fetch/AuthChallenge.cs new file mode 100644 index 0000000000..c9795a8471 --- /dev/null +++ b/CefSharp/DevTools/Fetch/AuthChallenge.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Fetch +{ + /// + /// Authorization challenge for HTTP status code 401 or 407. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AuthChallenge : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Source of the authentication challenge. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("source"), IsRequired = (false))] + public string Source + { + get; + set; + } + + /// + /// Origin of the challenger. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("origin"), IsRequired = (true))] + public string Origin + { + get; + set; + } + + /// + /// The authentication scheme used, such as basic or digest + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scheme"), IsRequired = (true))] + public string Scheme + { + get; + set; + } + + /// + /// The realm of the challenge. May be empty. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("realm"), IsRequired = (true))] + public string Realm + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Fetch/AuthChallengeResponse.cs b/CefSharp/DevTools/Fetch/AuthChallengeResponse.cs new file mode 100644 index 0000000000..0a655b149f --- /dev/null +++ b/CefSharp/DevTools/Fetch/AuthChallengeResponse.cs @@ -0,0 +1,46 @@ +// Copyright © 2020 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.DevTools.Fetch +{ + /// + /// Response to an AuthChallenge. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AuthChallengeResponse : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The decision on what to do in response to the authorization challenge. Default means + /// deferring to the default behavior of the net stack, which will likely either the Cancel + /// authentication or display a popup dialog box. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("response"), IsRequired = (true))] + public string Response + { + get; + set; + } + + /// + /// The username to provide, possibly empty. Should only be set if response is + /// ProvideCredentials. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("username"), IsRequired = (false))] + public string Username + { + get; + set; + } + + /// + /// The password to provide, possibly empty. Should only be set if response is + /// ProvideCredentials. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("password"), IsRequired = (false))] + public string Password + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Fetch/Enums/RequestStage.cs b/CefSharp/DevTools/Fetch/Enums/RequestStage.cs new file mode 100644 index 0000000000..805afb7bd7 --- /dev/null +++ b/CefSharp/DevTools/Fetch/Enums/RequestStage.cs @@ -0,0 +1,24 @@ +// Copyright © 2020 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.DevTools.Fetch +{ + /// + /// Stages of the request to handle. Request will intercept before the request is + /// sent. Response will intercept after the response is received (but before response + /// body is received. + /// + public enum RequestStage + { + /// + /// Request + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Request"))] + Request, + /// + /// Response + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Response"))] + Response + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Fetch/Fetch.cs b/CefSharp/DevTools/Fetch/Fetch.cs new file mode 100644 index 0000000000..a63562026b --- /dev/null +++ b/CefSharp/DevTools/Fetch/Fetch.cs @@ -0,0 +1,209 @@ +// Copyright © 2020 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.DevTools.Fetch +{ + using System.Linq; + + /// + /// A domain for letting clients substitute browser's network layer with client code. + /// + public partial class Fetch : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Fetch(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disables the fetch domain. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Fetch.disable", dict); + return methodResult; + } + + partial void ValidateEnable(System.Collections.Generic.IList patterns = null, bool? handleAuthRequests = null); + /// + /// Enables issuing of requestPaused events. A request will be paused until client + /// calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth. + /// + /// If specified, only requests matching any of these patterns will produce + public async System.Threading.Tasks.Task EnableAsync(System.Collections.Generic.IList patterns = null, bool? handleAuthRequests = null) + { + ValidateEnable(patterns, handleAuthRequests); + var dict = new System.Collections.Generic.Dictionary(); + if ((patterns) != (null)) + { + dict.Add("patterns", patterns.Select(x => x.ToDictionary())); + } + + if (handleAuthRequests.HasValue) + { + dict.Add("handleAuthRequests", handleAuthRequests.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Fetch.enable", dict); + return methodResult; + } + + partial void ValidateFailRequest(string requestId, CefSharp.DevTools.Network.ErrorReason errorReason); + /// + /// Causes the request to fail with specified reason. + /// + /// An id the client received in requestPaused event. + /// Causes the request to fail with the given reason. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task FailRequestAsync(string requestId, CefSharp.DevTools.Network.ErrorReason errorReason) + { + ValidateFailRequest(requestId, errorReason); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + dict.Add("errorReason", this.EnumToString(errorReason)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Fetch.failRequest", dict); + return methodResult; + } + + partial void ValidateFulfillRequest(string requestId, int responseCode, System.Collections.Generic.IList responseHeaders = null, byte[] binaryResponseHeaders = null, byte[] body = null, string responsePhrase = null); + /// + /// Provides response to the request. + /// + /// An id the client received in requestPaused event. + /// An HTTP response code. + /// Response headers. + /// Alternative way of specifying response headers as a \0-separated + public async System.Threading.Tasks.Task FulfillRequestAsync(string requestId, int responseCode, System.Collections.Generic.IList responseHeaders = null, byte[] binaryResponseHeaders = null, byte[] body = null, string responsePhrase = null) + { + ValidateFulfillRequest(requestId, responseCode, responseHeaders, binaryResponseHeaders, body, responsePhrase); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + dict.Add("responseCode", responseCode); + if ((responseHeaders) != (null)) + { + dict.Add("responseHeaders", responseHeaders.Select(x => x.ToDictionary())); + } + + if ((binaryResponseHeaders) != (null)) + { + dict.Add("binaryResponseHeaders", ToBase64String(binaryResponseHeaders)); + } + + if ((body) != (null)) + { + dict.Add("body", ToBase64String(body)); + } + + if (!(string.IsNullOrEmpty(responsePhrase))) + { + dict.Add("responsePhrase", responsePhrase); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Fetch.fulfillRequest", dict); + return methodResult; + } + + partial void ValidateContinueRequest(string requestId, string url = null, string method = null, string postData = null, System.Collections.Generic.IList headers = null); + /// + /// Continues the request, optionally modifying some of its parameters. + /// + /// An id the client received in requestPaused event. + /// If set, the request url will be modified in a way that's not observable by page. + /// If set, the request method is overridden. + /// If set, overrides the post data in the request. + /// If set, overrides the request headers. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ContinueRequestAsync(string requestId, string url = null, string method = null, string postData = null, System.Collections.Generic.IList headers = null) + { + ValidateContinueRequest(requestId, url, method, postData, headers); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + if (!(string.IsNullOrEmpty(url))) + { + dict.Add("url", url); + } + + if (!(string.IsNullOrEmpty(method))) + { + dict.Add("method", method); + } + + if (!(string.IsNullOrEmpty(postData))) + { + dict.Add("postData", postData); + } + + if ((headers) != (null)) + { + dict.Add("headers", headers.Select(x => x.ToDictionary())); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Fetch.continueRequest", dict); + return methodResult; + } + + partial void ValidateContinueWithAuth(string requestId, CefSharp.DevTools.Fetch.AuthChallengeResponse authChallengeResponse); + /// + /// Continues a request supplying authChallengeResponse following authRequired event. + /// + /// An id the client received in authRequired event. + /// Response to with an authChallenge. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ContinueWithAuthAsync(string requestId, CefSharp.DevTools.Fetch.AuthChallengeResponse authChallengeResponse) + { + ValidateContinueWithAuth(requestId, authChallengeResponse); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + dict.Add("authChallengeResponse", authChallengeResponse.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Fetch.continueWithAuth", dict); + return methodResult; + } + + partial void ValidateGetResponseBody(string requestId); + /// + /// Causes the body of the response to be received from the server and + /// returned as a single string. May only be issued for a request that + /// is paused in the Response stage and is mutually exclusive with + /// takeResponseBodyForInterceptionAsStream. Calling other methods that + /// affect the request or disabling fetch domain before body is received + /// results in an undefined behavior. + /// + /// Identifier for the intercepted request to get body for. + /// returns System.Threading.Tasks.Task<GetResponseBodyResponse> + public async System.Threading.Tasks.Task GetResponseBodyAsync(string requestId) + { + ValidateGetResponseBody(requestId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Fetch.getResponseBody", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateTakeResponseBodyAsStream(string requestId); + /// + /// Returns a handle to the stream representing the response body. + /// The request must be paused in the HeadersReceived stage. + /// Note that after this command the request can't be continued + /// as is -- client either needs to cancel it or to provide the + /// response body. + /// The stream only supports sequential read, IO.read will fail if the position + /// is specified. + /// This method is mutually exclusive with getResponseBody. + /// Calling other methods that affect the request or disabling fetch + /// domain before body is received results in an undefined behavior. + /// + /// requestId + /// returns System.Threading.Tasks.Task<TakeResponseBodyAsStreamResponse> + public async System.Threading.Tasks.Task TakeResponseBodyAsStreamAsync(string requestId) + { + ValidateTakeResponseBodyAsStream(requestId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Fetch.takeResponseBodyAsStream", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Fetch/GetResponseBodyResponse.cs b/CefSharp/DevTools/Fetch/GetResponseBodyResponse.cs new file mode 100644 index 0000000000..be6c7e4a24 --- /dev/null +++ b/CefSharp/DevTools/Fetch/GetResponseBodyResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Fetch +{ + /// + /// GetResponseBodyResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetResponseBodyResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string body + { + get; + set; + } + + /// + /// body + /// + public string Body + { + get + { + return body; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal bool base64Encoded + { + get; + set; + } + + /// + /// base64Encoded + /// + public bool Base64Encoded + { + get + { + return base64Encoded; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Fetch/HeaderEntry.cs b/CefSharp/DevTools/Fetch/HeaderEntry.cs new file mode 100644 index 0000000000..e7c52a924f --- /dev/null +++ b/CefSharp/DevTools/Fetch/HeaderEntry.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Fetch +{ + /// + /// Response HTTP header entry + /// + [System.Runtime.Serialization.DataContractAttribute] + public class HeaderEntry : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Value + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Fetch/RequestPattern.cs b/CefSharp/DevTools/Fetch/RequestPattern.cs new file mode 100644 index 0000000000..5990e0ced3 --- /dev/null +++ b/CefSharp/DevTools/Fetch/RequestPattern.cs @@ -0,0 +1,69 @@ +// Copyright © 2020 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.DevTools.Fetch +{ + /// + /// RequestPattern + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestPattern : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is + /// backslash. Omitting is equivalent to "*". + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("urlPattern"), IsRequired = (false))] + public string UrlPattern + { + get; + set; + } + + public CefSharp.DevTools.Network.ResourceType? ResourceType + { + get + { + return (CefSharp.DevTools.Network.ResourceType? )(StringToEnum(typeof(CefSharp.DevTools.Network.ResourceType? ), resourceType)); + } + + set + { + resourceType = (EnumToString(value)); + } + } + + /// + /// If set, only requests for matching resource types will be intercepted. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("resourceType"), IsRequired = (false))] + internal string resourceType + { + get; + set; + } + + public CefSharp.DevTools.Fetch.RequestStage? RequestStage + { + get + { + return (CefSharp.DevTools.Fetch.RequestStage? )(StringToEnum(typeof(CefSharp.DevTools.Fetch.RequestStage? ), requestStage)); + } + + set + { + requestStage = (EnumToString(value)); + } + } + + /// + /// Stage at wich to begin intercepting requests. Default is Request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestStage"), IsRequired = (false))] + internal string requestStage + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Fetch/TakeResponseBodyAsStreamResponse.cs b/CefSharp/DevTools/Fetch/TakeResponseBodyAsStreamResponse.cs new file mode 100644 index 0000000000..44e5359785 --- /dev/null +++ b/CefSharp/DevTools/Fetch/TakeResponseBodyAsStreamResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Fetch +{ + /// + /// TakeResponseBodyAsStreamResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TakeResponseBodyAsStreamResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string stream + { + get; + set; + } + + /// + /// stream + /// + public string Stream + { + get + { + return stream; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Headers.cs b/CefSharp/DevTools/Headers.cs new file mode 100644 index 0000000000..ef74002317 --- /dev/null +++ b/CefSharp/DevTools/Headers.cs @@ -0,0 +1,17 @@ +// Copyright © 2020 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.Specialized; + +namespace CefSharp.DevTools.Network +{ + //TODO: Properly implement this type + public class Headers : NameValueCollection + { + public NameValueCollection ToDictionary() + { + return this; + } + } +} diff --git a/CefSharp/DevTools/HeadlessExperimental/BeginFrameResponse.cs b/CefSharp/DevTools/HeadlessExperimental/BeginFrameResponse.cs new file mode 100644 index 0000000000..2ff76acf85 --- /dev/null +++ b/CefSharp/DevTools/HeadlessExperimental/BeginFrameResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.HeadlessExperimental +{ + /// + /// BeginFrameResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class BeginFrameResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal bool hasDamage + { + get; + set; + } + + /// + /// hasDamage + /// + public bool HasDamage + { + get + { + return hasDamage; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string screenshotData + { + get; + set; + } + + /// + /// screenshotData + /// + public byte[] ScreenshotData + { + get + { + return Convert(screenshotData); + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeadlessExperimental/HeadlessExperimental.cs b/CefSharp/DevTools/HeadlessExperimental/HeadlessExperimental.cs new file mode 100644 index 0000000000..9c4b0247b3 --- /dev/null +++ b/CefSharp/DevTools/HeadlessExperimental/HeadlessExperimental.cs @@ -0,0 +1,77 @@ +// Copyright © 2020 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.DevTools.HeadlessExperimental +{ + using System.Linq; + + /// + /// This domain provides experimental commands only supported in headless mode. + /// + public partial class HeadlessExperimental : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public HeadlessExperimental(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateBeginFrame(long? frameTimeTicks = null, long? interval = null, bool? noDisplayUpdates = null, CefSharp.DevTools.HeadlessExperimental.ScreenshotParams screenshot = null); + /// + /// Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a + /// screenshot from the resulting frame. Requires that the target was created with enabled + /// BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also + /// https://goo.gl/3zHXhB for more background. + /// + /// Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set, + public async System.Threading.Tasks.Task BeginFrameAsync(long? frameTimeTicks = null, long? interval = null, bool? noDisplayUpdates = null, CefSharp.DevTools.HeadlessExperimental.ScreenshotParams screenshot = null) + { + ValidateBeginFrame(frameTimeTicks, interval, noDisplayUpdates, screenshot); + var dict = new System.Collections.Generic.Dictionary(); + if (frameTimeTicks.HasValue) + { + dict.Add("frameTimeTicks", frameTimeTicks.Value); + } + + if (interval.HasValue) + { + dict.Add("interval", interval.Value); + } + + if (noDisplayUpdates.HasValue) + { + dict.Add("noDisplayUpdates", noDisplayUpdates.Value); + } + + if ((screenshot) != (null)) + { + dict.Add("screenshot", screenshot.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeadlessExperimental.beginFrame", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Disables headless events for the target. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeadlessExperimental.disable", dict); + return methodResult; + } + + /// + /// Enables headless events for the target. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeadlessExperimental.enable", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeadlessExperimental/ScreenshotParams.cs b/CefSharp/DevTools/HeadlessExperimental/ScreenshotParams.cs new file mode 100644 index 0000000000..9b4637313a --- /dev/null +++ b/CefSharp/DevTools/HeadlessExperimental/ScreenshotParams.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.HeadlessExperimental +{ + /// + /// Encoding options for a screenshot. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ScreenshotParams : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Image compression format (defaults to png). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("format"), IsRequired = (false))] + public string Format + { + get; + set; + } + + /// + /// Compression quality from range [0..100] (jpeg only). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("quality"), IsRequired = (false))] + public int? Quality + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeapProfiler/GetHeapObjectIdResponse.cs b/CefSharp/DevTools/HeapProfiler/GetHeapObjectIdResponse.cs new file mode 100644 index 0000000000..acd2faca2a --- /dev/null +++ b/CefSharp/DevTools/HeapProfiler/GetHeapObjectIdResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.HeapProfiler +{ + /// + /// GetHeapObjectIdResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetHeapObjectIdResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string heapSnapshotObjectId + { + get; + set; + } + + /// + /// heapSnapshotObjectId + /// + public string HeapSnapshotObjectId + { + get + { + return heapSnapshotObjectId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeapProfiler/GetObjectByHeapObjectIdResponse.cs b/CefSharp/DevTools/HeapProfiler/GetObjectByHeapObjectIdResponse.cs new file mode 100644 index 0000000000..d822d6b1e0 --- /dev/null +++ b/CefSharp/DevTools/HeapProfiler/GetObjectByHeapObjectIdResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.HeapProfiler +{ + /// + /// GetObjectByHeapObjectIdResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetObjectByHeapObjectIdResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject result + { + get; + set; + } + + /// + /// result + /// + public CefSharp.DevTools.Runtime.RemoteObject Result + { + get + { + return result; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeapProfiler/GetSamplingProfileResponse.cs b/CefSharp/DevTools/HeapProfiler/GetSamplingProfileResponse.cs new file mode 100644 index 0000000000..de6004dca3 --- /dev/null +++ b/CefSharp/DevTools/HeapProfiler/GetSamplingProfileResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.HeapProfiler +{ + /// + /// GetSamplingProfileResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetSamplingProfileResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.HeapProfiler.SamplingHeapProfile profile + { + get; + set; + } + + /// + /// profile + /// + public CefSharp.DevTools.HeapProfiler.SamplingHeapProfile Profile + { + get + { + return profile; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeapProfiler/HeapProfiler.cs b/CefSharp/DevTools/HeapProfiler/HeapProfiler.cs new file mode 100644 index 0000000000..2b8e351b1b --- /dev/null +++ b/CefSharp/DevTools/HeapProfiler/HeapProfiler.cs @@ -0,0 +1,211 @@ +// Copyright © 2020 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.DevTools.HeapProfiler +{ + using System.Linq; + + /// + /// HeapProfiler + /// + public partial class HeapProfiler : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public HeapProfiler(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateAddInspectedHeapObject(string heapObjectId); + /// + /// Enables console to refer to the node with given id via $x (see Command Line API for more details + /// $x functions). + /// + /// Heap snapshot object id to be accessible by means of $x command line API. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task AddInspectedHeapObjectAsync(string heapObjectId) + { + ValidateAddInspectedHeapObject(heapObjectId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("heapObjectId", heapObjectId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.addInspectedHeapObject", dict); + return methodResult; + } + + /// + /// CollectGarbage + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task CollectGarbageAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.collectGarbage", dict); + return methodResult; + } + + /// + /// Disable + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.disable", dict); + return methodResult; + } + + /// + /// Enable + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.enable", dict); + return methodResult; + } + + partial void ValidateGetHeapObjectId(string objectId); + /// + /// GetHeapObjectId + /// + /// Identifier of the object to get heap object id for. + /// returns System.Threading.Tasks.Task<GetHeapObjectIdResponse> + public async System.Threading.Tasks.Task GetHeapObjectIdAsync(string objectId) + { + ValidateGetHeapObjectId(objectId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectId", objectId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.getHeapObjectId", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetObjectByHeapObjectId(string objectId, string objectGroup = null); + /// + /// GetObjectByHeapObjectId + /// + /// objectId + /// Symbolic group name that can be used to release multiple objects. + /// returns System.Threading.Tasks.Task<GetObjectByHeapObjectIdResponse> + public async System.Threading.Tasks.Task GetObjectByHeapObjectIdAsync(string objectId, string objectGroup = null) + { + ValidateGetObjectByHeapObjectId(objectId, objectGroup); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectId", objectId); + if (!(string.IsNullOrEmpty(objectGroup))) + { + dict.Add("objectGroup", objectGroup); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.getObjectByHeapObjectId", dict); + return methodResult.DeserializeJson(); + } + + /// + /// GetSamplingProfile + /// + /// returns System.Threading.Tasks.Task<GetSamplingProfileResponse> + public async System.Threading.Tasks.Task GetSamplingProfileAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.getSamplingProfile", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateStartSampling(long? samplingInterval = null); + /// + /// StartSampling + /// + /// Average sample interval in bytes. Poisson distribution is used for the intervals. The + public async System.Threading.Tasks.Task StartSamplingAsync(long? samplingInterval = null) + { + ValidateStartSampling(samplingInterval); + var dict = new System.Collections.Generic.Dictionary(); + if (samplingInterval.HasValue) + { + dict.Add("samplingInterval", samplingInterval.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.startSampling", dict); + return methodResult; + } + + partial void ValidateStartTrackingHeapObjects(bool? trackAllocations = null); + /// + /// StartTrackingHeapObjects + /// + /// trackAllocations + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartTrackingHeapObjectsAsync(bool? trackAllocations = null) + { + ValidateStartTrackingHeapObjects(trackAllocations); + var dict = new System.Collections.Generic.Dictionary(); + if (trackAllocations.HasValue) + { + dict.Add("trackAllocations", trackAllocations.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.startTrackingHeapObjects", dict); + return methodResult; + } + + /// + /// StopSampling + /// + /// returns System.Threading.Tasks.Task<StopSamplingResponse> + public async System.Threading.Tasks.Task StopSamplingAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.stopSampling", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateStopTrackingHeapObjects(bool? reportProgress = null, bool? treatGlobalObjectsAsRoots = null); + /// + /// StopTrackingHeapObjects + /// + /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken + public async System.Threading.Tasks.Task StopTrackingHeapObjectsAsync(bool? reportProgress = null, bool? treatGlobalObjectsAsRoots = null) + { + ValidateStopTrackingHeapObjects(reportProgress, treatGlobalObjectsAsRoots); + var dict = new System.Collections.Generic.Dictionary(); + if (reportProgress.HasValue) + { + dict.Add("reportProgress", reportProgress.Value); + } + + if (treatGlobalObjectsAsRoots.HasValue) + { + dict.Add("treatGlobalObjectsAsRoots", treatGlobalObjectsAsRoots.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.stopTrackingHeapObjects", dict); + return methodResult; + } + + partial void ValidateTakeHeapSnapshot(bool? reportProgress = null, bool? treatGlobalObjectsAsRoots = null); + /// + /// TakeHeapSnapshot + /// + /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. + /// If true, a raw snapshot without artifical roots will be generated + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task TakeHeapSnapshotAsync(bool? reportProgress = null, bool? treatGlobalObjectsAsRoots = null) + { + ValidateTakeHeapSnapshot(reportProgress, treatGlobalObjectsAsRoots); + var dict = new System.Collections.Generic.Dictionary(); + if (reportProgress.HasValue) + { + dict.Add("reportProgress", reportProgress.Value); + } + + if (treatGlobalObjectsAsRoots.HasValue) + { + dict.Add("treatGlobalObjectsAsRoots", treatGlobalObjectsAsRoots.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("HeapProfiler.takeHeapSnapshot", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeapProfiler/SamplingHeapProfile.cs b/CefSharp/DevTools/HeapProfiler/SamplingHeapProfile.cs new file mode 100644 index 0000000000..4e095cdb0b --- /dev/null +++ b/CefSharp/DevTools/HeapProfiler/SamplingHeapProfile.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.HeapProfiler +{ + /// + /// Sampling profile. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SamplingHeapProfile : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Head + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("head"), IsRequired = (true))] + public CefSharp.DevTools.HeapProfiler.SamplingHeapProfileNode Head + { + get; + set; + } + + /// + /// Samples + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("samples"), IsRequired = (true))] + public System.Collections.Generic.IList Samples + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeapProfiler/SamplingHeapProfileNode.cs b/CefSharp/DevTools/HeapProfiler/SamplingHeapProfileNode.cs new file mode 100644 index 0000000000..3da63ef3bd --- /dev/null +++ b/CefSharp/DevTools/HeapProfiler/SamplingHeapProfileNode.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.HeapProfiler +{ + /// + /// Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SamplingHeapProfileNode : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Function location. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("callFrame"), IsRequired = (true))] + public CefSharp.DevTools.Runtime.CallFrame CallFrame + { + get; + set; + } + + /// + /// Allocations size in bytes for the node excluding children. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("selfSize"), IsRequired = (true))] + public long SelfSize + { + get; + set; + } + + /// + /// Node id. Ids are unique across all profiles collected between startSampling and stopSampling. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("id"), IsRequired = (true))] + public int Id + { + get; + set; + } + + /// + /// Child nodes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("children"), IsRequired = (true))] + public System.Collections.Generic.IList Children + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeapProfiler/SamplingHeapProfileSample.cs b/CefSharp/DevTools/HeapProfiler/SamplingHeapProfileSample.cs new file mode 100644 index 0000000000..c33059ee9f --- /dev/null +++ b/CefSharp/DevTools/HeapProfiler/SamplingHeapProfileSample.cs @@ -0,0 +1,43 @@ +// Copyright © 2020 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.DevTools.HeapProfiler +{ + /// + /// A single sample from a sampling profile. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SamplingHeapProfileSample : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Allocation size in bytes attributed to the sample. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("size"), IsRequired = (true))] + public long Size + { + get; + set; + } + + /// + /// Id of the corresponding profile tree node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeId"), IsRequired = (true))] + public int NodeId + { + get; + set; + } + + /// + /// Time-ordered sample ordinal number. It is unique across all profiles retrieved + /// between startSampling and stopSampling. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("ordinal"), IsRequired = (true))] + public long Ordinal + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/HeapProfiler/StopSamplingResponse.cs b/CefSharp/DevTools/HeapProfiler/StopSamplingResponse.cs new file mode 100644 index 0000000000..76d2293517 --- /dev/null +++ b/CefSharp/DevTools/HeapProfiler/StopSamplingResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.HeapProfiler +{ + /// + /// StopSamplingResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class StopSamplingResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.HeapProfiler.SamplingHeapProfile profile + { + get; + set; + } + + /// + /// profile + /// + public CefSharp.DevTools.HeapProfiler.SamplingHeapProfile Profile + { + get + { + return profile; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IDevToolsClient.cs b/CefSharp/DevTools/IDevToolsClient.cs new file mode 100644 index 0000000000..510c3b3ec3 --- /dev/null +++ b/CefSharp/DevTools/IDevToolsClient.cs @@ -0,0 +1,26 @@ +// Copyright © 2020 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; +using System.Threading.Tasks; + +namespace CefSharp.DevTools +{ + /// + /// DevTools Client + /// + public interface IDevToolsClient + { + /// + /// Execute a method call over the DevTools protocol. This method can be called on any thread. + /// See the DevTools protocol documentation at https://chromedevtools.github.io/devtools-protocol/ for details + /// of supported methods and the expected dictionary contents. + /// + /// is the method name + /// are the method parameters represented as a dictionary, + /// which may be empty. + /// return a Task that can be awaited to obtain the method result + Task ExecuteDevToolsMethodAsync(string method, IDictionary parameters = null); + } +} diff --git a/CefSharp/DevTools/IO/IO.cs b/CefSharp/DevTools/IO/IO.cs new file mode 100644 index 0000000000..d65eaf845f --- /dev/null +++ b/CefSharp/DevTools/IO/IO.cs @@ -0,0 +1,74 @@ +// Copyright © 2020 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.DevTools.IO +{ + using System.Linq; + + /// + /// Input/Output operations for streams produced by DevTools. + /// + public partial class IO : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public IO(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateClose(string handle); + /// + /// Close the stream, discard any temporary backing storage. + /// + /// Handle of the stream to close. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task CloseAsync(string handle) + { + ValidateClose(handle); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("handle", handle); + var methodResult = await _client.ExecuteDevToolsMethodAsync("IO.close", dict); + return methodResult; + } + + partial void ValidateRead(string handle, int? offset = null, int? size = null); + /// + /// Read a chunk of the stream + /// + /// Handle of the stream to read. + /// Seek to the specified offset before reading (if not specificed, proceed with offset + public async System.Threading.Tasks.Task ReadAsync(string handle, int? offset = null, int? size = null) + { + ValidateRead(handle, offset, size); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("handle", handle); + if (offset.HasValue) + { + dict.Add("offset", offset.Value); + } + + if (size.HasValue) + { + dict.Add("size", size.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("IO.read", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateResolveBlob(string objectId); + /// + /// Return UUID of Blob object specified by a remote object id. + /// + /// Object id of a Blob object wrapper. + /// returns System.Threading.Tasks.Task<ResolveBlobResponse> + public async System.Threading.Tasks.Task ResolveBlobAsync(string objectId) + { + ValidateResolveBlob(objectId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectId", objectId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("IO.resolveBlob", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IO/ReadResponse.cs b/CefSharp/DevTools/IO/ReadResponse.cs new file mode 100644 index 0000000000..78e16114b9 --- /dev/null +++ b/CefSharp/DevTools/IO/ReadResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.IO +{ + /// + /// ReadResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ReadResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal bool? base64Encoded + { + get; + set; + } + + /// + /// base64Encoded + /// + public bool? Base64Encoded + { + get + { + return base64Encoded; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string data + { + get; + set; + } + + /// + /// data + /// + public string Data + { + get + { + return data; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal bool eof + { + get; + set; + } + + /// + /// eof + /// + public bool Eof + { + get + { + return eof; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IO/ResolveBlobResponse.cs b/CefSharp/DevTools/IO/ResolveBlobResponse.cs new file mode 100644 index 0000000000..e8ab16b8ae --- /dev/null +++ b/CefSharp/DevTools/IO/ResolveBlobResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.IO +{ + /// + /// ResolveBlobResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ResolveBlobResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string uuid + { + get; + set; + } + + /// + /// uuid + /// + public string Uuid + { + get + { + return uuid; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/DataEntry.cs b/CefSharp/DevTools/IndexedDB/DataEntry.cs new file mode 100644 index 0000000000..51203869e0 --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/DataEntry.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// Data entry. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class DataEntry : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Key object. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("key"), IsRequired = (true))] + public CefSharp.DevTools.Runtime.RemoteObject Key + { + get; + set; + } + + /// + /// Primary key object. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("primaryKey"), IsRequired = (true))] + public CefSharp.DevTools.Runtime.RemoteObject PrimaryKey + { + get; + set; + } + + /// + /// Value object. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public CefSharp.DevTools.Runtime.RemoteObject Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/DatabaseWithObjectStores.cs b/CefSharp/DevTools/IndexedDB/DatabaseWithObjectStores.cs new file mode 100644 index 0000000000..9649251ded --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/DatabaseWithObjectStores.cs @@ -0,0 +1,43 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// Database with an array of object stores. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class DatabaseWithObjectStores : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Database name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Database version (type is not 'integer', as the standard + /// requires the version number to be 'unsigned long long') + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("version"), IsRequired = (true))] + public long Version + { + get; + set; + } + + /// + /// Object stores in this database. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("objectStores"), IsRequired = (true))] + public System.Collections.Generic.IList ObjectStores + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/GetMetadataResponse.cs b/CefSharp/DevTools/IndexedDB/GetMetadataResponse.cs new file mode 100644 index 0000000000..c530c5b1f9 --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/GetMetadataResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// GetMetadataResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetMetadataResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal long entriesCount + { + get; + set; + } + + /// + /// entriesCount + /// + public long EntriesCount + { + get + { + return entriesCount; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal long keyGeneratorValue + { + get; + set; + } + + /// + /// keyGeneratorValue + /// + public long KeyGeneratorValue + { + get + { + return keyGeneratorValue; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/IndexedDB.cs b/CefSharp/DevTools/IndexedDB/IndexedDB.cs new file mode 100644 index 0000000000..c5e4dc1ba4 --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/IndexedDB.cs @@ -0,0 +1,180 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + using System.Linq; + + /// + /// IndexedDB + /// + public partial class IndexedDB : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public IndexedDB(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateClearObjectStore(string securityOrigin, string databaseName, string objectStoreName); + /// + /// Clears all entries from an object store. + /// + /// Security origin. + /// Database name. + /// Object store name. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearObjectStoreAsync(string securityOrigin, string databaseName, string objectStoreName) + { + ValidateClearObjectStore(securityOrigin, databaseName, objectStoreName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("securityOrigin", securityOrigin); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); + var methodResult = await _client.ExecuteDevToolsMethodAsync("IndexedDB.clearObjectStore", dict); + return methodResult; + } + + partial void ValidateDeleteDatabase(string securityOrigin, string databaseName); + /// + /// Deletes a database. + /// + /// Security origin. + /// Database name. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DeleteDatabaseAsync(string securityOrigin, string databaseName) + { + ValidateDeleteDatabase(securityOrigin, databaseName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("securityOrigin", securityOrigin); + dict.Add("databaseName", databaseName); + var methodResult = await _client.ExecuteDevToolsMethodAsync("IndexedDB.deleteDatabase", dict); + return methodResult; + } + + partial void ValidateDeleteObjectStoreEntries(string securityOrigin, string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange); + /// + /// Delete a range of entries from an object store + /// + /// securityOrigin + /// databaseName + /// objectStoreName + /// Range of entry keys to delete + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DeleteObjectStoreEntriesAsync(string securityOrigin, string databaseName, string objectStoreName, CefSharp.DevTools.IndexedDB.KeyRange keyRange) + { + ValidateDeleteObjectStoreEntries(securityOrigin, databaseName, objectStoreName, keyRange); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("securityOrigin", securityOrigin); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); + dict.Add("keyRange", keyRange.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("IndexedDB.deleteObjectStoreEntries", dict); + return methodResult; + } + + /// + /// Disables events from backend. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("IndexedDB.disable", dict); + return methodResult; + } + + /// + /// Enables events from backend. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("IndexedDB.enable", dict); + return methodResult; + } + + partial void ValidateRequestData(string securityOrigin, string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null); + /// + /// Requests data from object store or index. + /// + /// Security origin. + /// Database name. + /// Object store name. + /// Index name, empty string for object store data requests. + /// Number of records to skip. + /// Number of records to fetch. + /// Key range. + /// returns System.Threading.Tasks.Task<RequestDataResponse> + public async System.Threading.Tasks.Task RequestDataAsync(string securityOrigin, string databaseName, string objectStoreName, string indexName, int skipCount, int pageSize, CefSharp.DevTools.IndexedDB.KeyRange keyRange = null) + { + ValidateRequestData(securityOrigin, databaseName, objectStoreName, indexName, skipCount, pageSize, keyRange); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("securityOrigin", securityOrigin); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); + dict.Add("indexName", indexName); + dict.Add("skipCount", skipCount); + dict.Add("pageSize", pageSize); + if ((keyRange) != (null)) + { + dict.Add("keyRange", keyRange.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("IndexedDB.requestData", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetMetadata(string securityOrigin, string databaseName, string objectStoreName); + /// + /// Gets metadata of an object store + /// + /// Security origin. + /// Database name. + /// Object store name. + /// returns System.Threading.Tasks.Task<GetMetadataResponse> + public async System.Threading.Tasks.Task GetMetadataAsync(string securityOrigin, string databaseName, string objectStoreName) + { + ValidateGetMetadata(securityOrigin, databaseName, objectStoreName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("securityOrigin", securityOrigin); + dict.Add("databaseName", databaseName); + dict.Add("objectStoreName", objectStoreName); + var methodResult = await _client.ExecuteDevToolsMethodAsync("IndexedDB.getMetadata", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateRequestDatabase(string securityOrigin, string databaseName); + /// + /// Requests database with given name in given frame. + /// + /// Security origin. + /// Database name. + /// returns System.Threading.Tasks.Task<RequestDatabaseResponse> + public async System.Threading.Tasks.Task RequestDatabaseAsync(string securityOrigin, string databaseName) + { + ValidateRequestDatabase(securityOrigin, databaseName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("securityOrigin", securityOrigin); + dict.Add("databaseName", databaseName); + var methodResult = await _client.ExecuteDevToolsMethodAsync("IndexedDB.requestDatabase", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateRequestDatabaseNames(string securityOrigin); + /// + /// Requests database names for given security origin. + /// + /// Security origin. + /// returns System.Threading.Tasks.Task<RequestDatabaseNamesResponse> + public async System.Threading.Tasks.Task RequestDatabaseNamesAsync(string securityOrigin) + { + ValidateRequestDatabaseNames(securityOrigin); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("securityOrigin", securityOrigin); + var methodResult = await _client.ExecuteDevToolsMethodAsync("IndexedDB.requestDatabaseNames", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/Key.cs b/CefSharp/DevTools/IndexedDB/Key.cs new file mode 100644 index 0000000000..0305cf8380 --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/Key.cs @@ -0,0 +1,62 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// Key. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Key : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Key type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// Number value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("number"), IsRequired = (false))] + public long? Number + { + get; + set; + } + + /// + /// String value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("string"), IsRequired = (false))] + public string String + { + get; + set; + } + + /// + /// Date value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("date"), IsRequired = (false))] + public long? Date + { + get; + set; + } + + /// + /// Array value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("array"), IsRequired = (false))] + public System.Collections.Generic.IList Array + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/KeyPath.cs b/CefSharp/DevTools/IndexedDB/KeyPath.cs new file mode 100644 index 0000000000..10fae46c3e --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/KeyPath.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// Key path. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class KeyPath : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Key path type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// String value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("string"), IsRequired = (false))] + public string String + { + get; + set; + } + + /// + /// Array value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("array"), IsRequired = (false))] + public string[] Array + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/KeyRange.cs b/CefSharp/DevTools/IndexedDB/KeyRange.cs new file mode 100644 index 0000000000..2de2f5669d --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/KeyRange.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// Key range. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class KeyRange : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Lower bound. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lower"), IsRequired = (false))] + public CefSharp.DevTools.IndexedDB.Key Lower + { + get; + set; + } + + /// + /// Upper bound. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("upper"), IsRequired = (false))] + public CefSharp.DevTools.IndexedDB.Key Upper + { + get; + set; + } + + /// + /// If true lower bound is open. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lowerOpen"), IsRequired = (true))] + public bool LowerOpen + { + get; + set; + } + + /// + /// If true upper bound is open. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("upperOpen"), IsRequired = (true))] + public bool UpperOpen + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/ObjectStore.cs b/CefSharp/DevTools/IndexedDB/ObjectStore.cs new file mode 100644 index 0000000000..516d826763 --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/ObjectStore.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// Object store. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ObjectStore : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Object store name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Object store key path. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyPath"), IsRequired = (true))] + public CefSharp.DevTools.IndexedDB.KeyPath KeyPath + { + get; + set; + } + + /// + /// If true, object store has auto increment flag set. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("autoIncrement"), IsRequired = (true))] + public bool AutoIncrement + { + get; + set; + } + + /// + /// Indexes in this object store. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("indexes"), IsRequired = (true))] + public System.Collections.Generic.IList Indexes + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/ObjectStoreIndex.cs b/CefSharp/DevTools/IndexedDB/ObjectStoreIndex.cs new file mode 100644 index 0000000000..9a4598cc66 --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/ObjectStoreIndex.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// Object store index. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ObjectStoreIndex : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Index name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Index key path. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyPath"), IsRequired = (true))] + public CefSharp.DevTools.IndexedDB.KeyPath KeyPath + { + get; + set; + } + + /// + /// If true, index is unique. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("unique"), IsRequired = (true))] + public bool Unique + { + get; + set; + } + + /// + /// If true, index allows multiple entries for a key. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("multiEntry"), IsRequired = (true))] + public bool MultiEntry + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/RequestDataResponse.cs b/CefSharp/DevTools/IndexedDB/RequestDataResponse.cs new file mode 100644 index 0000000000..38c85e5a6f --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/RequestDataResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// RequestDataResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestDataResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList objectStoreDataEntries + { + get; + set; + } + + /// + /// objectStoreDataEntries + /// + public System.Collections.Generic.IList ObjectStoreDataEntries + { + get + { + return objectStoreDataEntries; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal bool hasMore + { + get; + set; + } + + /// + /// hasMore + /// + public bool HasMore + { + get + { + return hasMore; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/RequestDatabaseNamesResponse.cs b/CefSharp/DevTools/IndexedDB/RequestDatabaseNamesResponse.cs new file mode 100644 index 0000000000..deaec86cf3 --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/RequestDatabaseNamesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// RequestDatabaseNamesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestDatabaseNamesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] databaseNames + { + get; + set; + } + + /// + /// databaseNames + /// + public string[] DatabaseNames + { + get + { + return databaseNames; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/IndexedDB/RequestDatabaseResponse.cs b/CefSharp/DevTools/IndexedDB/RequestDatabaseResponse.cs new file mode 100644 index 0000000000..9dc0ef0396 --- /dev/null +++ b/CefSharp/DevTools/IndexedDB/RequestDatabaseResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.IndexedDB +{ + /// + /// RequestDatabaseResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestDatabaseResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.IndexedDB.DatabaseWithObjectStores databaseWithObjectStores + { + get; + set; + } + + /// + /// databaseWithObjectStores + /// + public CefSharp.DevTools.IndexedDB.DatabaseWithObjectStores DatabaseWithObjectStores + { + get + { + return databaseWithObjectStores; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Input/Enums/GestureSourceType.cs b/CefSharp/DevTools/Input/Enums/GestureSourceType.cs new file mode 100644 index 0000000000..e6dc3e3c5e --- /dev/null +++ b/CefSharp/DevTools/Input/Enums/GestureSourceType.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.Input +{ + /// + /// GestureSourceType + /// + public enum GestureSourceType + { + /// + /// default + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("default"))] + Default, + /// + /// touch + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("touch"))] + Touch, + /// + /// mouse + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("mouse"))] + Mouse + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Input/Enums/MouseButton.cs b/CefSharp/DevTools/Input/Enums/MouseButton.cs new file mode 100644 index 0000000000..a69b21e01f --- /dev/null +++ b/CefSharp/DevTools/Input/Enums/MouseButton.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Input +{ + /// + /// MouseButton + /// + public enum MouseButton + { + /// + /// none + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("none"))] + None, + /// + /// left + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("left"))] + Left, + /// + /// middle + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("middle"))] + Middle, + /// + /// right + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("right"))] + Right, + /// + /// back + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("back"))] + Back, + /// + /// forward + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("forward"))] + Forward + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Input/Input.cs b/CefSharp/DevTools/Input/Input.cs new file mode 100644 index 0000000000..dadbe82811 --- /dev/null +++ b/CefSharp/DevTools/Input/Input.cs @@ -0,0 +1,400 @@ +// Copyright © 2020 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.DevTools.Input +{ + using System.Linq; + + /// + /// Input + /// + public partial class Input : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Input(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateDispatchKeyEvent(string type, int? modifiers = null, long? timestamp = null, string text = null, string unmodifiedText = null, string keyIdentifier = null, string code = null, string key = null, int? windowsVirtualKeyCode = null, int? nativeVirtualKeyCode = null, bool? autoRepeat = null, bool? isKeypad = null, bool? isSystemKey = null, int? location = null, string[] commands = null); + /// + /// Dispatches a key event to the page. + /// + /// Type of the key event. + /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 + public async System.Threading.Tasks.Task DispatchKeyEventAsync(string type, int? modifiers = null, long? timestamp = null, string text = null, string unmodifiedText = null, string keyIdentifier = null, string code = null, string key = null, int? windowsVirtualKeyCode = null, int? nativeVirtualKeyCode = null, bool? autoRepeat = null, bool? isKeypad = null, bool? isSystemKey = null, int? location = null, string[] commands = null) + { + ValidateDispatchKeyEvent(type, modifiers, timestamp, text, unmodifiedText, keyIdentifier, code, key, windowsVirtualKeyCode, nativeVirtualKeyCode, autoRepeat, isKeypad, isSystemKey, location, commands); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("type", type); + if (modifiers.HasValue) + { + dict.Add("modifiers", modifiers.Value); + } + + if (timestamp.HasValue) + { + dict.Add("timestamp", timestamp.Value); + } + + if (!(string.IsNullOrEmpty(text))) + { + dict.Add("text", text); + } + + if (!(string.IsNullOrEmpty(unmodifiedText))) + { + dict.Add("unmodifiedText", unmodifiedText); + } + + if (!(string.IsNullOrEmpty(keyIdentifier))) + { + dict.Add("keyIdentifier", keyIdentifier); + } + + if (!(string.IsNullOrEmpty(code))) + { + dict.Add("code", code); + } + + if (!(string.IsNullOrEmpty(key))) + { + dict.Add("key", key); + } + + if (windowsVirtualKeyCode.HasValue) + { + dict.Add("windowsVirtualKeyCode", windowsVirtualKeyCode.Value); + } + + if (nativeVirtualKeyCode.HasValue) + { + dict.Add("nativeVirtualKeyCode", nativeVirtualKeyCode.Value); + } + + if (autoRepeat.HasValue) + { + dict.Add("autoRepeat", autoRepeat.Value); + } + + if (isKeypad.HasValue) + { + dict.Add("isKeypad", isKeypad.Value); + } + + if (isSystemKey.HasValue) + { + dict.Add("isSystemKey", isSystemKey.Value); + } + + if (location.HasValue) + { + dict.Add("location", location.Value); + } + + if ((commands) != (null)) + { + dict.Add("commands", commands); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.dispatchKeyEvent", dict); + return methodResult; + } + + partial void ValidateInsertText(string text); + /// + /// This method emulates inserting text that doesn't come from a key press, + /// for example an emoji keyboard or an IME. + /// + /// The text to insert. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task InsertTextAsync(string text) + { + ValidateInsertText(text); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("text", text); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.insertText", dict); + return methodResult; + } + + partial void ValidateDispatchMouseEvent(string type, long x, long y, int? modifiers = null, long? timestamp = null, CefSharp.DevTools.Input.MouseButton? button = null, int? buttons = null, int? clickCount = null, long? deltaX = null, long? deltaY = null, string pointerType = null); + /// + /// Dispatches a mouse event to the page. + /// + /// Type of the mouse event. + /// X coordinate of the event relative to the main frame's viewport in CSS pixels. + /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to + public async System.Threading.Tasks.Task DispatchMouseEventAsync(string type, long x, long y, int? modifiers = null, long? timestamp = null, CefSharp.DevTools.Input.MouseButton? button = null, int? buttons = null, int? clickCount = null, long? deltaX = null, long? deltaY = null, string pointerType = null) + { + ValidateDispatchMouseEvent(type, x, y, modifiers, timestamp, button, buttons, clickCount, deltaX, deltaY, pointerType); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("type", type); + dict.Add("x", x); + dict.Add("y", y); + if (modifiers.HasValue) + { + dict.Add("modifiers", modifiers.Value); + } + + if (timestamp.HasValue) + { + dict.Add("timestamp", timestamp.Value); + } + + if (button.HasValue) + { + dict.Add("button", this.EnumToString(button)); + } + + if (buttons.HasValue) + { + dict.Add("buttons", buttons.Value); + } + + if (clickCount.HasValue) + { + dict.Add("clickCount", clickCount.Value); + } + + if (deltaX.HasValue) + { + dict.Add("deltaX", deltaX.Value); + } + + if (deltaY.HasValue) + { + dict.Add("deltaY", deltaY.Value); + } + + if (!(string.IsNullOrEmpty(pointerType))) + { + dict.Add("pointerType", pointerType); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.dispatchMouseEvent", dict); + return methodResult; + } + + partial void ValidateDispatchTouchEvent(string type, System.Collections.Generic.IList touchPoints, int? modifiers = null, long? timestamp = null); + /// + /// Dispatches a touch event to the page. + /// + /// Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while + public async System.Threading.Tasks.Task DispatchTouchEventAsync(string type, System.Collections.Generic.IList touchPoints, int? modifiers = null, long? timestamp = null) + { + ValidateDispatchTouchEvent(type, touchPoints, modifiers, timestamp); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("type", type); + dict.Add("touchPoints", touchPoints.Select(x => x.ToDictionary())); + if (modifiers.HasValue) + { + dict.Add("modifiers", modifiers.Value); + } + + if (timestamp.HasValue) + { + dict.Add("timestamp", timestamp.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.dispatchTouchEvent", dict); + return methodResult; + } + + partial void ValidateEmulateTouchFromMouseEvent(string type, int x, int y, CefSharp.DevTools.Input.MouseButton button, long? timestamp = null, long? deltaX = null, long? deltaY = null, int? modifiers = null, int? clickCount = null); + /// + /// Emulates touch event from the mouse event parameters. + /// + /// Type of the mouse event. + /// X coordinate of the mouse pointer in DIP. + /// Y coordinate of the mouse pointer in DIP. + /// Mouse button. Only "none", "left", "right" are supported. + /// Time at which the event occurred (default: current time). + /// X delta in DIP for mouse wheel event (default: 0). + /// Y delta in DIP for mouse wheel event (default: 0). + /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 + public async System.Threading.Tasks.Task EmulateTouchFromMouseEventAsync(string type, int x, int y, CefSharp.DevTools.Input.MouseButton button, long? timestamp = null, long? deltaX = null, long? deltaY = null, int? modifiers = null, int? clickCount = null) + { + ValidateEmulateTouchFromMouseEvent(type, x, y, button, timestamp, deltaX, deltaY, modifiers, clickCount); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("type", type); + dict.Add("x", x); + dict.Add("y", y); + dict.Add("button", this.EnumToString(button)); + if (timestamp.HasValue) + { + dict.Add("timestamp", timestamp.Value); + } + + if (deltaX.HasValue) + { + dict.Add("deltaX", deltaX.Value); + } + + if (deltaY.HasValue) + { + dict.Add("deltaY", deltaY.Value); + } + + if (modifiers.HasValue) + { + dict.Add("modifiers", modifiers.Value); + } + + if (clickCount.HasValue) + { + dict.Add("clickCount", clickCount.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.emulateTouchFromMouseEvent", dict); + return methodResult; + } + + partial void ValidateSetIgnoreInputEvents(bool ignore); + /// + /// Ignores input events (useful while auditing page). + /// + /// Ignores input events processing when set to true. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetIgnoreInputEventsAsync(bool ignore) + { + ValidateSetIgnoreInputEvents(ignore); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("ignore", ignore); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.setIgnoreInputEvents", dict); + return methodResult; + } + + partial void ValidateSynthesizePinchGesture(long x, long y, long scaleFactor, int? relativeSpeed = null, CefSharp.DevTools.Input.GestureSourceType? gestureSourceType = null); + /// + /// Synthesizes a pinch gesture over a time period by issuing appropriate touch events. + /// + /// X coordinate of the start of the gesture in CSS pixels. + /// Y coordinate of the start of the gesture in CSS pixels. + /// Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out). + /// Relative pointer speed in pixels per second (default: 800). + /// Which type of input events to be generated (default: 'default', which queries the platform + public async System.Threading.Tasks.Task SynthesizePinchGestureAsync(long x, long y, long scaleFactor, int? relativeSpeed = null, CefSharp.DevTools.Input.GestureSourceType? gestureSourceType = null) + { + ValidateSynthesizePinchGesture(x, y, scaleFactor, relativeSpeed, gestureSourceType); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("x", x); + dict.Add("y", y); + dict.Add("scaleFactor", scaleFactor); + if (relativeSpeed.HasValue) + { + dict.Add("relativeSpeed", relativeSpeed.Value); + } + + if (gestureSourceType.HasValue) + { + dict.Add("gestureSourceType", this.EnumToString(gestureSourceType)); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.synthesizePinchGesture", dict); + return methodResult; + } + + partial void ValidateSynthesizeScrollGesture(long x, long y, long? xDistance = null, long? yDistance = null, long? xOverscroll = null, long? yOverscroll = null, bool? preventFling = null, int? speed = null, CefSharp.DevTools.Input.GestureSourceType? gestureSourceType = null, int? repeatCount = null, int? repeatDelayMs = null, string interactionMarkerName = null); + /// + /// Synthesizes a scroll gesture over a time period by issuing appropriate touch events. + /// + /// X coordinate of the start of the gesture in CSS pixels. + /// Y coordinate of the start of the gesture in CSS pixels. + /// The distance to scroll along the X axis (positive to scroll left). + /// The distance to scroll along the Y axis (positive to scroll up). + /// The number of additional pixels to scroll back along the X axis, in addition to the given + public async System.Threading.Tasks.Task SynthesizeScrollGestureAsync(long x, long y, long? xDistance = null, long? yDistance = null, long? xOverscroll = null, long? yOverscroll = null, bool? preventFling = null, int? speed = null, CefSharp.DevTools.Input.GestureSourceType? gestureSourceType = null, int? repeatCount = null, int? repeatDelayMs = null, string interactionMarkerName = null) + { + ValidateSynthesizeScrollGesture(x, y, xDistance, yDistance, xOverscroll, yOverscroll, preventFling, speed, gestureSourceType, repeatCount, repeatDelayMs, interactionMarkerName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("x", x); + dict.Add("y", y); + if (xDistance.HasValue) + { + dict.Add("xDistance", xDistance.Value); + } + + if (yDistance.HasValue) + { + dict.Add("yDistance", yDistance.Value); + } + + if (xOverscroll.HasValue) + { + dict.Add("xOverscroll", xOverscroll.Value); + } + + if (yOverscroll.HasValue) + { + dict.Add("yOverscroll", yOverscroll.Value); + } + + if (preventFling.HasValue) + { + dict.Add("preventFling", preventFling.Value); + } + + if (speed.HasValue) + { + dict.Add("speed", speed.Value); + } + + if (gestureSourceType.HasValue) + { + dict.Add("gestureSourceType", this.EnumToString(gestureSourceType)); + } + + if (repeatCount.HasValue) + { + dict.Add("repeatCount", repeatCount.Value); + } + + if (repeatDelayMs.HasValue) + { + dict.Add("repeatDelayMs", repeatDelayMs.Value); + } + + if (!(string.IsNullOrEmpty(interactionMarkerName))) + { + dict.Add("interactionMarkerName", interactionMarkerName); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.synthesizeScrollGesture", dict); + return methodResult; + } + + partial void ValidateSynthesizeTapGesture(long x, long y, int? duration = null, int? tapCount = null, CefSharp.DevTools.Input.GestureSourceType? gestureSourceType = null); + /// + /// Synthesizes a tap gesture over a time period by issuing appropriate touch events. + /// + /// X coordinate of the start of the gesture in CSS pixels. + /// Y coordinate of the start of the gesture in CSS pixels. + /// Duration between touchdown and touchup events in ms (default: 50). + /// Number of times to perform the tap (e.g. 2 for double tap, default: 1). + /// Which type of input events to be generated (default: 'default', which queries the platform + public async System.Threading.Tasks.Task SynthesizeTapGestureAsync(long x, long y, int? duration = null, int? tapCount = null, CefSharp.DevTools.Input.GestureSourceType? gestureSourceType = null) + { + ValidateSynthesizeTapGesture(x, y, duration, tapCount, gestureSourceType); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("x", x); + dict.Add("y", y); + if (duration.HasValue) + { + dict.Add("duration", duration.Value); + } + + if (tapCount.HasValue) + { + dict.Add("tapCount", tapCount.Value); + } + + if (gestureSourceType.HasValue) + { + dict.Add("gestureSourceType", this.EnumToString(gestureSourceType)); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.synthesizeTapGesture", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Input/TouchPoint.cs b/CefSharp/DevTools/Input/TouchPoint.cs new file mode 100644 index 0000000000..71087108e0 --- /dev/null +++ b/CefSharp/DevTools/Input/TouchPoint.cs @@ -0,0 +1,83 @@ +// Copyright © 2020 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.DevTools.Input +{ + /// + /// TouchPoint + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TouchPoint : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// X coordinate of the event relative to the main frame's viewport in CSS pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("x"), IsRequired = (true))] + public long X + { + get; + set; + } + + /// + /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to + /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("y"), IsRequired = (true))] + public long Y + { + get; + set; + } + + /// + /// X radius of the touch area (default: 1.0). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("radiusX"), IsRequired = (false))] + public long? RadiusX + { + get; + set; + } + + /// + /// Y radius of the touch area (default: 1.0). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("radiusY"), IsRequired = (false))] + public long? RadiusY + { + get; + set; + } + + /// + /// Rotation angle (default: 0.0). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("rotationAngle"), IsRequired = (false))] + public long? RotationAngle + { + get; + set; + } + + /// + /// Force (default: 1.0). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("force"), IsRequired = (false))] + public long? Force + { + get; + set; + } + + /// + /// Identifier used to track touch sources between events, must be unique within an event. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("id"), IsRequired = (false))] + public long? Id + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Inspector/Inspector.cs b/CefSharp/DevTools/Inspector/Inspector.cs new file mode 100644 index 0000000000..f1d594c9d0 --- /dev/null +++ b/CefSharp/DevTools/Inspector/Inspector.cs @@ -0,0 +1,41 @@ +// Copyright © 2020 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.DevTools.Inspector +{ + using System.Linq; + + /// + /// Inspector + /// + public partial class Inspector : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Inspector(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disables inspector domain notifications. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Inspector.disable", dict); + return methodResult; + } + + /// + /// Enables inspector domain notifications. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Inspector.enable", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/CompositingReasonsResponse.cs b/CefSharp/DevTools/LayerTree/CompositingReasonsResponse.cs new file mode 100644 index 0000000000..dcde813c32 --- /dev/null +++ b/CefSharp/DevTools/LayerTree/CompositingReasonsResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// CompositingReasonsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CompositingReasonsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] compositingReasons + { + get; + set; + } + + /// + /// compositingReasons + /// + public string[] CompositingReasons + { + get + { + return compositingReasons; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] compositingReasonIds + { + get; + set; + } + + /// + /// compositingReasonIds + /// + public string[] CompositingReasonIds + { + get + { + return compositingReasonIds; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/Layer.cs b/CefSharp/DevTools/LayerTree/Layer.cs new file mode 100644 index 0000000000..76acaa0cdd --- /dev/null +++ b/CefSharp/DevTools/LayerTree/Layer.cs @@ -0,0 +1,173 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// Information about a compositing layer. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Layer : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The unique id for this layer. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("layerId"), IsRequired = (true))] + public string LayerId + { + get; + set; + } + + /// + /// The id of parent (not present for root). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("parentLayerId"), IsRequired = (false))] + public string ParentLayerId + { + get; + set; + } + + /// + /// The backend id for the node associated with this layer. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("backendNodeId"), IsRequired = (false))] + public int? BackendNodeId + { + get; + set; + } + + /// + /// Offset from parent layer, X coordinate. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("offsetX"), IsRequired = (true))] + public long OffsetX + { + get; + set; + } + + /// + /// Offset from parent layer, Y coordinate. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("offsetY"), IsRequired = (true))] + public long OffsetY + { + get; + set; + } + + /// + /// Layer width. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("width"), IsRequired = (true))] + public long Width + { + get; + set; + } + + /// + /// Layer height. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("height"), IsRequired = (true))] + public long Height + { + get; + set; + } + + /// + /// Transformation matrix for layer, default is identity matrix + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("transform"), IsRequired = (false))] + public long[] Transform + { + get; + set; + } + + /// + /// Transform anchor point X, absent if no transform specified + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("anchorX"), IsRequired = (false))] + public long? AnchorX + { + get; + set; + } + + /// + /// Transform anchor point Y, absent if no transform specified + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("anchorY"), IsRequired = (false))] + public long? AnchorY + { + get; + set; + } + + /// + /// Transform anchor point Z, absent if no transform specified + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("anchorZ"), IsRequired = (false))] + public long? AnchorZ + { + get; + set; + } + + /// + /// Indicates how many time this layer has painted. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("paintCount"), IsRequired = (true))] + public int PaintCount + { + get; + set; + } + + /// + /// Indicates whether this layer hosts any content, rather than being used for + /// transform/scrolling purposes only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("drawsContent"), IsRequired = (true))] + public bool DrawsContent + { + get; + set; + } + + /// + /// Set if layer is not visible. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("invisible"), IsRequired = (false))] + public bool? Invisible + { + get; + set; + } + + /// + /// Rectangles scrolling on main thread only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scrollRects"), IsRequired = (false))] + public System.Collections.Generic.IList ScrollRects + { + get; + set; + } + + /// + /// Sticky position constraint information + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("stickyPositionConstraint"), IsRequired = (false))] + public CefSharp.DevTools.LayerTree.StickyPositionConstraint StickyPositionConstraint + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/LayerTree.cs b/CefSharp/DevTools/LayerTree/LayerTree.cs new file mode 100644 index 0000000000..e03d8f7bb8 --- /dev/null +++ b/CefSharp/DevTools/LayerTree/LayerTree.cs @@ -0,0 +1,182 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + using System.Linq; + + /// + /// LayerTree + /// + public partial class LayerTree : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public LayerTree(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateCompositingReasons(string layerId); + /// + /// Provides the reasons why the given layer was composited. + /// + /// The id of the layer for which we want to get the reasons it was composited. + /// returns System.Threading.Tasks.Task<CompositingReasonsResponse> + public async System.Threading.Tasks.Task CompositingReasonsAsync(string layerId) + { + ValidateCompositingReasons(layerId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("layerId", layerId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("LayerTree.compositingReasons", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Disables compositing tree inspection. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("LayerTree.disable", dict); + return methodResult; + } + + /// + /// Enables compositing tree inspection. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("LayerTree.enable", dict); + return methodResult; + } + + partial void ValidateLoadSnapshot(System.Collections.Generic.IList tiles); + /// + /// Returns the snapshot identifier. + /// + /// An array of tiles composing the snapshot. + /// returns System.Threading.Tasks.Task<LoadSnapshotResponse> + public async System.Threading.Tasks.Task LoadSnapshotAsync(System.Collections.Generic.IList tiles) + { + ValidateLoadSnapshot(tiles); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("tiles", tiles.Select(x => x.ToDictionary())); + var methodResult = await _client.ExecuteDevToolsMethodAsync("LayerTree.loadSnapshot", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateMakeSnapshot(string layerId); + /// + /// Returns the layer snapshot identifier. + /// + /// The id of the layer. + /// returns System.Threading.Tasks.Task<MakeSnapshotResponse> + public async System.Threading.Tasks.Task MakeSnapshotAsync(string layerId) + { + ValidateMakeSnapshot(layerId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("layerId", layerId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("LayerTree.makeSnapshot", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateProfileSnapshot(string snapshotId, int? minRepeatCount = null, long? minDuration = null, CefSharp.DevTools.DOM.Rect clipRect = null); + /// + /// ProfileSnapshot + /// + /// The id of the layer snapshot. + /// The maximum number of times to replay the snapshot (1, if not specified). + /// The minimum duration (in seconds) to replay the snapshot. + /// The clip rectangle to apply when replaying the snapshot. + /// returns System.Threading.Tasks.Task<ProfileSnapshotResponse> + public async System.Threading.Tasks.Task ProfileSnapshotAsync(string snapshotId, int? minRepeatCount = null, long? minDuration = null, CefSharp.DevTools.DOM.Rect clipRect = null) + { + ValidateProfileSnapshot(snapshotId, minRepeatCount, minDuration, clipRect); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("snapshotId", snapshotId); + if (minRepeatCount.HasValue) + { + dict.Add("minRepeatCount", minRepeatCount.Value); + } + + if (minDuration.HasValue) + { + dict.Add("minDuration", minDuration.Value); + } + + if ((clipRect) != (null)) + { + dict.Add("clipRect", clipRect.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("LayerTree.profileSnapshot", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateReleaseSnapshot(string snapshotId); + /// + /// Releases layer snapshot captured by the back-end. + /// + /// The id of the layer snapshot. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ReleaseSnapshotAsync(string snapshotId) + { + ValidateReleaseSnapshot(snapshotId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("snapshotId", snapshotId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("LayerTree.releaseSnapshot", dict); + return methodResult; + } + + partial void ValidateReplaySnapshot(string snapshotId, int? fromStep = null, int? toStep = null, long? scale = null); + /// + /// Replays the layer snapshot and returns the resulting bitmap. + /// + /// The id of the layer snapshot. + /// The first step to replay from (replay from the very start if not specified). + /// The last step to replay to (replay till the end if not specified). + /// The scale to apply while replaying (defaults to 1). + /// returns System.Threading.Tasks.Task<ReplaySnapshotResponse> + public async System.Threading.Tasks.Task ReplaySnapshotAsync(string snapshotId, int? fromStep = null, int? toStep = null, long? scale = null) + { + ValidateReplaySnapshot(snapshotId, fromStep, toStep, scale); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("snapshotId", snapshotId); + if (fromStep.HasValue) + { + dict.Add("fromStep", fromStep.Value); + } + + if (toStep.HasValue) + { + dict.Add("toStep", toStep.Value); + } + + if (scale.HasValue) + { + dict.Add("scale", scale.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("LayerTree.replaySnapshot", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSnapshotCommandLog(string snapshotId); + /// + /// Replays the layer snapshot and returns canvas log. + /// + /// The id of the layer snapshot. + /// returns System.Threading.Tasks.Task<SnapshotCommandLogResponse> + public async System.Threading.Tasks.Task SnapshotCommandLogAsync(string snapshotId) + { + ValidateSnapshotCommandLog(snapshotId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("snapshotId", snapshotId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("LayerTree.snapshotCommandLog", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/LoadSnapshotResponse.cs b/CefSharp/DevTools/LayerTree/LoadSnapshotResponse.cs new file mode 100644 index 0000000000..929e609090 --- /dev/null +++ b/CefSharp/DevTools/LayerTree/LoadSnapshotResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// LoadSnapshotResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class LoadSnapshotResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string snapshotId + { + get; + set; + } + + /// + /// snapshotId + /// + public string SnapshotId + { + get + { + return snapshotId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/MakeSnapshotResponse.cs b/CefSharp/DevTools/LayerTree/MakeSnapshotResponse.cs new file mode 100644 index 0000000000..b5d7f8b9a7 --- /dev/null +++ b/CefSharp/DevTools/LayerTree/MakeSnapshotResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// MakeSnapshotResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class MakeSnapshotResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string snapshotId + { + get; + set; + } + + /// + /// snapshotId + /// + public string SnapshotId + { + get + { + return snapshotId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/PictureTile.cs b/CefSharp/DevTools/LayerTree/PictureTile.cs new file mode 100644 index 0000000000..8cb60eac05 --- /dev/null +++ b/CefSharp/DevTools/LayerTree/PictureTile.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// Serialized fragment of layer picture along with its offset within the layer. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PictureTile : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Offset from owning layer left boundary + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("x"), IsRequired = (true))] + public long X + { + get; + set; + } + + /// + /// Offset from owning layer top boundary + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("y"), IsRequired = (true))] + public long Y + { + get; + set; + } + + /// + /// Base64-encoded snapshot data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("picture"), IsRequired = (true))] + public byte[] Picture + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/ProfileSnapshotResponse.cs b/CefSharp/DevTools/LayerTree/ProfileSnapshotResponse.cs new file mode 100644 index 0000000000..d4a9328c9d --- /dev/null +++ b/CefSharp/DevTools/LayerTree/ProfileSnapshotResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// ProfileSnapshotResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ProfileSnapshotResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal long[] timings + { + get; + set; + } + + /// + /// timings + /// + public long[] Timings + { + get + { + return timings; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/ReplaySnapshotResponse.cs b/CefSharp/DevTools/LayerTree/ReplaySnapshotResponse.cs new file mode 100644 index 0000000000..61df5d2d04 --- /dev/null +++ b/CefSharp/DevTools/LayerTree/ReplaySnapshotResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// ReplaySnapshotResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ReplaySnapshotResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string dataURL + { + get; + set; + } + + /// + /// dataURL + /// + public string DataURL + { + get + { + return dataURL; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/ScrollRect.cs b/CefSharp/DevTools/LayerTree/ScrollRect.cs new file mode 100644 index 0000000000..83665b43c2 --- /dev/null +++ b/CefSharp/DevTools/LayerTree/ScrollRect.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// Rectangle where scrolling happens on the main thread. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ScrollRect : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Rectangle itself. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("rect"), IsRequired = (true))] + public CefSharp.DevTools.DOM.Rect Rect + { + get; + set; + } + + /// + /// Reason for rectangle to force scrolling on the main thread + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/SnapshotCommandLogResponse.cs b/CefSharp/DevTools/LayerTree/SnapshotCommandLogResponse.cs new file mode 100644 index 0000000000..86b80ee98f --- /dev/null +++ b/CefSharp/DevTools/LayerTree/SnapshotCommandLogResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// SnapshotCommandLogResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SnapshotCommandLogResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList commandLog + { + get; + set; + } + + /// + /// commandLog + /// + public System.Collections.Generic.IList CommandLog + { + get + { + return commandLog; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/LayerTree/StickyPositionConstraint.cs b/CefSharp/DevTools/LayerTree/StickyPositionConstraint.cs new file mode 100644 index 0000000000..e534858492 --- /dev/null +++ b/CefSharp/DevTools/LayerTree/StickyPositionConstraint.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.LayerTree +{ + /// + /// Sticky position constraints. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class StickyPositionConstraint : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Layout rectangle of the sticky element before being shifted + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("stickyBoxRect"), IsRequired = (true))] + public CefSharp.DevTools.DOM.Rect StickyBoxRect + { + get; + set; + } + + /// + /// Layout rectangle of the containing block of the sticky element + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("containingBlockRect"), IsRequired = (true))] + public CefSharp.DevTools.DOM.Rect ContainingBlockRect + { + get; + set; + } + + /// + /// The nearest sticky layer that shifts the sticky box + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nearestLayerShiftingStickyBox"), IsRequired = (false))] + public string NearestLayerShiftingStickyBox + { + get; + set; + } + + /// + /// The nearest sticky layer that shifts the containing block + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nearestLayerShiftingContainingBlock"), IsRequired = (false))] + public string NearestLayerShiftingContainingBlock + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Log/Log.cs b/CefSharp/DevTools/Log/Log.cs new file mode 100644 index 0000000000..8a01a8c455 --- /dev/null +++ b/CefSharp/DevTools/Log/Log.cs @@ -0,0 +1,79 @@ +// Copyright © 2020 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.DevTools.Log +{ + using System.Linq; + + /// + /// Provides access to log entries. + /// + public partial class Log : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Log(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Clears the log. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Log.clear", dict); + return methodResult; + } + + /// + /// Disables log domain, prevents further log entries from being reported to the client. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Log.disable", dict); + return methodResult; + } + + /// + /// Enables log domain, sends the entries collected so far to the client by means of the + /// `entryAdded` notification. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Log.enable", dict); + return methodResult; + } + + partial void ValidateStartViolationsReport(System.Collections.Generic.IList config); + /// + /// start violation reporting. + /// + /// Configuration for violations. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartViolationsReportAsync(System.Collections.Generic.IList config) + { + ValidateStartViolationsReport(config); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("config", config.Select(x => x.ToDictionary())); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Log.startViolationsReport", dict); + return methodResult; + } + + /// + /// Stop violation reporting. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopViolationsReportAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Log.stopViolationsReport", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Log/LogEntry.cs b/CefSharp/DevTools/Log/LogEntry.cs new file mode 100644 index 0000000000..78aa12402f --- /dev/null +++ b/CefSharp/DevTools/Log/LogEntry.cs @@ -0,0 +1,112 @@ +// Copyright © 2020 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.DevTools.Log +{ + /// + /// Log entry. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class LogEntry : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Log entry source. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("source"), IsRequired = (true))] + public string Source + { + get; + set; + } + + /// + /// Log entry severity. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("level"), IsRequired = (true))] + public string Level + { + get; + set; + } + + /// + /// Logged text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("text"), IsRequired = (true))] + public string Text + { + get; + set; + } + + /// + /// Timestamp when this entry was added. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("timestamp"), IsRequired = (true))] + public long Timestamp + { + get; + set; + } + + /// + /// URL of the resource if known. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (false))] + public string Url + { + get; + set; + } + + /// + /// Line number in the resource. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (false))] + public int? LineNumber + { + get; + set; + } + + /// + /// JavaScript stack trace. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("stackTrace"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.StackTrace StackTrace + { + get; + set; + } + + /// + /// Identifier of the network request associated with this entry. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("networkRequestId"), IsRequired = (false))] + public string NetworkRequestId + { + get; + set; + } + + /// + /// Identifier of the worker associated with this entry. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("workerId"), IsRequired = (false))] + public string WorkerId + { + get; + set; + } + + /// + /// Call arguments. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("args"), IsRequired = (false))] + public System.Collections.Generic.IList Args + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Log/ViolationSetting.cs b/CefSharp/DevTools/Log/ViolationSetting.cs new file mode 100644 index 0000000000..49bd8c62fc --- /dev/null +++ b/CefSharp/DevTools/Log/ViolationSetting.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Log +{ + /// + /// Violation configuration setting. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ViolationSetting : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Violation type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Time threshold to trigger upon. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("threshold"), IsRequired = (true))] + public long Threshold + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Media/Media.cs b/CefSharp/DevTools/Media/Media.cs new file mode 100644 index 0000000000..8509ba8ea8 --- /dev/null +++ b/CefSharp/DevTools/Media/Media.cs @@ -0,0 +1,41 @@ +// Copyright © 2020 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.DevTools.Media +{ + using System.Linq; + + /// + /// This domain allows detailed inspection of media elements + /// + public partial class Media : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Media(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Enables the Media domain + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Media.enable", dict); + return methodResult; + } + + /// + /// Disables the Media domain. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Media.disable", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Media/PlayerError.cs b/CefSharp/DevTools/Media/PlayerError.cs new file mode 100644 index 0000000000..7c0449b474 --- /dev/null +++ b/CefSharp/DevTools/Media/PlayerError.cs @@ -0,0 +1,36 @@ +// Copyright © 2020 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.DevTools.Media +{ + /// + /// Corresponds to kMediaError + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PlayerError : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Type + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// When this switches to using media::Status instead of PipelineStatus + /// we can remove "errorCode" and replace it with the fields from + /// a Status instance. This also seems like a duplicate of the error + /// level enum - there is a todo bug to have that level removed and + /// use this instead. (crbug.com/1068454) + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("errorCode"), IsRequired = (true))] + public string ErrorCode + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Media/PlayerEvent.cs b/CefSharp/DevTools/Media/PlayerEvent.cs new file mode 100644 index 0000000000..667aec1657 --- /dev/null +++ b/CefSharp/DevTools/Media/PlayerEvent.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Media +{ + /// + /// Corresponds to kMediaEventTriggered + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PlayerEvent : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Timestamp + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("timestamp"), IsRequired = (true))] + public long Timestamp + { + get; + set; + } + + /// + /// Value + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Media/PlayerMessage.cs b/CefSharp/DevTools/Media/PlayerMessage.cs new file mode 100644 index 0000000000..858322e989 --- /dev/null +++ b/CefSharp/DevTools/Media/PlayerMessage.cs @@ -0,0 +1,41 @@ +// Copyright © 2020 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.DevTools.Media +{ + /// + /// Have one type per entry in MediaLogRecord::Type + /// Corresponds to kMessage + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PlayerMessage : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Keep in sync with MediaLogMessageLevel + /// We are currently keeping the message level 'error' separate from the + /// PlayerError type because right now they represent different things, + /// this one being a DVLOG(ERROR) style log message that gets printed + /// based on what log level is selected in the UI, and the other is a + /// representation of a media::PipelineStatus object. Soon however we're + /// going to be moving away from using PipelineStatus for errors and + /// introducing a new error type which should hopefully let us integrate + /// the error log level into the PlayerError type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("level"), IsRequired = (true))] + public string Level + { + get; + set; + } + + /// + /// Message + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("message"), IsRequired = (true))] + public string Message + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Media/PlayerProperty.cs b/CefSharp/DevTools/Media/PlayerProperty.cs new file mode 100644 index 0000000000..6da2608622 --- /dev/null +++ b/CefSharp/DevTools/Media/PlayerProperty.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Media +{ + /// + /// Corresponds to kMediaPropertyChange + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PlayerProperty : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Value + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Memory/Enums/PressureLevel.cs b/CefSharp/DevTools/Memory/Enums/PressureLevel.cs new file mode 100644 index 0000000000..9398dcf7d5 --- /dev/null +++ b/CefSharp/DevTools/Memory/Enums/PressureLevel.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Memory +{ + /// + /// Memory pressure level. + /// + public enum PressureLevel + { + /// + /// moderate + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("moderate"))] + Moderate, + /// + /// critical + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("critical"))] + Critical + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Memory/GetAllTimeSamplingProfileResponse.cs b/CefSharp/DevTools/Memory/GetAllTimeSamplingProfileResponse.cs new file mode 100644 index 0000000000..b104460427 --- /dev/null +++ b/CefSharp/DevTools/Memory/GetAllTimeSamplingProfileResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Memory +{ + /// + /// GetAllTimeSamplingProfileResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetAllTimeSamplingProfileResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Memory.SamplingProfile profile + { + get; + set; + } + + /// + /// profile + /// + public CefSharp.DevTools.Memory.SamplingProfile Profile + { + get + { + return profile; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Memory/GetBrowserSamplingProfileResponse.cs b/CefSharp/DevTools/Memory/GetBrowserSamplingProfileResponse.cs new file mode 100644 index 0000000000..8751058a05 --- /dev/null +++ b/CefSharp/DevTools/Memory/GetBrowserSamplingProfileResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Memory +{ + /// + /// GetBrowserSamplingProfileResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetBrowserSamplingProfileResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Memory.SamplingProfile profile + { + get; + set; + } + + /// + /// profile + /// + public CefSharp.DevTools.Memory.SamplingProfile Profile + { + get + { + return profile; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Memory/GetDOMCountersResponse.cs b/CefSharp/DevTools/Memory/GetDOMCountersResponse.cs new file mode 100644 index 0000000000..d32c8d1c88 --- /dev/null +++ b/CefSharp/DevTools/Memory/GetDOMCountersResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.Memory +{ + /// + /// GetDOMCountersResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetDOMCountersResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int documents + { + get; + set; + } + + /// + /// documents + /// + public int Documents + { + get + { + return documents; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal int nodes + { + get; + set; + } + + /// + /// nodes + /// + public int Nodes + { + get + { + return nodes; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal int jsEventListeners + { + get; + set; + } + + /// + /// jsEventListeners + /// + public int JsEventListeners + { + get + { + return jsEventListeners; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Memory/GetSamplingProfileResponse.cs b/CefSharp/DevTools/Memory/GetSamplingProfileResponse.cs new file mode 100644 index 0000000000..92cefd119a --- /dev/null +++ b/CefSharp/DevTools/Memory/GetSamplingProfileResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Memory +{ + /// + /// GetSamplingProfileResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetSamplingProfileResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Memory.SamplingProfile profile + { + get; + set; + } + + /// + /// profile + /// + public CefSharp.DevTools.Memory.SamplingProfile Profile + { + get + { + return profile; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Memory/Memory.cs b/CefSharp/DevTools/Memory/Memory.cs new file mode 100644 index 0000000000..f431e45f29 --- /dev/null +++ b/CefSharp/DevTools/Memory/Memory.cs @@ -0,0 +1,154 @@ +// Copyright © 2020 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.DevTools.Memory +{ + using System.Linq; + + /// + /// Memory + /// + public partial class Memory : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Memory(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// GetDOMCounters + /// + /// returns System.Threading.Tasks.Task<GetDOMCountersResponse> + public async System.Threading.Tasks.Task GetDOMCountersAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.getDOMCounters", dict); + return methodResult.DeserializeJson(); + } + + /// + /// PrepareForLeakDetection + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task PrepareForLeakDetectionAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.prepareForLeakDetection", dict); + return methodResult; + } + + /// + /// Simulate OomIntervention by purging V8 memory. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ForciblyPurgeJavaScriptMemoryAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.forciblyPurgeJavaScriptMemory", dict); + return methodResult; + } + + partial void ValidateSetPressureNotificationsSuppressed(bool suppressed); + /// + /// Enable/disable suppressing memory pressure notifications in all processes. + /// + /// If true, memory pressure notifications will be suppressed. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetPressureNotificationsSuppressedAsync(bool suppressed) + { + ValidateSetPressureNotificationsSuppressed(suppressed); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("suppressed", suppressed); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.setPressureNotificationsSuppressed", dict); + return methodResult; + } + + partial void ValidateSimulatePressureNotification(CefSharp.DevTools.Memory.PressureLevel level); + /// + /// Simulate a memory pressure notification in all processes. + /// + /// Memory pressure level of the notification. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SimulatePressureNotificationAsync(CefSharp.DevTools.Memory.PressureLevel level) + { + ValidateSimulatePressureNotification(level); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("level", this.EnumToString(level)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.simulatePressureNotification", dict); + return methodResult; + } + + partial void ValidateStartSampling(int? samplingInterval = null, bool? suppressRandomness = null); + /// + /// Start collecting native memory profile. + /// + /// Average number of bytes between samples. + /// Do not randomize intervals between samples. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartSamplingAsync(int? samplingInterval = null, bool? suppressRandomness = null) + { + ValidateStartSampling(samplingInterval, suppressRandomness); + var dict = new System.Collections.Generic.Dictionary(); + if (samplingInterval.HasValue) + { + dict.Add("samplingInterval", samplingInterval.Value); + } + + if (suppressRandomness.HasValue) + { + dict.Add("suppressRandomness", suppressRandomness.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.startSampling", dict); + return methodResult; + } + + /// + /// Stop collecting native memory profile. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopSamplingAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.stopSampling", dict); + return methodResult; + } + + /// + /// Retrieve native memory allocations profile + /// collected since renderer process startup. + /// + /// returns System.Threading.Tasks.Task<GetAllTimeSamplingProfileResponse> + public async System.Threading.Tasks.Task GetAllTimeSamplingProfileAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.getAllTimeSamplingProfile", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Retrieve native memory allocations profile + /// collected since browser process startup. + /// + /// returns System.Threading.Tasks.Task<GetBrowserSamplingProfileResponse> + public async System.Threading.Tasks.Task GetBrowserSamplingProfileAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.getBrowserSamplingProfile", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Retrieve native memory allocations profile collected since last + /// `startSampling` call. + /// + /// returns System.Threading.Tasks.Task<GetSamplingProfileResponse> + public async System.Threading.Tasks.Task GetSamplingProfileAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Memory.getSamplingProfile", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Memory/Module.cs b/CefSharp/DevTools/Memory/Module.cs new file mode 100644 index 0000000000..ecddc7ce23 --- /dev/null +++ b/CefSharp/DevTools/Memory/Module.cs @@ -0,0 +1,53 @@ +// Copyright © 2020 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.DevTools.Memory +{ + /// + /// Executable module information + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Module : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name of the module. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// UUID of the module. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("uuid"), IsRequired = (true))] + public string Uuid + { + get; + set; + } + + /// + /// Base address where the module is loaded into memory. Encoded as a decimal + /// or hexadecimal (0x prefixed) string. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("baseAddress"), IsRequired = (true))] + public string BaseAddress + { + get; + set; + } + + /// + /// Size of the module in bytes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("size"), IsRequired = (true))] + public long Size + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Memory/SamplingProfile.cs b/CefSharp/DevTools/Memory/SamplingProfile.cs new file mode 100644 index 0000000000..3c57c2abbd --- /dev/null +++ b/CefSharp/DevTools/Memory/SamplingProfile.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Memory +{ + /// + /// Array of heap profile samples. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SamplingProfile : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Samples + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("samples"), IsRequired = (true))] + public System.Collections.Generic.IList Samples + { + get; + set; + } + + /// + /// Modules + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("modules"), IsRequired = (true))] + public System.Collections.Generic.IList Modules + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Memory/SamplingProfileNode.cs b/CefSharp/DevTools/Memory/SamplingProfileNode.cs new file mode 100644 index 0000000000..f6704db5c0 --- /dev/null +++ b/CefSharp/DevTools/Memory/SamplingProfileNode.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Memory +{ + /// + /// Heap profile sample. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SamplingProfileNode : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Size of the sampled allocation. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("size"), IsRequired = (true))] + public long Size + { + get; + set; + } + + /// + /// Total bytes attributed to this sample. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("total"), IsRequired = (true))] + public long Total + { + get; + set; + } + + /// + /// Execution stack at the point of allocation. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("stack"), IsRequired = (true))] + public string[] Stack + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/MemoryDumpConfig.cs b/CefSharp/DevTools/MemoryDumpConfig.cs new file mode 100644 index 0000000000..ebc98ed2c7 --- /dev/null +++ b/CefSharp/DevTools/MemoryDumpConfig.cs @@ -0,0 +1,10 @@ +// Copyright © 2020 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.DevTools.Tracing +{ + public class MemoryDumpConfig + { + } +} diff --git a/CefSharp/DevTools/Network/AuthChallenge.cs b/CefSharp/DevTools/Network/AuthChallenge.cs new file mode 100644 index 0000000000..414f2597b5 --- /dev/null +++ b/CefSharp/DevTools/Network/AuthChallenge.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Authorization challenge for HTTP status code 401 or 407. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AuthChallenge : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Source of the authentication challenge. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("source"), IsRequired = (false))] + public string Source + { + get; + set; + } + + /// + /// Origin of the challenger. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("origin"), IsRequired = (true))] + public string Origin + { + get; + set; + } + + /// + /// The authentication scheme used, such as basic or digest + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scheme"), IsRequired = (true))] + public string Scheme + { + get; + set; + } + + /// + /// The realm of the challenge. May be empty. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("realm"), IsRequired = (true))] + public string Realm + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/AuthChallengeResponse.cs b/CefSharp/DevTools/Network/AuthChallengeResponse.cs new file mode 100644 index 0000000000..69437c5373 --- /dev/null +++ b/CefSharp/DevTools/Network/AuthChallengeResponse.cs @@ -0,0 +1,46 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Response to an AuthChallenge. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AuthChallengeResponse : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The decision on what to do in response to the authorization challenge. Default means + /// deferring to the default behavior of the net stack, which will likely either the Cancel + /// authentication or display a popup dialog box. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("response"), IsRequired = (true))] + public string Response + { + get; + set; + } + + /// + /// The username to provide, possibly empty. Should only be set if response is + /// ProvideCredentials. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("username"), IsRequired = (false))] + public string Username + { + get; + set; + } + + /// + /// The password to provide, possibly empty. Should only be set if response is + /// ProvideCredentials. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("password"), IsRequired = (false))] + public string Password + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/BlockedCookieWithReason.cs b/CefSharp/DevTools/Network/BlockedCookieWithReason.cs new file mode 100644 index 0000000000..083e9ddefa --- /dev/null +++ b/CefSharp/DevTools/Network/BlockedCookieWithReason.cs @@ -0,0 +1,45 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// A cookie with was not sent with a request with the corresponding reason. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class BlockedCookieWithReason : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Network.CookieBlockedReason[] BlockedReasons + { + get + { + return (CefSharp.DevTools.Network.CookieBlockedReason[])(StringToEnum(typeof(CefSharp.DevTools.Network.CookieBlockedReason[]), blockedReasons)); + } + + set + { + blockedReasons = (EnumToString(value)); + } + } + + /// + /// The reason(s) the cookie was blocked. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("blockedReasons"), IsRequired = (true))] + internal string blockedReasons + { + get; + set; + } + + /// + /// The cookie object representing the cookie which was not sent. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cookie"), IsRequired = (true))] + public CefSharp.DevTools.Network.Cookie Cookie + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/BlockedSetCookieWithReason.cs b/CefSharp/DevTools/Network/BlockedSetCookieWithReason.cs new file mode 100644 index 0000000000..a691c4eec8 --- /dev/null +++ b/CefSharp/DevTools/Network/BlockedSetCookieWithReason.cs @@ -0,0 +1,58 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// A cookie which was not stored from a response with the corresponding reason. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class BlockedSetCookieWithReason : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Network.SetCookieBlockedReason[] BlockedReasons + { + get + { + return (CefSharp.DevTools.Network.SetCookieBlockedReason[])(StringToEnum(typeof(CefSharp.DevTools.Network.SetCookieBlockedReason[]), blockedReasons)); + } + + set + { + blockedReasons = (EnumToString(value)); + } + } + + /// + /// The reason(s) this cookie was blocked. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("blockedReasons"), IsRequired = (true))] + internal string blockedReasons + { + get; + set; + } + + /// + /// The string representing this individual cookie as it would appear in the header. + /// This is not the entire "cookie" or "set-cookie" header which could have multiple cookies. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cookieLine"), IsRequired = (true))] + public string CookieLine + { + get; + set; + } + + /// + /// The cookie object which represents the cookie which was not stored. It is optional because + /// sometimes complete cookie information is not available, such as in the case of parsing + /// errors. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cookie"), IsRequired = (false))] + public CefSharp.DevTools.Network.Cookie Cookie + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/CachedResource.cs b/CefSharp/DevTools/Network/CachedResource.cs new file mode 100644 index 0000000000..e43cdcc528 --- /dev/null +++ b/CefSharp/DevTools/Network/CachedResource.cs @@ -0,0 +1,65 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Information about the cached resource. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CachedResource : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Resource URL. This is the url of the original network request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + public CefSharp.DevTools.Network.ResourceType Type + { + get + { + return (CefSharp.DevTools.Network.ResourceType)(StringToEnum(typeof(CefSharp.DevTools.Network.ResourceType), type)); + } + + set + { + type = (EnumToString(value)); + } + } + + /// + /// Type of this resource. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + internal string type + { + get; + set; + } + + /// + /// Cached response data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("response"), IsRequired = (false))] + public CefSharp.DevTools.Network.Response Response + { + get; + set; + } + + /// + /// Cached response body size. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("bodySize"), IsRequired = (true))] + public long BodySize + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Cookie.cs b/CefSharp/DevTools/Network/Cookie.cs new file mode 100644 index 0000000000..adef67121c --- /dev/null +++ b/CefSharp/DevTools/Network/Cookie.cs @@ -0,0 +1,148 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Cookie object + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Cookie : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Cookie name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Cookie value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + + /// + /// Cookie domain. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("domain"), IsRequired = (true))] + public string Domain + { + get; + set; + } + + /// + /// Cookie path. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("path"), IsRequired = (true))] + public string Path + { + get; + set; + } + + /// + /// Cookie expiration date as the number of seconds since the UNIX epoch. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("expires"), IsRequired = (true))] + public long Expires + { + get; + set; + } + + /// + /// Cookie size. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("size"), IsRequired = (true))] + public int Size + { + get; + set; + } + + /// + /// True if cookie is http-only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("httpOnly"), IsRequired = (true))] + public bool HttpOnly + { + get; + set; + } + + /// + /// True if cookie is secure. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("secure"), IsRequired = (true))] + public bool Secure + { + get; + set; + } + + /// + /// True in case of session cookie. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("session"), IsRequired = (true))] + public bool Session + { + get; + set; + } + + public CefSharp.DevTools.Network.CookieSameSite? SameSite + { + get + { + return (CefSharp.DevTools.Network.CookieSameSite? )(StringToEnum(typeof(CefSharp.DevTools.Network.CookieSameSite? ), sameSite)); + } + + set + { + sameSite = (EnumToString(value)); + } + } + + /// + /// Cookie SameSite type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sameSite"), IsRequired = (false))] + internal string sameSite + { + get; + set; + } + + public CefSharp.DevTools.Network.CookiePriority Priority + { + get + { + return (CefSharp.DevTools.Network.CookiePriority)(StringToEnum(typeof(CefSharp.DevTools.Network.CookiePriority), priority)); + } + + set + { + priority = (EnumToString(value)); + } + } + + /// + /// Cookie Priority + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("priority"), IsRequired = (true))] + internal string priority + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/CookieParam.cs b/CefSharp/DevTools/Network/CookieParam.cs new file mode 100644 index 0000000000..fbc2ad8739 --- /dev/null +++ b/CefSharp/DevTools/Network/CookieParam.cs @@ -0,0 +1,139 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Cookie parameter object + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CookieParam : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Cookie name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Cookie value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + + /// + /// The request-URI to associate with the setting of the cookie. This value can affect the + /// default domain and path values of the created cookie. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (false))] + public string Url + { + get; + set; + } + + /// + /// Cookie domain. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("domain"), IsRequired = (false))] + public string Domain + { + get; + set; + } + + /// + /// Cookie path. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("path"), IsRequired = (false))] + public string Path + { + get; + set; + } + + /// + /// True if cookie is secure. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("secure"), IsRequired = (false))] + public bool? Secure + { + get; + set; + } + + /// + /// True if cookie is http-only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("httpOnly"), IsRequired = (false))] + public bool? HttpOnly + { + get; + set; + } + + public CefSharp.DevTools.Network.CookieSameSite? SameSite + { + get + { + return (CefSharp.DevTools.Network.CookieSameSite? )(StringToEnum(typeof(CefSharp.DevTools.Network.CookieSameSite? ), sameSite)); + } + + set + { + sameSite = (EnumToString(value)); + } + } + + /// + /// Cookie SameSite type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sameSite"), IsRequired = (false))] + internal string sameSite + { + get; + set; + } + + /// + /// Cookie expiration date, session cookie if not set + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("expires"), IsRequired = (false))] + public long? Expires + { + get; + set; + } + + public CefSharp.DevTools.Network.CookiePriority? Priority + { + get + { + return (CefSharp.DevTools.Network.CookiePriority? )(StringToEnum(typeof(CefSharp.DevTools.Network.CookiePriority? ), priority)); + } + + set + { + priority = (EnumToString(value)); + } + } + + /// + /// Cookie Priority. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("priority"), IsRequired = (false))] + internal string priority + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/BlockedReason.cs b/CefSharp/DevTools/Network/Enums/BlockedReason.cs new file mode 100644 index 0000000000..ddae6ac002 --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/BlockedReason.cs @@ -0,0 +1,77 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// The reason why request was blocked. + /// + public enum BlockedReason + { + /// + /// other + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("other"))] + Other, + /// + /// csp + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("csp"))] + Csp, + /// + /// mixed-content + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("mixed-content"))] + MixedContent, + /// + /// origin + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("origin"))] + Origin, + /// + /// inspector + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("inspector"))] + Inspector, + /// + /// subresource-filter + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("subresource-filter"))] + SubresourceFilter, + /// + /// content-type + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("content-type"))] + ContentType, + /// + /// collapsed-by-client + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("collapsed-by-client"))] + CollapsedByClient, + /// + /// coep-frame-resource-needs-coep-header + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("coep-frame-resource-needs-coep-header"))] + CoepFrameResourceNeedsCoepHeader, + /// + /// coop-sandboxed-iframe-cannot-navigate-to-coop-page + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("coop-sandboxed-iframe-cannot-navigate-to-coop-page"))] + CoopSandboxedIframeCannotNavigateToCoopPage, + /// + /// corp-not-same-origin + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("corp-not-same-origin"))] + CorpNotSameOrigin, + /// + /// corp-not-same-origin-after-defaulted-to-same-origin-by-coep + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("corp-not-same-origin-after-defaulted-to-same-origin-by-coep"))] + CorpNotSameOriginAfterDefaultedToSameOriginByCoep, + /// + /// corp-not-same-site + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("corp-not-same-site"))] + CorpNotSameSite + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/CertificateTransparencyCompliance.cs b/CefSharp/DevTools/Network/Enums/CertificateTransparencyCompliance.cs new file mode 100644 index 0000000000..43789763e6 --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/CertificateTransparencyCompliance.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Whether the request complied with Certificate Transparency policy. + /// + public enum CertificateTransparencyCompliance + { + /// + /// unknown + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("unknown"))] + Unknown, + /// + /// not-compliant + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("not-compliant"))] + NotCompliant, + /// + /// compliant + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("compliant"))] + Compliant + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/ConnectionType.cs b/CefSharp/DevTools/Network/Enums/ConnectionType.cs new file mode 100644 index 0000000000..124d8e299a --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/ConnectionType.cs @@ -0,0 +1,57 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// The underlying connection technology that the browser is supposedly using. + /// + public enum ConnectionType + { + /// + /// none + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("none"))] + None, + /// + /// cellular2g + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("cellular2g"))] + Cellular2g, + /// + /// cellular3g + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("cellular3g"))] + Cellular3g, + /// + /// cellular4g + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("cellular4g"))] + Cellular4g, + /// + /// bluetooth + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("bluetooth"))] + Bluetooth, + /// + /// ethernet + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ethernet"))] + Ethernet, + /// + /// wifi + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("wifi"))] + Wifi, + /// + /// wimax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("wimax"))] + Wimax, + /// + /// other + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("other"))] + Other + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/CookieBlockedReason.cs b/CefSharp/DevTools/Network/Enums/CookieBlockedReason.cs new file mode 100644 index 0000000000..9c69fbb86a --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/CookieBlockedReason.cs @@ -0,0 +1,57 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Types of reasons why a cookie may not be sent with a request. + /// + public enum CookieBlockedReason + { + /// + /// SecureOnly + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SecureOnly"))] + SecureOnly, + /// + /// NotOnPath + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("NotOnPath"))] + NotOnPath, + /// + /// DomainMismatch + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("DomainMismatch"))] + DomainMismatch, + /// + /// SameSiteStrict + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SameSiteStrict"))] + SameSiteStrict, + /// + /// SameSiteLax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SameSiteLax"))] + SameSiteLax, + /// + /// SameSiteUnspecifiedTreatedAsLax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SameSiteUnspecifiedTreatedAsLax"))] + SameSiteUnspecifiedTreatedAsLax, + /// + /// SameSiteNoneInsecure + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SameSiteNoneInsecure"))] + SameSiteNoneInsecure, + /// + /// UserPreferences + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("UserPreferences"))] + UserPreferences, + /// + /// UnknownError + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("UnknownError"))] + UnknownError + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/CookiePriority.cs b/CefSharp/DevTools/Network/Enums/CookiePriority.cs new file mode 100644 index 0000000000..64059ff6c0 --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/CookiePriority.cs @@ -0,0 +1,28 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Represents the cookie's 'Priority' status: + /// https://tools.ietf.org/html/draft-west-cookie-priority-00 + /// + public enum CookiePriority + { + /// + /// Low + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Low"))] + Low, + /// + /// Medium + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Medium"))] + Medium, + /// + /// High + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("High"))] + High + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/CookieSameSite.cs b/CefSharp/DevTools/Network/Enums/CookieSameSite.cs new file mode 100644 index 0000000000..e967da3ab5 --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/CookieSameSite.cs @@ -0,0 +1,28 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Represents the cookie's 'SameSite' status: + /// https://tools.ietf.org/html/draft-west-first-party-cookies + /// + public enum CookieSameSite + { + /// + /// Strict + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Strict"))] + Strict, + /// + /// Lax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Lax"))] + Lax, + /// + /// None + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("None"))] + None + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/ErrorReason.cs b/CefSharp/DevTools/Network/Enums/ErrorReason.cs new file mode 100644 index 0000000000..7611ed1943 --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/ErrorReason.cs @@ -0,0 +1,82 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Network level fetch failure reason. + /// + public enum ErrorReason + { + /// + /// Failed + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Failed"))] + Failed, + /// + /// Aborted + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Aborted"))] + Aborted, + /// + /// TimedOut + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("TimedOut"))] + TimedOut, + /// + /// AccessDenied + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("AccessDenied"))] + AccessDenied, + /// + /// ConnectionClosed + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ConnectionClosed"))] + ConnectionClosed, + /// + /// ConnectionReset + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ConnectionReset"))] + ConnectionReset, + /// + /// ConnectionRefused + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ConnectionRefused"))] + ConnectionRefused, + /// + /// ConnectionAborted + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ConnectionAborted"))] + ConnectionAborted, + /// + /// ConnectionFailed + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ConnectionFailed"))] + ConnectionFailed, + /// + /// NameNotResolved + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("NameNotResolved"))] + NameNotResolved, + /// + /// InternetDisconnected + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("InternetDisconnected"))] + InternetDisconnected, + /// + /// AddressUnreachable + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("AddressUnreachable"))] + AddressUnreachable, + /// + /// BlockedByClient + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("BlockedByClient"))] + BlockedByClient, + /// + /// BlockedByResponse + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("BlockedByResponse"))] + BlockedByResponse + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/InterceptionStage.cs b/CefSharp/DevTools/Network/Enums/InterceptionStage.cs new file mode 100644 index 0000000000..6465ffa104 --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/InterceptionStage.cs @@ -0,0 +1,23 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Stages of the interception to begin intercepting. Request will intercept before the request is + /// sent. Response will intercept after the response is received. + /// + public enum InterceptionStage + { + /// + /// Request + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Request"))] + Request, + /// + /// HeadersReceived + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("HeadersReceived"))] + HeadersReceived + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/ResourcePriority.cs b/CefSharp/DevTools/Network/Enums/ResourcePriority.cs new file mode 100644 index 0000000000..79902c4f78 --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/ResourcePriority.cs @@ -0,0 +1,37 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Loading priority of a resource request. + /// + public enum ResourcePriority + { + /// + /// VeryLow + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("VeryLow"))] + VeryLow, + /// + /// Low + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Low"))] + Low, + /// + /// Medium + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Medium"))] + Medium, + /// + /// High + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("High"))] + High, + /// + /// VeryHigh + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("VeryHigh"))] + VeryHigh + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/ResourceType.cs b/CefSharp/DevTools/Network/Enums/ResourceType.cs new file mode 100644 index 0000000000..68c1272b6f --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/ResourceType.cs @@ -0,0 +1,92 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Resource type as it was perceived by the rendering engine. + /// + public enum ResourceType + { + /// + /// Document + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Document"))] + Document, + /// + /// Stylesheet + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Stylesheet"))] + Stylesheet, + /// + /// Image + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Image"))] + Image, + /// + /// Media + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Media"))] + Media, + /// + /// Font + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Font"))] + Font, + /// + /// Script + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Script"))] + Script, + /// + /// TextTrack + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("TextTrack"))] + TextTrack, + /// + /// XHR + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("XHR"))] + XHR, + /// + /// Fetch + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Fetch"))] + Fetch, + /// + /// EventSource + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("EventSource"))] + EventSource, + /// + /// WebSocket + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("WebSocket"))] + WebSocket, + /// + /// Manifest + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Manifest"))] + Manifest, + /// + /// SignedExchange + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SignedExchange"))] + SignedExchange, + /// + /// Ping + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Ping"))] + Ping, + /// + /// CSPViolationReport + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("CSPViolationReport"))] + CSPViolationReport, + /// + /// Other + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("Other"))] + Other + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/ServiceWorkerResponseSource.cs b/CefSharp/DevTools/Network/Enums/ServiceWorkerResponseSource.cs new file mode 100644 index 0000000000..1031a1f0cb --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/ServiceWorkerResponseSource.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Source of serviceworker response. + /// + public enum ServiceWorkerResponseSource + { + /// + /// cache-storage + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("cache-storage"))] + CacheStorage, + /// + /// http-cache + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("http-cache"))] + HttpCache, + /// + /// fallback-code + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("fallback-code"))] + FallbackCode, + /// + /// network + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("network"))] + Network + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/SetCookieBlockedReason.cs b/CefSharp/DevTools/Network/Enums/SetCookieBlockedReason.cs new file mode 100644 index 0000000000..6026a04288 --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/SetCookieBlockedReason.cs @@ -0,0 +1,72 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Types of reasons why a cookie may not be stored from a response. + /// + public enum SetCookieBlockedReason + { + /// + /// SecureOnly + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SecureOnly"))] + SecureOnly, + /// + /// SameSiteStrict + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SameSiteStrict"))] + SameSiteStrict, + /// + /// SameSiteLax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SameSiteLax"))] + SameSiteLax, + /// + /// SameSiteUnspecifiedTreatedAsLax + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SameSiteUnspecifiedTreatedAsLax"))] + SameSiteUnspecifiedTreatedAsLax, + /// + /// SameSiteNoneInsecure + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SameSiteNoneInsecure"))] + SameSiteNoneInsecure, + /// + /// UserPreferences + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("UserPreferences"))] + UserPreferences, + /// + /// SyntaxError + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SyntaxError"))] + SyntaxError, + /// + /// SchemeNotSupported + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("SchemeNotSupported"))] + SchemeNotSupported, + /// + /// OverwriteSecure + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("OverwriteSecure"))] + OverwriteSecure, + /// + /// InvalidDomain + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("InvalidDomain"))] + InvalidDomain, + /// + /// InvalidPrefix + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("InvalidPrefix"))] + InvalidPrefix, + /// + /// UnknownError + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("UnknownError"))] + UnknownError + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Enums/SignedExchangeErrorField.cs b/CefSharp/DevTools/Network/Enums/SignedExchangeErrorField.cs new file mode 100644 index 0000000000..f91011690d --- /dev/null +++ b/CefSharp/DevTools/Network/Enums/SignedExchangeErrorField.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Field type for a signed exchange related error. + /// + public enum SignedExchangeErrorField + { + /// + /// signatureSig + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("signatureSig"))] + SignatureSig, + /// + /// signatureIntegrity + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("signatureIntegrity"))] + SignatureIntegrity, + /// + /// signatureCertUrl + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("signatureCertUrl"))] + SignatureCertUrl, + /// + /// signatureCertSha256 + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("signatureCertSha256"))] + SignatureCertSha256, + /// + /// signatureValidityUrl + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("signatureValidityUrl"))] + SignatureValidityUrl, + /// + /// signatureTimestamps + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("signatureTimestamps"))] + SignatureTimestamps + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/GetAllCookiesResponse.cs b/CefSharp/DevTools/Network/GetAllCookiesResponse.cs new file mode 100644 index 0000000000..b5afb3c8dd --- /dev/null +++ b/CefSharp/DevTools/Network/GetAllCookiesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// GetAllCookiesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetAllCookiesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList cookies + { + get; + set; + } + + /// + /// cookies + /// + public System.Collections.Generic.IList Cookies + { + get + { + return cookies; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/GetCertificateResponse.cs b/CefSharp/DevTools/Network/GetCertificateResponse.cs new file mode 100644 index 0000000000..f4d1a261af --- /dev/null +++ b/CefSharp/DevTools/Network/GetCertificateResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// GetCertificateResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetCertificateResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] tableNames + { + get; + set; + } + + /// + /// tableNames + /// + public string[] TableNames + { + get + { + return tableNames; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/GetCookiesResponse.cs b/CefSharp/DevTools/Network/GetCookiesResponse.cs new file mode 100644 index 0000000000..5ce07fe516 --- /dev/null +++ b/CefSharp/DevTools/Network/GetCookiesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// GetCookiesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetCookiesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList cookies + { + get; + set; + } + + /// + /// cookies + /// + public System.Collections.Generic.IList Cookies + { + get + { + return cookies; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/GetRequestPostDataResponse.cs b/CefSharp/DevTools/Network/GetRequestPostDataResponse.cs new file mode 100644 index 0000000000..eab020b135 --- /dev/null +++ b/CefSharp/DevTools/Network/GetRequestPostDataResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// GetRequestPostDataResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetRequestPostDataResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string postData + { + get; + set; + } + + /// + /// postData + /// + public string PostData + { + get + { + return postData; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/GetResponseBodyForInterceptionResponse.cs b/CefSharp/DevTools/Network/GetResponseBodyForInterceptionResponse.cs new file mode 100644 index 0000000000..b18976e6c6 --- /dev/null +++ b/CefSharp/DevTools/Network/GetResponseBodyForInterceptionResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// GetResponseBodyForInterceptionResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetResponseBodyForInterceptionResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string body + { + get; + set; + } + + /// + /// body + /// + public string Body + { + get + { + return body; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal bool base64Encoded + { + get; + set; + } + + /// + /// base64Encoded + /// + public bool Base64Encoded + { + get + { + return base64Encoded; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/GetResponseBodyResponse.cs b/CefSharp/DevTools/Network/GetResponseBodyResponse.cs new file mode 100644 index 0000000000..eb951ead56 --- /dev/null +++ b/CefSharp/DevTools/Network/GetResponseBodyResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// GetResponseBodyResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetResponseBodyResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string body + { + get; + set; + } + + /// + /// body + /// + public string Body + { + get + { + return body; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal bool base64Encoded + { + get; + set; + } + + /// + /// base64Encoded + /// + public bool Base64Encoded + { + get + { + return base64Encoded; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Initiator.cs b/CefSharp/DevTools/Network/Initiator.cs new file mode 100644 index 0000000000..f63335c77b --- /dev/null +++ b/CefSharp/DevTools/Network/Initiator.cs @@ -0,0 +1,53 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Information about the request initiator. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Initiator : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Type of this initiator. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// Initiator JavaScript stack trace, set for Script only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("stack"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.StackTrace Stack + { + get; + set; + } + + /// + /// Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (false))] + public string Url + { + get; + set; + } + + /// + /// Initiator line number, set for Parser type or for Script type (when script is importing + /// module) (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (false))] + public long? LineNumber + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Network.cs b/CefSharp/DevTools/Network/Network.cs new file mode 100644 index 0000000000..ec955dc404 --- /dev/null +++ b/CefSharp/DevTools/Network/Network.cs @@ -0,0 +1,479 @@ +// Copyright © 2020 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.DevTools.Network +{ + using System.Linq; + + /// + /// Network domain allows tracking network activities of the page. It exposes information about http, + /// file, data and other requests and responses, their headers, bodies, timing, etc. + /// + public partial class Network : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Network(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Clears browser cache. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearBrowserCacheAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.clearBrowserCache", dict); + return methodResult; + } + + /// + /// Clears browser cookies. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearBrowserCookiesAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.clearBrowserCookies", dict); + return methodResult; + } + + partial void ValidateDeleteCookies(string name, string url = null, string domain = null, string path = null); + /// + /// Deletes browser cookies with matching name and url or domain/path pair. + /// + /// Name of the cookies to remove. + /// If specified, deletes all the cookies with the given name where domain and path match + public async System.Threading.Tasks.Task DeleteCookiesAsync(string name, string url = null, string domain = null, string path = null) + { + ValidateDeleteCookies(name, url, domain, path); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("name", name); + if (!(string.IsNullOrEmpty(url))) + { + dict.Add("url", url); + } + + if (!(string.IsNullOrEmpty(domain))) + { + dict.Add("domain", domain); + } + + if (!(string.IsNullOrEmpty(path))) + { + dict.Add("path", path); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.deleteCookies", dict); + return methodResult; + } + + /// + /// Disables network tracking, prevents network events from being sent to the client. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.disable", dict); + return methodResult; + } + + partial void ValidateEmulateNetworkConditions(bool offline, long latency, long downloadThroughput, long uploadThroughput, CefSharp.DevTools.Network.ConnectionType? connectionType = null); + /// + /// Activates emulation of network conditions. + /// + /// True to emulate internet disconnection. + /// Minimum latency from request sent to response headers received (ms). + /// Maximal aggregated download throughput (bytes/sec). -1 disables download throttling. + /// Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling. + /// Connection type if known. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EmulateNetworkConditionsAsync(bool offline, long latency, long downloadThroughput, long uploadThroughput, CefSharp.DevTools.Network.ConnectionType? connectionType = null) + { + ValidateEmulateNetworkConditions(offline, latency, downloadThroughput, uploadThroughput, connectionType); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("offline", offline); + dict.Add("latency", latency); + dict.Add("downloadThroughput", downloadThroughput); + dict.Add("uploadThroughput", uploadThroughput); + if (connectionType.HasValue) + { + dict.Add("connectionType", this.EnumToString(connectionType)); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.emulateNetworkConditions", dict); + return methodResult; + } + + partial void ValidateEnable(int? maxTotalBufferSize = null, int? maxResourceBufferSize = null, int? maxPostDataSize = null); + /// + /// Enables network tracking, network events will now be delivered to the client. + /// + /// Buffer size in bytes to use when preserving network payloads (XHRs, etc). + /// Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). + /// Longest post body size (in bytes) that would be included in requestWillBeSent notification + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync(int? maxTotalBufferSize = null, int? maxResourceBufferSize = null, int? maxPostDataSize = null) + { + ValidateEnable(maxTotalBufferSize, maxResourceBufferSize, maxPostDataSize); + var dict = new System.Collections.Generic.Dictionary(); + if (maxTotalBufferSize.HasValue) + { + dict.Add("maxTotalBufferSize", maxTotalBufferSize.Value); + } + + if (maxResourceBufferSize.HasValue) + { + dict.Add("maxResourceBufferSize", maxResourceBufferSize.Value); + } + + if (maxPostDataSize.HasValue) + { + dict.Add("maxPostDataSize", maxPostDataSize.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.enable", dict); + return methodResult; + } + + /// + /// Returns all browser cookies. Depending on the backend support, will return detailed cookie + /// information in the `cookies` field. + /// + /// returns System.Threading.Tasks.Task<GetAllCookiesResponse> + public async System.Threading.Tasks.Task GetAllCookiesAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.getAllCookies", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetCertificate(string origin); + /// + /// Returns the DER-encoded certificate. + /// + /// Origin to get certificate for. + /// returns System.Threading.Tasks.Task<GetCertificateResponse> + public async System.Threading.Tasks.Task GetCertificateAsync(string origin) + { + ValidateGetCertificate(origin); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.getCertificate", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetCookies(string[] urls = null); + /// + /// Returns all browser cookies for the current URL. Depending on the backend support, will return + /// detailed cookie information in the `cookies` field. + /// + /// The list of URLs for which applicable cookies will be fetched + /// returns System.Threading.Tasks.Task<GetCookiesResponse> + public async System.Threading.Tasks.Task GetCookiesAsync(string[] urls = null) + { + ValidateGetCookies(urls); + var dict = new System.Collections.Generic.Dictionary(); + if ((urls) != (null)) + { + dict.Add("urls", urls); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.getCookies", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetResponseBody(string requestId); + /// + /// Returns content served for the given request. + /// + /// Identifier of the network request to get content for. + /// returns System.Threading.Tasks.Task<GetResponseBodyResponse> + public async System.Threading.Tasks.Task GetResponseBodyAsync(string requestId) + { + ValidateGetResponseBody(requestId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.getResponseBody", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetRequestPostData(string requestId); + /// + /// Returns post data sent with the request. Returns an error when no data was sent with the request. + /// + /// Identifier of the network request to get content for. + /// returns System.Threading.Tasks.Task<GetRequestPostDataResponse> + public async System.Threading.Tasks.Task GetRequestPostDataAsync(string requestId) + { + ValidateGetRequestPostData(requestId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.getRequestPostData", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetResponseBodyForInterception(string interceptionId); + /// + /// Returns content served for the given currently intercepted request. + /// + /// Identifier for the intercepted request to get body for. + /// returns System.Threading.Tasks.Task<GetResponseBodyForInterceptionResponse> + public async System.Threading.Tasks.Task GetResponseBodyForInterceptionAsync(string interceptionId) + { + ValidateGetResponseBodyForInterception(interceptionId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("interceptionId", interceptionId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.getResponseBodyForInterception", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateTakeResponseBodyForInterceptionAsStream(string interceptionId); + /// + /// Returns a handle to the stream representing the response body. Note that after this command, + /// the intercepted request can't be continued as is -- you either need to cancel it or to provide + /// the response body. The stream only supports sequential read, IO.read will fail if the position + /// is specified. + /// + /// interceptionId + /// returns System.Threading.Tasks.Task<TakeResponseBodyForInterceptionAsStreamResponse> + public async System.Threading.Tasks.Task TakeResponseBodyForInterceptionAsStreamAsync(string interceptionId) + { + ValidateTakeResponseBodyForInterceptionAsStream(interceptionId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("interceptionId", interceptionId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.takeResponseBodyForInterceptionAsStream", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateReplayXHR(string requestId); + /// + /// This method sends a new XMLHttpRequest which is identical to the original one. The following + /// parameters should be identical: method, url, async, request body, extra headers, withCredentials + /// attribute, user, password. + /// + /// Identifier of XHR to replay. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ReplayXHRAsync(string requestId) + { + ValidateReplayXHR(requestId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.replayXHR", dict); + return methodResult; + } + + partial void ValidateSearchInResponseBody(string requestId, string query, bool? caseSensitive = null, bool? isRegex = null); + /// + /// Searches for given string in response content. + /// + /// Identifier of the network response to search. + /// String to search for. + /// If true, search is case sensitive. + /// If true, treats string parameter as regex. + /// returns System.Threading.Tasks.Task<SearchInResponseBodyResponse> + public async System.Threading.Tasks.Task SearchInResponseBodyAsync(string requestId, string query, bool? caseSensitive = null, bool? isRegex = null) + { + ValidateSearchInResponseBody(requestId, query, caseSensitive, isRegex); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("requestId", requestId); + dict.Add("query", query); + if (caseSensitive.HasValue) + { + dict.Add("caseSensitive", caseSensitive.Value); + } + + if (isRegex.HasValue) + { + dict.Add("isRegex", isRegex.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.searchInResponseBody", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetBlockedURLs(string[] urls); + /// + /// Blocks URLs from loading. + /// + /// URL patterns to block. Wildcards ('*') are allowed. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetBlockedURLsAsync(string[] urls) + { + ValidateSetBlockedURLs(urls); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("urls", urls); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.setBlockedURLs", dict); + return methodResult; + } + + partial void ValidateSetBypassServiceWorker(bool bypass); + /// + /// Toggles ignoring of service worker for each request. + /// + /// Bypass service worker and load from network. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetBypassServiceWorkerAsync(bool bypass) + { + ValidateSetBypassServiceWorker(bypass); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("bypass", bypass); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.setBypassServiceWorker", dict); + return methodResult; + } + + partial void ValidateSetCacheDisabled(bool cacheDisabled); + /// + /// Toggles ignoring cache for each request. If `true`, cache will not be used. + /// + /// Cache disabled state. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetCacheDisabledAsync(bool cacheDisabled) + { + ValidateSetCacheDisabled(cacheDisabled); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("cacheDisabled", cacheDisabled); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.setCacheDisabled", dict); + return methodResult; + } + + partial void ValidateSetCookie(string name, string value, string url = null, string domain = null, string path = null, bool? secure = null, bool? httpOnly = null, CefSharp.DevTools.Network.CookieSameSite? sameSite = null, long? expires = null, CefSharp.DevTools.Network.CookiePriority? priority = null); + /// + /// Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. + /// + /// Cookie name. + /// Cookie value. + /// The request-URI to associate with the setting of the cookie. This value can affect the + public async System.Threading.Tasks.Task SetCookieAsync(string name, string value, string url = null, string domain = null, string path = null, bool? secure = null, bool? httpOnly = null, CefSharp.DevTools.Network.CookieSameSite? sameSite = null, long? expires = null, CefSharp.DevTools.Network.CookiePriority? priority = null) + { + ValidateSetCookie(name, value, url, domain, path, secure, httpOnly, sameSite, expires, priority); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("name", name); + dict.Add("value", value); + if (!(string.IsNullOrEmpty(url))) + { + dict.Add("url", url); + } + + if (!(string.IsNullOrEmpty(domain))) + { + dict.Add("domain", domain); + } + + if (!(string.IsNullOrEmpty(path))) + { + dict.Add("path", path); + } + + if (secure.HasValue) + { + dict.Add("secure", secure.Value); + } + + if (httpOnly.HasValue) + { + dict.Add("httpOnly", httpOnly.Value); + } + + if (sameSite.HasValue) + { + dict.Add("sameSite", this.EnumToString(sameSite)); + } + + if (expires.HasValue) + { + dict.Add("expires", expires.Value); + } + + if (priority.HasValue) + { + dict.Add("priority", this.EnumToString(priority)); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.setCookie", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetCookies(System.Collections.Generic.IList cookies); + /// + /// Sets given cookies. + /// + /// Cookies to be set. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetCookiesAsync(System.Collections.Generic.IList cookies) + { + ValidateSetCookies(cookies); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("cookies", cookies.Select(x => x.ToDictionary())); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.setCookies", dict); + return methodResult; + } + + partial void ValidateSetDataSizeLimitsForTest(int maxTotalSize, int maxResourceSize); + /// + /// For testing. + /// + /// Maximum total buffer size. + /// Maximum per-resource size. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetDataSizeLimitsForTestAsync(int maxTotalSize, int maxResourceSize) + { + ValidateSetDataSizeLimitsForTest(maxTotalSize, maxResourceSize); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("maxTotalSize", maxTotalSize); + dict.Add("maxResourceSize", maxResourceSize); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.setDataSizeLimitsForTest", dict); + return methodResult; + } + + partial void ValidateSetExtraHTTPHeaders(CefSharp.DevTools.Network.Headers headers); + /// + /// Specifies whether to always send extra HTTP headers with the requests from this page. + /// + /// Map with extra HTTP headers. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetExtraHTTPHeadersAsync(CefSharp.DevTools.Network.Headers headers) + { + ValidateSetExtraHTTPHeaders(headers); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("headers", headers.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.setExtraHTTPHeaders", dict); + return methodResult; + } + + partial void ValidateSetUserAgentOverride(string userAgent, string acceptLanguage = null, string platform = null, CefSharp.DevTools.Emulation.UserAgentMetadata userAgentMetadata = null); + /// + /// Allows overriding user agent with the given string. + /// + /// User agent to use. + /// Browser langugage to emulate. + /// The platform navigator.platform should return. + /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetUserAgentOverrideAsync(string userAgent, string acceptLanguage = null, string platform = null, CefSharp.DevTools.Emulation.UserAgentMetadata userAgentMetadata = null) + { + ValidateSetUserAgentOverride(userAgent, acceptLanguage, platform, userAgentMetadata); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("userAgent", userAgent); + if (!(string.IsNullOrEmpty(acceptLanguage))) + { + dict.Add("acceptLanguage", acceptLanguage); + } + + if (!(string.IsNullOrEmpty(platform))) + { + dict.Add("platform", platform); + } + + if ((userAgentMetadata) != (null)) + { + dict.Add("userAgentMetadata", userAgentMetadata.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Network.setUserAgentOverride", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Request.cs b/CefSharp/DevTools/Network/Request.cs new file mode 100644 index 0000000000..8c2fa6ba15 --- /dev/null +++ b/CefSharp/DevTools/Network/Request.cs @@ -0,0 +1,138 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// HTTP request data. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Request : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Request URL (without fragment). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// Fragment of the requested URL starting with hash, if present. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("urlFragment"), IsRequired = (false))] + public string UrlFragment + { + get; + set; + } + + /// + /// HTTP request method. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("method"), IsRequired = (true))] + public string Method + { + get; + set; + } + + /// + /// HTTP request headers. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("headers"), IsRequired = (true))] + public CefSharp.DevTools.Network.Headers Headers + { + get; + set; + } + + /// + /// HTTP POST request data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("postData"), IsRequired = (false))] + public string PostData + { + get; + set; + } + + /// + /// True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("hasPostData"), IsRequired = (false))] + public bool? HasPostData + { + get; + set; + } + + public CefSharp.DevTools.Security.MixedContentType? MixedContentType + { + get + { + return (CefSharp.DevTools.Security.MixedContentType? )(StringToEnum(typeof(CefSharp.DevTools.Security.MixedContentType? ), mixedContentType)); + } + + set + { + mixedContentType = (EnumToString(value)); + } + } + + /// + /// The mixed content type of the request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mixedContentType"), IsRequired = (false))] + internal string mixedContentType + { + get; + set; + } + + public CefSharp.DevTools.Network.ResourcePriority InitialPriority + { + get + { + return (CefSharp.DevTools.Network.ResourcePriority)(StringToEnum(typeof(CefSharp.DevTools.Network.ResourcePriority), initialPriority)); + } + + set + { + initialPriority = (EnumToString(value)); + } + } + + /// + /// Priority of the resource request at the time request is sent. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("initialPriority"), IsRequired = (true))] + internal string initialPriority + { + get; + set; + } + + /// + /// The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/ + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("referrerPolicy"), IsRequired = (true))] + public string ReferrerPolicy + { + get; + set; + } + + /// + /// Whether is loaded via link preload. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isLinkPreload"), IsRequired = (false))] + public bool? IsLinkPreload + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/RequestPattern.cs b/CefSharp/DevTools/Network/RequestPattern.cs new file mode 100644 index 0000000000..977582765e --- /dev/null +++ b/CefSharp/DevTools/Network/RequestPattern.cs @@ -0,0 +1,69 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Request pattern for interception. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestPattern : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is + /// backslash. Omitting is equivalent to "*". + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("urlPattern"), IsRequired = (false))] + public string UrlPattern + { + get; + set; + } + + public CefSharp.DevTools.Network.ResourceType? ResourceType + { + get + { + return (CefSharp.DevTools.Network.ResourceType? )(StringToEnum(typeof(CefSharp.DevTools.Network.ResourceType? ), resourceType)); + } + + set + { + resourceType = (EnumToString(value)); + } + } + + /// + /// If set, only requests for matching resource types will be intercepted. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("resourceType"), IsRequired = (false))] + internal string resourceType + { + get; + set; + } + + public CefSharp.DevTools.Network.InterceptionStage? InterceptionStage + { + get + { + return (CefSharp.DevTools.Network.InterceptionStage? )(StringToEnum(typeof(CefSharp.DevTools.Network.InterceptionStage? ), interceptionStage)); + } + + set + { + interceptionStage = (EnumToString(value)); + } + } + + /// + /// Stage at wich to begin intercepting requests. Default is Request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("interceptionStage"), IsRequired = (false))] + internal string interceptionStage + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/ResourceTiming.cs b/CefSharp/DevTools/Network/ResourceTiming.cs new file mode 100644 index 0000000000..cff0c0cacd --- /dev/null +++ b/CefSharp/DevTools/Network/ResourceTiming.cs @@ -0,0 +1,193 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Timing information for the request. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ResourceTiming : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Timing's requestTime is a baseline in seconds, while the other numbers are ticks in + /// milliseconds relatively to this requestTime. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestTime"), IsRequired = (true))] + public long RequestTime + { + get; + set; + } + + /// + /// Started resolving proxy. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("proxyStart"), IsRequired = (true))] + public long ProxyStart + { + get; + set; + } + + /// + /// Finished resolving proxy. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("proxyEnd"), IsRequired = (true))] + public long ProxyEnd + { + get; + set; + } + + /// + /// Started DNS address resolve. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("dnsStart"), IsRequired = (true))] + public long DnsStart + { + get; + set; + } + + /// + /// Finished DNS address resolve. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("dnsEnd"), IsRequired = (true))] + public long DnsEnd + { + get; + set; + } + + /// + /// Started connecting to the remote host. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("connectStart"), IsRequired = (true))] + public long ConnectStart + { + get; + set; + } + + /// + /// Connected to the remote host. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("connectEnd"), IsRequired = (true))] + public long ConnectEnd + { + get; + set; + } + + /// + /// Started SSL handshake. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sslStart"), IsRequired = (true))] + public long SslStart + { + get; + set; + } + + /// + /// Finished SSL handshake. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sslEnd"), IsRequired = (true))] + public long SslEnd + { + get; + set; + } + + /// + /// Started running ServiceWorker. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("workerStart"), IsRequired = (true))] + public long WorkerStart + { + get; + set; + } + + /// + /// Finished Starting ServiceWorker. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("workerReady"), IsRequired = (true))] + public long WorkerReady + { + get; + set; + } + + /// + /// Started fetch event. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("workerFetchStart"), IsRequired = (true))] + public long WorkerFetchStart + { + get; + set; + } + + /// + /// Settled fetch event respondWith promise. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("workerRespondWithSettled"), IsRequired = (true))] + public long WorkerRespondWithSettled + { + get; + set; + } + + /// + /// Started sending request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sendStart"), IsRequired = (true))] + public long SendStart + { + get; + set; + } + + /// + /// Finished sending request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sendEnd"), IsRequired = (true))] + public long SendEnd + { + get; + set; + } + + /// + /// Time the server started pushing request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pushStart"), IsRequired = (true))] + public long PushStart + { + get; + set; + } + + /// + /// Time the server finished pushing request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pushEnd"), IsRequired = (true))] + public long PushEnd + { + get; + set; + } + + /// + /// Finished receiving response headers. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("receiveHeadersEnd"), IsRequired = (true))] + public long ReceiveHeadersEnd + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/Response.cs b/CefSharp/DevTools/Network/Response.cs new file mode 100644 index 0000000000..7fda119aeb --- /dev/null +++ b/CefSharp/DevTools/Network/Response.cs @@ -0,0 +1,268 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// HTTP response data. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Response : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Response URL. This URL can be different from CachedResource.url in case of redirect. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// HTTP response status code. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("status"), IsRequired = (true))] + public int Status + { + get; + set; + } + + /// + /// HTTP response status text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("statusText"), IsRequired = (true))] + public string StatusText + { + get; + set; + } + + /// + /// HTTP response headers. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("headers"), IsRequired = (true))] + public CefSharp.DevTools.Network.Headers Headers + { + get; + set; + } + + /// + /// HTTP response headers text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("headersText"), IsRequired = (false))] + public string HeadersText + { + get; + set; + } + + /// + /// Resource mimeType as determined by the browser. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mimeType"), IsRequired = (true))] + public string MimeType + { + get; + set; + } + + /// + /// Refined HTTP request headers that were actually transmitted over the network. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestHeaders"), IsRequired = (false))] + public CefSharp.DevTools.Network.Headers RequestHeaders + { + get; + set; + } + + /// + /// HTTP request headers text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestHeadersText"), IsRequired = (false))] + public string RequestHeadersText + { + get; + set; + } + + /// + /// Specifies whether physical connection was actually reused for this request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("connectionReused"), IsRequired = (true))] + public bool ConnectionReused + { + get; + set; + } + + /// + /// Physical connection id that was actually used for this request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("connectionId"), IsRequired = (true))] + public long ConnectionId + { + get; + set; + } + + /// + /// Remote IP address. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("remoteIPAddress"), IsRequired = (false))] + public string RemoteIPAddress + { + get; + set; + } + + /// + /// Remote port. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("remotePort"), IsRequired = (false))] + public int? RemotePort + { + get; + set; + } + + /// + /// Specifies that the request was served from the disk cache. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fromDiskCache"), IsRequired = (false))] + public bool? FromDiskCache + { + get; + set; + } + + /// + /// Specifies that the request was served from the ServiceWorker. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fromServiceWorker"), IsRequired = (false))] + public bool? FromServiceWorker + { + get; + set; + } + + /// + /// Specifies that the request was served from the prefetch cache. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fromPrefetchCache"), IsRequired = (false))] + public bool? FromPrefetchCache + { + get; + set; + } + + /// + /// Total number of bytes received for this request so far. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("encodedDataLength"), IsRequired = (true))] + public long EncodedDataLength + { + get; + set; + } + + /// + /// Timing information for the given request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("timing"), IsRequired = (false))] + public CefSharp.DevTools.Network.ResourceTiming Timing + { + get; + set; + } + + public CefSharp.DevTools.Network.ServiceWorkerResponseSource? ServiceWorkerResponseSource + { + get + { + return (CefSharp.DevTools.Network.ServiceWorkerResponseSource? )(StringToEnum(typeof(CefSharp.DevTools.Network.ServiceWorkerResponseSource? ), serviceWorkerResponseSource)); + } + + set + { + serviceWorkerResponseSource = (EnumToString(value)); + } + } + + /// + /// Response source of response from ServiceWorker. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("serviceWorkerResponseSource"), IsRequired = (false))] + internal string serviceWorkerResponseSource + { + get; + set; + } + + /// + /// The time at which the returned response was generated. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("responseTime"), IsRequired = (false))] + public long? ResponseTime + { + get; + set; + } + + /// + /// Cache Storage Cache Name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cacheStorageCacheName"), IsRequired = (false))] + public string CacheStorageCacheName + { + get; + set; + } + + /// + /// Protocol used to fetch this request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("protocol"), IsRequired = (false))] + public string Protocol + { + get; + set; + } + + public CefSharp.DevTools.Security.SecurityState SecurityState + { + get + { + return (CefSharp.DevTools.Security.SecurityState)(StringToEnum(typeof(CefSharp.DevTools.Security.SecurityState), securityState)); + } + + set + { + securityState = (EnumToString(value)); + } + } + + /// + /// Security state of the request resource. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("securityState"), IsRequired = (true))] + internal string securityState + { + get; + set; + } + + /// + /// Security details for the request. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("securityDetails"), IsRequired = (false))] + public CefSharp.DevTools.Network.SecurityDetails SecurityDetails + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/SearchInResponseBodyResponse.cs b/CefSharp/DevTools/Network/SearchInResponseBodyResponse.cs new file mode 100644 index 0000000000..fd39311b2b --- /dev/null +++ b/CefSharp/DevTools/Network/SearchInResponseBodyResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// SearchInResponseBodyResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SearchInResponseBodyResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList result + { + get; + set; + } + + /// + /// result + /// + public System.Collections.Generic.IList Result + { + get + { + return result; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/SecurityDetails.cs b/CefSharp/DevTools/Network/SecurityDetails.cs new file mode 100644 index 0000000000..7cb0b7313a --- /dev/null +++ b/CefSharp/DevTools/Network/SecurityDetails.cs @@ -0,0 +1,155 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Security details about a request. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SecurityDetails : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Protocol name (e.g. "TLS 1.2" or "QUIC"). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("protocol"), IsRequired = (true))] + public string Protocol + { + get; + set; + } + + /// + /// Key Exchange used by the connection, or the empty string if not applicable. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyExchange"), IsRequired = (true))] + public string KeyExchange + { + get; + set; + } + + /// + /// (EC)DH group used by the connection, if applicable. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyExchangeGroup"), IsRequired = (false))] + public string KeyExchangeGroup + { + get; + set; + } + + /// + /// Cipher name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cipher"), IsRequired = (true))] + public string Cipher + { + get; + set; + } + + /// + /// TLS MAC. Note that AEAD ciphers do not have separate MACs. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mac"), IsRequired = (false))] + public string Mac + { + get; + set; + } + + /// + /// Certificate ID value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certificateId"), IsRequired = (true))] + public int CertificateId + { + get; + set; + } + + /// + /// Certificate subject name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("subjectName"), IsRequired = (true))] + public string SubjectName + { + get; + set; + } + + /// + /// Subject Alternative Name (SAN) DNS names and IP addresses. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sanList"), IsRequired = (true))] + public string[] SanList + { + get; + set; + } + + /// + /// Name of the issuing CA. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("issuer"), IsRequired = (true))] + public string Issuer + { + get; + set; + } + + /// + /// Certificate valid from date. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("validFrom"), IsRequired = (true))] + public long ValidFrom + { + get; + set; + } + + /// + /// Certificate valid to (expiration) date + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("validTo"), IsRequired = (true))] + public long ValidTo + { + get; + set; + } + + /// + /// List of signed certificate timestamps (SCTs). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("signedCertificateTimestampList"), IsRequired = (true))] + public System.Collections.Generic.IList SignedCertificateTimestampList + { + get; + set; + } + + public CefSharp.DevTools.Network.CertificateTransparencyCompliance CertificateTransparencyCompliance + { + get + { + return (CefSharp.DevTools.Network.CertificateTransparencyCompliance)(StringToEnum(typeof(CefSharp.DevTools.Network.CertificateTransparencyCompliance), certificateTransparencyCompliance)); + } + + set + { + certificateTransparencyCompliance = (EnumToString(value)); + } + } + + /// + /// Whether the request complied with Certificate Transparency policy + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certificateTransparencyCompliance"), IsRequired = (true))] + internal string certificateTransparencyCompliance + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/SetCookieResponse.cs b/CefSharp/DevTools/Network/SetCookieResponse.cs new file mode 100644 index 0000000000..4107d7f8d9 --- /dev/null +++ b/CefSharp/DevTools/Network/SetCookieResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// SetCookieResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SetCookieResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal bool success + { + get; + set; + } + + /// + /// success + /// + public bool Success + { + get + { + return success; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/SignedCertificateTimestamp.cs b/CefSharp/DevTools/Network/SignedCertificateTimestamp.cs new file mode 100644 index 0000000000..ae28e29ab9 --- /dev/null +++ b/CefSharp/DevTools/Network/SignedCertificateTimestamp.cs @@ -0,0 +1,92 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Details of a signed certificate timestamp (SCT). + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SignedCertificateTimestamp : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Validation status. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("status"), IsRequired = (true))] + public string Status + { + get; + set; + } + + /// + /// Origin. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("origin"), IsRequired = (true))] + public string Origin + { + get; + set; + } + + /// + /// Log name / description. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("logDescription"), IsRequired = (true))] + public string LogDescription + { + get; + set; + } + + /// + /// Log ID. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("logId"), IsRequired = (true))] + public string LogId + { + get; + set; + } + + /// + /// Issuance date. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("timestamp"), IsRequired = (true))] + public long Timestamp + { + get; + set; + } + + /// + /// Hash algorithm. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("hashAlgorithm"), IsRequired = (true))] + public string HashAlgorithm + { + get; + set; + } + + /// + /// Signature algorithm. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("signatureAlgorithm"), IsRequired = (true))] + public string SignatureAlgorithm + { + get; + set; + } + + /// + /// Signature data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("signatureData"), IsRequired = (true))] + public string SignatureData + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/SignedExchangeError.cs b/CefSharp/DevTools/Network/SignedExchangeError.cs new file mode 100644 index 0000000000..04aa5a4cf1 --- /dev/null +++ b/CefSharp/DevTools/Network/SignedExchangeError.cs @@ -0,0 +1,55 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Information about a signed exchange response. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SignedExchangeError : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Error message. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("message"), IsRequired = (true))] + public string Message + { + get; + set; + } + + /// + /// The index of the signature which caused the error. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("signatureIndex"), IsRequired = (false))] + public int? SignatureIndex + { + get; + set; + } + + public CefSharp.DevTools.Network.SignedExchangeErrorField? ErrorField + { + get + { + return (CefSharp.DevTools.Network.SignedExchangeErrorField? )(StringToEnum(typeof(CefSharp.DevTools.Network.SignedExchangeErrorField? ), errorField)); + } + + set + { + errorField = (EnumToString(value)); + } + } + + /// + /// The field which caused the error. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("errorField"), IsRequired = (false))] + internal string errorField + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/SignedExchangeHeader.cs b/CefSharp/DevTools/Network/SignedExchangeHeader.cs new file mode 100644 index 0000000000..c283a92c49 --- /dev/null +++ b/CefSharp/DevTools/Network/SignedExchangeHeader.cs @@ -0,0 +1,63 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Information about a signed exchange header. + /// https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SignedExchangeHeader : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Signed exchange request URL. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestUrl"), IsRequired = (true))] + public string RequestUrl + { + get; + set; + } + + /// + /// Signed exchange response code. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("responseCode"), IsRequired = (true))] + public int ResponseCode + { + get; + set; + } + + /// + /// Signed exchange response headers. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("responseHeaders"), IsRequired = (true))] + public CefSharp.DevTools.Network.Headers ResponseHeaders + { + get; + set; + } + + /// + /// Signed exchange response signature. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("signatures"), IsRequired = (true))] + public System.Collections.Generic.IList Signatures + { + get; + set; + } + + /// + /// Signed exchange header integrity hash in the form of "sha256-". + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("headerIntegrity"), IsRequired = (true))] + public string HeaderIntegrity + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/SignedExchangeInfo.cs b/CefSharp/DevTools/Network/SignedExchangeInfo.cs new file mode 100644 index 0000000000..6b67bc4ef1 --- /dev/null +++ b/CefSharp/DevTools/Network/SignedExchangeInfo.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Information about a signed exchange response. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SignedExchangeInfo : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The outer response of signed HTTP exchange which was received from network. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("outerResponse"), IsRequired = (true))] + public CefSharp.DevTools.Network.Response OuterResponse + { + get; + set; + } + + /// + /// Information about the signed exchange header. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("header"), IsRequired = (false))] + public CefSharp.DevTools.Network.SignedExchangeHeader Header + { + get; + set; + } + + /// + /// Security details for the signed exchange header. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("securityDetails"), IsRequired = (false))] + public CefSharp.DevTools.Network.SecurityDetails SecurityDetails + { + get; + set; + } + + /// + /// Errors occurred while handling the signed exchagne. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("errors"), IsRequired = (false))] + public System.Collections.Generic.IList Errors + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/SignedExchangeSignature.cs b/CefSharp/DevTools/Network/SignedExchangeSignature.cs new file mode 100644 index 0000000000..3bbfc0522a --- /dev/null +++ b/CefSharp/DevTools/Network/SignedExchangeSignature.cs @@ -0,0 +1,103 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// Information about a signed exchange signature. + /// https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1 + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SignedExchangeSignature : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Signed exchange signature label. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("label"), IsRequired = (true))] + public string Label + { + get; + set; + } + + /// + /// The hex string of signed exchange signature. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("signature"), IsRequired = (true))] + public string Signature + { + get; + set; + } + + /// + /// Signed exchange signature integrity. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("integrity"), IsRequired = (true))] + public string Integrity + { + get; + set; + } + + /// + /// Signed exchange signature cert Url. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certUrl"), IsRequired = (false))] + public string CertUrl + { + get; + set; + } + + /// + /// The hex string of signed exchange signature cert sha256. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certSha256"), IsRequired = (false))] + public string CertSha256 + { + get; + set; + } + + /// + /// Signed exchange signature validity Url. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("validityUrl"), IsRequired = (true))] + public string ValidityUrl + { + get; + set; + } + + /// + /// Signed exchange signature date. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("date"), IsRequired = (true))] + public int Date + { + get; + set; + } + + /// + /// Signed exchange signature expires. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("expires"), IsRequired = (true))] + public int Expires + { + get; + set; + } + + /// + /// The encoded certificates. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certificates"), IsRequired = (false))] + public string[] Certificates + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/TakeResponseBodyForInterceptionAsStreamResponse.cs b/CefSharp/DevTools/Network/TakeResponseBodyForInterceptionAsStreamResponse.cs new file mode 100644 index 0000000000..046d6c2173 --- /dev/null +++ b/CefSharp/DevTools/Network/TakeResponseBodyForInterceptionAsStreamResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// TakeResponseBodyForInterceptionAsStreamResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TakeResponseBodyForInterceptionAsStreamResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string stream + { + get; + set; + } + + /// + /// stream + /// + public string Stream + { + get + { + return stream; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/WebSocketFrame.cs b/CefSharp/DevTools/Network/WebSocketFrame.cs new file mode 100644 index 0000000000..c1e1e51a03 --- /dev/null +++ b/CefSharp/DevTools/Network/WebSocketFrame.cs @@ -0,0 +1,44 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class WebSocketFrame : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// WebSocket message opcode. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("opcode"), IsRequired = (true))] + public long Opcode + { + get; + set; + } + + /// + /// WebSocket message mask. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mask"), IsRequired = (true))] + public bool Mask + { + get; + set; + } + + /// + /// WebSocket message payload data. + /// If the opcode is 1, this is a text message and payloadData is a UTF-8 string. + /// If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("payloadData"), IsRequired = (true))] + public string PayloadData + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/WebSocketRequest.cs b/CefSharp/DevTools/Network/WebSocketRequest.cs new file mode 100644 index 0000000000..b984e0e5f6 --- /dev/null +++ b/CefSharp/DevTools/Network/WebSocketRequest.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// WebSocket request data. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class WebSocketRequest : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// HTTP request headers. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("headers"), IsRequired = (true))] + public CefSharp.DevTools.Network.Headers Headers + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Network/WebSocketResponse.cs b/CefSharp/DevTools/Network/WebSocketResponse.cs new file mode 100644 index 0000000000..e79f74c720 --- /dev/null +++ b/CefSharp/DevTools/Network/WebSocketResponse.cs @@ -0,0 +1,72 @@ +// Copyright © 2020 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.DevTools.Network +{ + /// + /// WebSocket response data. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class WebSocketResponse : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// HTTP response status code. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("status"), IsRequired = (true))] + public int Status + { + get; + set; + } + + /// + /// HTTP response status text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("statusText"), IsRequired = (true))] + public string StatusText + { + get; + set; + } + + /// + /// HTTP response headers. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("headers"), IsRequired = (true))] + public CefSharp.DevTools.Network.Headers Headers + { + get; + set; + } + + /// + /// HTTP response headers text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("headersText"), IsRequired = (false))] + public string HeadersText + { + get; + set; + } + + /// + /// HTTP request headers. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestHeaders"), IsRequired = (false))] + public CefSharp.DevTools.Network.Headers RequestHeaders + { + get; + set; + } + + /// + /// HTTP request headers text. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("requestHeadersText"), IsRequired = (false))] + public string RequestHeadersText + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Overlay/Enums/ColorFormat.cs b/CefSharp/DevTools/Overlay/Enums/ColorFormat.cs new file mode 100644 index 0000000000..79d66bab15 --- /dev/null +++ b/CefSharp/DevTools/Overlay/Enums/ColorFormat.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.Overlay +{ + /// + /// ColorFormat + /// + public enum ColorFormat + { + /// + /// rgb + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("rgb"))] + Rgb, + /// + /// hsl + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("hsl"))] + Hsl, + /// + /// hex + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("hex"))] + Hex + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Overlay/Enums/InspectMode.cs b/CefSharp/DevTools/Overlay/Enums/InspectMode.cs new file mode 100644 index 0000000000..d5e0e32356 --- /dev/null +++ b/CefSharp/DevTools/Overlay/Enums/InspectMode.cs @@ -0,0 +1,37 @@ +// Copyright © 2020 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.DevTools.Overlay +{ + /// + /// InspectMode + /// + public enum InspectMode + { + /// + /// searchForNode + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("searchForNode"))] + SearchForNode, + /// + /// searchForUAShadowDOM + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("searchForUAShadowDOM"))] + SearchForUAShadowDOM, + /// + /// captureAreaScreenshot + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("captureAreaScreenshot"))] + CaptureAreaScreenshot, + /// + /// showDistances + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("showDistances"))] + ShowDistances, + /// + /// none + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("none"))] + None + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Overlay/GetHighlightObjectForTestResponse.cs b/CefSharp/DevTools/Overlay/GetHighlightObjectForTestResponse.cs new file mode 100644 index 0000000000..079c7a7070 --- /dev/null +++ b/CefSharp/DevTools/Overlay/GetHighlightObjectForTestResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Overlay +{ + /// + /// GetHighlightObjectForTestResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetHighlightObjectForTestResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal object highlight + { + get; + set; + } + + /// + /// highlight + /// + public object Highlight + { + get + { + return highlight; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Overlay/GridHighlightConfig.cs b/CefSharp/DevTools/Overlay/GridHighlightConfig.cs new file mode 100644 index 0000000000..4bc05101fe --- /dev/null +++ b/CefSharp/DevTools/Overlay/GridHighlightConfig.cs @@ -0,0 +1,122 @@ +// Copyright © 2020 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.DevTools.Overlay +{ + /// + /// Configuration data for the highlighting of Grid elements. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GridHighlightConfig : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Whether the extension lines from grid cells to the rulers should be shown (default: false). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("showGridExtensionLines"), IsRequired = (false))] + public bool? ShowGridExtensionLines + { + get; + set; + } + + /// + /// Show Positive line number labels (default: false). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("showPositiveLineNumbers"), IsRequired = (false))] + public bool? ShowPositiveLineNumbers + { + get; + set; + } + + /// + /// Show Negative line number labels (default: false). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("showNegativeLineNumbers"), IsRequired = (false))] + public bool? ShowNegativeLineNumbers + { + get; + set; + } + + /// + /// The grid container border highlight color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("gridBorderColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA GridBorderColor + { + get; + set; + } + + /// + /// The cell border color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cellBorderColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA CellBorderColor + { + get; + set; + } + + /// + /// Whether the grid border is dashed (default: false). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("gridBorderDash"), IsRequired = (false))] + public bool? GridBorderDash + { + get; + set; + } + + /// + /// Whether the cell border is dashed (default: false). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cellBorderDash"), IsRequired = (false))] + public bool? CellBorderDash + { + get; + set; + } + + /// + /// The row gap highlight fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("rowGapColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA RowGapColor + { + get; + set; + } + + /// + /// The row gap hatching fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("rowHatchColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA RowHatchColor + { + get; + set; + } + + /// + /// The column gap highlight fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("columnGapColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA ColumnGapColor + { + get; + set; + } + + /// + /// The column gap hatching fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("columnHatchColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA ColumnHatchColor + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Overlay/HighlightConfig.cs b/CefSharp/DevTools/Overlay/HighlightConfig.cs new file mode 100644 index 0000000000..9146e88d76 --- /dev/null +++ b/CefSharp/DevTools/Overlay/HighlightConfig.cs @@ -0,0 +1,175 @@ +// Copyright © 2020 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.DevTools.Overlay +{ + /// + /// Configuration data for the highlighting of page elements. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class HighlightConfig : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Whether the node info tooltip should be shown (default: false). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("showInfo"), IsRequired = (false))] + public bool? ShowInfo + { + get; + set; + } + + /// + /// Whether the node styles in the tooltip (default: false). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("showStyles"), IsRequired = (false))] + public bool? ShowStyles + { + get; + set; + } + + /// + /// Whether the rulers should be shown (default: false). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("showRulers"), IsRequired = (false))] + public bool? ShowRulers + { + get; + set; + } + + /// + /// Whether the a11y info should be shown (default: true). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("showAccessibilityInfo"), IsRequired = (false))] + public bool? ShowAccessibilityInfo + { + get; + set; + } + + /// + /// Whether the extension lines from node to the rulers should be shown (default: false). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("showExtensionLines"), IsRequired = (false))] + public bool? ShowExtensionLines + { + get; + set; + } + + /// + /// The content box highlight fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA ContentColor + { + get; + set; + } + + /// + /// The padding highlight fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("paddingColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA PaddingColor + { + get; + set; + } + + /// + /// The border highlight fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("borderColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA BorderColor + { + get; + set; + } + + /// + /// The margin highlight fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("marginColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA MarginColor + { + get; + set; + } + + /// + /// The event target element highlight fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("eventTargetColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA EventTargetColor + { + get; + set; + } + + /// + /// The shape outside fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("shapeColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA ShapeColor + { + get; + set; + } + + /// + /// The shape margin fill color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("shapeMarginColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA ShapeMarginColor + { + get; + set; + } + + /// + /// The grid layout color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cssGridColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA CssGridColor + { + get; + set; + } + + public CefSharp.DevTools.Overlay.ColorFormat? ColorFormat + { + get + { + return (CefSharp.DevTools.Overlay.ColorFormat? )(StringToEnum(typeof(CefSharp.DevTools.Overlay.ColorFormat? ), colorFormat)); + } + + set + { + colorFormat = (EnumToString(value)); + } + } + + /// + /// The color format used to format color styles (default: hex). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("colorFormat"), IsRequired = (false))] + internal string colorFormat + { + get; + set; + } + + /// + /// The grid layout highlight configuration (default: all transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("gridHighlightConfig"), IsRequired = (false))] + public CefSharp.DevTools.Overlay.GridHighlightConfig GridHighlightConfig + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Overlay/HingeConfig.cs b/CefSharp/DevTools/Overlay/HingeConfig.cs new file mode 100644 index 0000000000..71f8d7367a --- /dev/null +++ b/CefSharp/DevTools/Overlay/HingeConfig.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Overlay +{ + /// + /// Configuration for dual screen hinge + /// + [System.Runtime.Serialization.DataContractAttribute] + public class HingeConfig : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// A rectangle represent hinge + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("rect"), IsRequired = (true))] + public CefSharp.DevTools.DOM.Rect Rect + { + get; + set; + } + + /// + /// The content box highlight fill color (default: a dark color). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA ContentColor + { + get; + set; + } + + /// + /// The content box highlight outline color (default: transparent). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("outlineColor"), IsRequired = (false))] + public CefSharp.DevTools.DOM.RGBA OutlineColor + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Overlay/Overlay.cs b/CefSharp/DevTools/Overlay/Overlay.cs new file mode 100644 index 0000000000..d6456c976e --- /dev/null +++ b/CefSharp/DevTools/Overlay/Overlay.cs @@ -0,0 +1,397 @@ +// Copyright © 2020 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.DevTools.Overlay +{ + using System.Linq; + + /// + /// This domain provides various functionality related to drawing atop the inspected page. + /// + public partial class Overlay : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Overlay(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disables domain notifications. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.disable", dict); + return methodResult; + } + + /// + /// Enables domain notifications. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.enable", dict); + return methodResult; + } + + partial void ValidateGetHighlightObjectForTest(int nodeId, bool? includeDistance = null, bool? includeStyle = null, CefSharp.DevTools.Overlay.ColorFormat? colorFormat = null, bool? showAccessibilityInfo = null); + /// + /// For testing. + /// + /// Id of the node to get highlight object for. + /// Whether to include distance info. + /// Whether to include style info. + /// The color format to get config with (default: hex). + /// Whether to show accessibility info (default: true). + /// returns System.Threading.Tasks.Task<GetHighlightObjectForTestResponse> + public async System.Threading.Tasks.Task GetHighlightObjectForTestAsync(int nodeId, bool? includeDistance = null, bool? includeStyle = null, CefSharp.DevTools.Overlay.ColorFormat? colorFormat = null, bool? showAccessibilityInfo = null) + { + ValidateGetHighlightObjectForTest(nodeId, includeDistance, includeStyle, colorFormat, showAccessibilityInfo); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("nodeId", nodeId); + if (includeDistance.HasValue) + { + dict.Add("includeDistance", includeDistance.Value); + } + + if (includeStyle.HasValue) + { + dict.Add("includeStyle", includeStyle.Value); + } + + if (colorFormat.HasValue) + { + dict.Add("colorFormat", this.EnumToString(colorFormat)); + } + + if (showAccessibilityInfo.HasValue) + { + dict.Add("showAccessibilityInfo", showAccessibilityInfo.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.getHighlightObjectForTest", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Hides any highlight. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task HideHighlightAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.hideHighlight", dict); + return methodResult; + } + + partial void ValidateHighlightFrame(string frameId, CefSharp.DevTools.DOM.RGBA contentColor = null, CefSharp.DevTools.DOM.RGBA contentOutlineColor = null); + /// + /// Highlights owner element of the frame with given id. + /// + /// Identifier of the frame to highlight. + /// The content box highlight fill color (default: transparent). + /// The content box highlight outline color (default: transparent). + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task HighlightFrameAsync(string frameId, CefSharp.DevTools.DOM.RGBA contentColor = null, CefSharp.DevTools.DOM.RGBA contentOutlineColor = null) + { + ValidateHighlightFrame(frameId, contentColor, contentOutlineColor); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("frameId", frameId); + if ((contentColor) != (null)) + { + dict.Add("contentColor", contentColor.ToDictionary()); + } + + if ((contentOutlineColor) != (null)) + { + dict.Add("contentOutlineColor", contentOutlineColor.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.highlightFrame", dict); + return methodResult; + } + + partial void ValidateHighlightNode(CefSharp.DevTools.Overlay.HighlightConfig highlightConfig, int? nodeId = null, int? backendNodeId = null, string objectId = null, string selector = null); + /// + /// Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or + /// objectId must be specified. + /// + /// A descriptor for the highlight appearance. + /// Identifier of the node to highlight. + /// Identifier of the backend node to highlight. + /// JavaScript object id of the node to be highlighted. + /// Selectors to highlight relevant nodes. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task HighlightNodeAsync(CefSharp.DevTools.Overlay.HighlightConfig highlightConfig, int? nodeId = null, int? backendNodeId = null, string objectId = null, string selector = null) + { + ValidateHighlightNode(highlightConfig, nodeId, backendNodeId, objectId, selector); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("highlightConfig", highlightConfig.ToDictionary()); + if (nodeId.HasValue) + { + dict.Add("nodeId", nodeId.Value); + } + + if (backendNodeId.HasValue) + { + dict.Add("backendNodeId", backendNodeId.Value); + } + + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + if (!(string.IsNullOrEmpty(selector))) + { + dict.Add("selector", selector); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.highlightNode", dict); + return methodResult; + } + + partial void ValidateHighlightQuad(long[] quad, CefSharp.DevTools.DOM.RGBA color = null, CefSharp.DevTools.DOM.RGBA outlineColor = null); + /// + /// Highlights given quad. Coordinates are absolute with respect to the main frame viewport. + /// + /// Quad to highlight + /// The highlight fill color (default: transparent). + /// The highlight outline color (default: transparent). + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task HighlightQuadAsync(long[] quad, CefSharp.DevTools.DOM.RGBA color = null, CefSharp.DevTools.DOM.RGBA outlineColor = null) + { + ValidateHighlightQuad(quad, color, outlineColor); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("quad", quad); + if ((color) != (null)) + { + dict.Add("color", color.ToDictionary()); + } + + if ((outlineColor) != (null)) + { + dict.Add("outlineColor", outlineColor.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.highlightQuad", dict); + return methodResult; + } + + partial void ValidateHighlightRect(int x, int y, int width, int height, CefSharp.DevTools.DOM.RGBA color = null, CefSharp.DevTools.DOM.RGBA outlineColor = null); + /// + /// Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport. + /// + /// X coordinate + /// Y coordinate + /// Rectangle width + /// Rectangle height + /// The highlight fill color (default: transparent). + /// The highlight outline color (default: transparent). + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task HighlightRectAsync(int x, int y, int width, int height, CefSharp.DevTools.DOM.RGBA color = null, CefSharp.DevTools.DOM.RGBA outlineColor = null) + { + ValidateHighlightRect(x, y, width, height, color, outlineColor); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("x", x); + dict.Add("y", y); + dict.Add("width", width); + dict.Add("height", height); + if ((color) != (null)) + { + dict.Add("color", color.ToDictionary()); + } + + if ((outlineColor) != (null)) + { + dict.Add("outlineColor", outlineColor.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.highlightRect", dict); + return methodResult; + } + + partial void ValidateSetInspectMode(CefSharp.DevTools.Overlay.InspectMode mode, CefSharp.DevTools.Overlay.HighlightConfig highlightConfig = null); + /// + /// Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. + /// Backend then generates 'inspectNodeRequested' event upon element selection. + /// + /// Set an inspection mode. + /// A descriptor for the highlight appearance of hovered-over nodes. May be omitted if `enabled + public async System.Threading.Tasks.Task SetInspectModeAsync(CefSharp.DevTools.Overlay.InspectMode mode, CefSharp.DevTools.Overlay.HighlightConfig highlightConfig = null) + { + ValidateSetInspectMode(mode, highlightConfig); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("mode", this.EnumToString(mode)); + if ((highlightConfig) != (null)) + { + dict.Add("highlightConfig", highlightConfig.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setInspectMode", dict); + return methodResult; + } + + partial void ValidateSetShowAdHighlights(bool show); + /// + /// Highlights owner element of all frames detected to be ads. + /// + /// True for showing ad highlights + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetShowAdHighlightsAsync(bool show) + { + ValidateSetShowAdHighlights(show); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("show", show); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setShowAdHighlights", dict); + return methodResult; + } + + partial void ValidateSetPausedInDebuggerMessage(string message = null); + /// + /// SetPausedInDebuggerMessage + /// + /// The message to display, also triggers resume and step over controls. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetPausedInDebuggerMessageAsync(string message = null) + { + ValidateSetPausedInDebuggerMessage(message); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(message))) + { + dict.Add("message", message); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setPausedInDebuggerMessage", dict); + return methodResult; + } + + partial void ValidateSetShowDebugBorders(bool show); + /// + /// Requests that backend shows debug borders on layers + /// + /// True for showing debug borders + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetShowDebugBordersAsync(bool show) + { + ValidateSetShowDebugBorders(show); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("show", show); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setShowDebugBorders", dict); + return methodResult; + } + + partial void ValidateSetShowFPSCounter(bool show); + /// + /// Requests that backend shows the FPS counter + /// + /// True for showing the FPS counter + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetShowFPSCounterAsync(bool show) + { + ValidateSetShowFPSCounter(show); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("show", show); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setShowFPSCounter", dict); + return methodResult; + } + + partial void ValidateSetShowPaintRects(bool result); + /// + /// Requests that backend shows paint rectangles + /// + /// True for showing paint rectangles + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetShowPaintRectsAsync(bool result) + { + ValidateSetShowPaintRects(result); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("result", result); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setShowPaintRects", dict); + return methodResult; + } + + partial void ValidateSetShowLayoutShiftRegions(bool result); + /// + /// Requests that backend shows layout shift regions + /// + /// True for showing layout shift regions + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetShowLayoutShiftRegionsAsync(bool result) + { + ValidateSetShowLayoutShiftRegions(result); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("result", result); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setShowLayoutShiftRegions", dict); + return methodResult; + } + + partial void ValidateSetShowScrollBottleneckRects(bool show); + /// + /// Requests that backend shows scroll bottleneck rects + /// + /// True for showing scroll bottleneck rects + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetShowScrollBottleneckRectsAsync(bool show) + { + ValidateSetShowScrollBottleneckRects(show); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("show", show); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setShowScrollBottleneckRects", dict); + return methodResult; + } + + partial void ValidateSetShowHitTestBorders(bool show); + /// + /// Requests that backend shows hit-test borders on layers + /// + /// True for showing hit-test borders + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetShowHitTestBordersAsync(bool show) + { + ValidateSetShowHitTestBorders(show); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("show", show); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setShowHitTestBorders", dict); + return methodResult; + } + + partial void ValidateSetShowViewportSizeOnResize(bool show); + /// + /// Paints viewport size upon main frame resize. + /// + /// Whether to paint size or not. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetShowViewportSizeOnResizeAsync(bool show) + { + ValidateSetShowViewportSizeOnResize(show); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("show", show); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setShowViewportSizeOnResize", dict); + return methodResult; + } + + partial void ValidateSetShowHinge(CefSharp.DevTools.Overlay.HingeConfig hingeConfig = null); + /// + /// Add a dual screen device hinge + /// + /// hinge data, null means hideHinge + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetShowHingeAsync(CefSharp.DevTools.Overlay.HingeConfig hingeConfig = null) + { + ValidateSetShowHinge(hingeConfig); + var dict = new System.Collections.Generic.Dictionary(); + if ((hingeConfig) != (null)) + { + dict.Add("hingeConfig", hingeConfig.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setShowHinge", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/AddScriptToEvaluateOnNewDocumentResponse.cs b/CefSharp/DevTools/Page/AddScriptToEvaluateOnNewDocumentResponse.cs new file mode 100644 index 0000000000..e9408ae314 --- /dev/null +++ b/CefSharp/DevTools/Page/AddScriptToEvaluateOnNewDocumentResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// AddScriptToEvaluateOnNewDocumentResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AddScriptToEvaluateOnNewDocumentResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string identifier + { + get; + set; + } + + /// + /// identifier + /// + public string Identifier + { + get + { + return identifier; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/AppManifestError.cs b/CefSharp/DevTools/Page/AppManifestError.cs new file mode 100644 index 0000000000..055a76a65c --- /dev/null +++ b/CefSharp/DevTools/Page/AppManifestError.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Error while paring app manifest. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AppManifestError : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Error message. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("message"), IsRequired = (true))] + public string Message + { + get; + set; + } + + /// + /// If criticial, this is a non-recoverable parse error. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("critical"), IsRequired = (true))] + public int Critical + { + get; + set; + } + + /// + /// Error line. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("line"), IsRequired = (true))] + public int Line + { + get; + set; + } + + /// + /// Error column. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("column"), IsRequired = (true))] + public int Column + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/AppManifestParsedProperties.cs b/CefSharp/DevTools/Page/AppManifestParsedProperties.cs new file mode 100644 index 0000000000..19ba21a55f --- /dev/null +++ b/CefSharp/DevTools/Page/AppManifestParsedProperties.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Parsed app manifest properties. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AppManifestParsedProperties : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Computed scope value + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scope"), IsRequired = (true))] + public string Scope + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/CaptureScreenshotResponse.cs b/CefSharp/DevTools/Page/CaptureScreenshotResponse.cs new file mode 100644 index 0000000000..72aad8e655 --- /dev/null +++ b/CefSharp/DevTools/Page/CaptureScreenshotResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// CaptureScreenshotResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CaptureScreenshotResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string data + { + get; + set; + } + + /// + /// data + /// + public byte[] Data + { + get + { + return Convert(data); + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/CaptureSnapshotResponse.cs b/CefSharp/DevTools/Page/CaptureSnapshotResponse.cs new file mode 100644 index 0000000000..025e36181b --- /dev/null +++ b/CefSharp/DevTools/Page/CaptureSnapshotResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// CaptureSnapshotResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CaptureSnapshotResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string data + { + get; + set; + } + + /// + /// data + /// + public string Data + { + get + { + return data; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/CreateIsolatedWorldResponse.cs b/CefSharp/DevTools/Page/CreateIsolatedWorldResponse.cs new file mode 100644 index 0000000000..aa13a767f6 --- /dev/null +++ b/CefSharp/DevTools/Page/CreateIsolatedWorldResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// CreateIsolatedWorldResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CreateIsolatedWorldResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int executionContextId + { + get; + set; + } + + /// + /// executionContextId + /// + public int ExecutionContextId + { + get + { + return executionContextId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/Enums/ClientNavigationDisposition.cs b/CefSharp/DevTools/Page/Enums/ClientNavigationDisposition.cs new file mode 100644 index 0000000000..6c35917e7e --- /dev/null +++ b/CefSharp/DevTools/Page/Enums/ClientNavigationDisposition.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// ClientNavigationDisposition + /// + public enum ClientNavigationDisposition + { + /// + /// currentTab + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("currentTab"))] + CurrentTab, + /// + /// newTab + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("newTab"))] + NewTab, + /// + /// newWindow + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("newWindow"))] + NewWindow, + /// + /// download + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("download"))] + Download + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/Enums/ClientNavigationReason.cs b/CefSharp/DevTools/Page/Enums/ClientNavigationReason.cs new file mode 100644 index 0000000000..1115026ffe --- /dev/null +++ b/CefSharp/DevTools/Page/Enums/ClientNavigationReason.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// ClientNavigationReason + /// + public enum ClientNavigationReason + { + /// + /// formSubmissionGet + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("formSubmissionGet"))] + FormSubmissionGet, + /// + /// formSubmissionPost + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("formSubmissionPost"))] + FormSubmissionPost, + /// + /// httpHeaderRefresh + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("httpHeaderRefresh"))] + HttpHeaderRefresh, + /// + /// scriptInitiated + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("scriptInitiated"))] + ScriptInitiated, + /// + /// metaTagRefresh + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("metaTagRefresh"))] + MetaTagRefresh, + /// + /// pageBlockInterstitial + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("pageBlockInterstitial"))] + PageBlockInterstitial, + /// + /// reload + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("reload"))] + Reload, + /// + /// anchorClick + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("anchorClick"))] + AnchorClick + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/Enums/DialogType.cs b/CefSharp/DevTools/Page/Enums/DialogType.cs new file mode 100644 index 0000000000..f94cf4415d --- /dev/null +++ b/CefSharp/DevTools/Page/Enums/DialogType.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Javascript dialog type. + /// + public enum DialogType + { + /// + /// alert + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("alert"))] + Alert, + /// + /// confirm + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("confirm"))] + Confirm, + /// + /// prompt + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("prompt"))] + Prompt, + /// + /// beforeunload + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("beforeunload"))] + Beforeunload + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/Enums/ReferrerPolicy.cs b/CefSharp/DevTools/Page/Enums/ReferrerPolicy.cs new file mode 100644 index 0000000000..6a0850e67b --- /dev/null +++ b/CefSharp/DevTools/Page/Enums/ReferrerPolicy.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// The referring-policy used for the navigation. + /// + public enum ReferrerPolicy + { + /// + /// noReferrer + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("noReferrer"))] + NoReferrer, + /// + /// noReferrerWhenDowngrade + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("noReferrerWhenDowngrade"))] + NoReferrerWhenDowngrade, + /// + /// origin + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("origin"))] + Origin, + /// + /// originWhenCrossOrigin + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("originWhenCrossOrigin"))] + OriginWhenCrossOrigin, + /// + /// sameOrigin + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("sameOrigin"))] + SameOrigin, + /// + /// strictOrigin + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("strictOrigin"))] + StrictOrigin, + /// + /// strictOriginWhenCrossOrigin + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("strictOriginWhenCrossOrigin"))] + StrictOriginWhenCrossOrigin, + /// + /// unsafeUrl + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("unsafeUrl"))] + UnsafeUrl + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/Enums/TransitionType.cs b/CefSharp/DevTools/Page/Enums/TransitionType.cs new file mode 100644 index 0000000000..e67920e0b2 --- /dev/null +++ b/CefSharp/DevTools/Page/Enums/TransitionType.cs @@ -0,0 +1,77 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Transition type. + /// + public enum TransitionType + { + /// + /// link + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("link"))] + Link, + /// + /// typed + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("typed"))] + Typed, + /// + /// address_bar + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("address_bar"))] + AddressBar, + /// + /// auto_bookmark + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("auto_bookmark"))] + AutoBookmark, + /// + /// auto_subframe + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("auto_subframe"))] + AutoSubframe, + /// + /// manual_subframe + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("manual_subframe"))] + ManualSubframe, + /// + /// generated + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("generated"))] + Generated, + /// + /// auto_toplevel + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("auto_toplevel"))] + AutoToplevel, + /// + /// form_submit + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("form_submit"))] + FormSubmit, + /// + /// reload + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("reload"))] + Reload, + /// + /// keyword + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("keyword"))] + Keyword, + /// + /// keyword_generated + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("keyword_generated"))] + KeywordGenerated, + /// + /// other + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("other"))] + Other + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/FontFamilies.cs b/CefSharp/DevTools/Page/FontFamilies.cs new file mode 100644 index 0000000000..c8d2bc3b16 --- /dev/null +++ b/CefSharp/DevTools/Page/FontFamilies.cs @@ -0,0 +1,82 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Generic font families collection. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class FontFamilies : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The standard font-family. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("standard"), IsRequired = (false))] + public string Standard + { + get; + set; + } + + /// + /// The fixed font-family. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fixed"), IsRequired = (false))] + public string Fixed + { + get; + set; + } + + /// + /// The serif font-family. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("serif"), IsRequired = (false))] + public string Serif + { + get; + set; + } + + /// + /// The sansSerif font-family. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sansSerif"), IsRequired = (false))] + public string SansSerif + { + get; + set; + } + + /// + /// The cursive font-family. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cursive"), IsRequired = (false))] + public string Cursive + { + get; + set; + } + + /// + /// The fantasy font-family. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fantasy"), IsRequired = (false))] + public string Fantasy + { + get; + set; + } + + /// + /// The pictograph font-family. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pictograph"), IsRequired = (false))] + public string Pictograph + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/FontSizes.cs b/CefSharp/DevTools/Page/FontSizes.cs new file mode 100644 index 0000000000..720e201a6a --- /dev/null +++ b/CefSharp/DevTools/Page/FontSizes.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Default font sizes. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class FontSizes : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Default standard font size. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("standard"), IsRequired = (false))] + public int? Standard + { + get; + set; + } + + /// + /// Default fixed font size. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("fixed"), IsRequired = (false))] + public int? Fixed + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/Frame.cs b/CefSharp/DevTools/Page/Frame.cs new file mode 100644 index 0000000000..54433cfd23 --- /dev/null +++ b/CefSharp/DevTools/Page/Frame.cs @@ -0,0 +1,102 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Information about the Frame on the page. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Frame : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Frame unique identifier. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("id"), IsRequired = (true))] + public string Id + { + get; + set; + } + + /// + /// Parent frame identifier. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("parentId"), IsRequired = (false))] + public string ParentId + { + get; + set; + } + + /// + /// Identifier of the loader associated with this frame. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("loaderId"), IsRequired = (true))] + public string LoaderId + { + get; + set; + } + + /// + /// Frame's name as specified in the tag. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (false))] + public string Name + { + get; + set; + } + + /// + /// Frame document's URL without fragment. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// Frame document's URL fragment including the '#'. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("urlFragment"), IsRequired = (false))] + public string UrlFragment + { + get; + set; + } + + /// + /// Frame document's security origin. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("securityOrigin"), IsRequired = (true))] + public string SecurityOrigin + { + get; + set; + } + + /// + /// Frame document's mimeType as determined by the browser. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mimeType"), IsRequired = (true))] + public string MimeType + { + get; + set; + } + + /// + /// If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("unreachableUrl"), IsRequired = (false))] + public string UnreachableUrl + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/FrameResource.cs b/CefSharp/DevTools/Page/FrameResource.cs new file mode 100644 index 0000000000..5b15cd5ca7 --- /dev/null +++ b/CefSharp/DevTools/Page/FrameResource.cs @@ -0,0 +1,95 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Information about the Resource on the page. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class FrameResource : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Resource URL. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + public CefSharp.DevTools.Network.ResourceType Type + { + get + { + return (CefSharp.DevTools.Network.ResourceType)(StringToEnum(typeof(CefSharp.DevTools.Network.ResourceType), type)); + } + + set + { + type = (EnumToString(value)); + } + } + + /// + /// Type of this resource. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + internal string type + { + get; + set; + } + + /// + /// Resource mimeType as determined by the browser. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mimeType"), IsRequired = (true))] + public string MimeType + { + get; + set; + } + + /// + /// last-modified timestamp as reported by server. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lastModified"), IsRequired = (false))] + public long? LastModified + { + get; + set; + } + + /// + /// Resource content size. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contentSize"), IsRequired = (false))] + public long? ContentSize + { + get; + set; + } + + /// + /// True if the resource failed to load. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("failed"), IsRequired = (false))] + public bool? Failed + { + get; + set; + } + + /// + /// True if the resource was canceled during loading. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("canceled"), IsRequired = (false))] + public bool? Canceled + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/FrameResourceTree.cs b/CefSharp/DevTools/Page/FrameResourceTree.cs new file mode 100644 index 0000000000..8201aeefa7 --- /dev/null +++ b/CefSharp/DevTools/Page/FrameResourceTree.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Information about the Frame hierarchy along with their cached resources. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class FrameResourceTree : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Frame information for this tree item. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frame"), IsRequired = (true))] + public CefSharp.DevTools.Page.Frame Frame + { + get; + set; + } + + /// + /// Child frames. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("childFrames"), IsRequired = (false))] + public System.Collections.Generic.IList ChildFrames + { + get; + set; + } + + /// + /// Information about frame resources. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("resources"), IsRequired = (true))] + public System.Collections.Generic.IList Resources + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/FrameTree.cs b/CefSharp/DevTools/Page/FrameTree.cs new file mode 100644 index 0000000000..56d6340f10 --- /dev/null +++ b/CefSharp/DevTools/Page/FrameTree.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Information about the Frame hierarchy. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class FrameTree : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Frame information for this tree item. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("frame"), IsRequired = (true))] + public CefSharp.DevTools.Page.Frame Frame + { + get; + set; + } + + /// + /// Child frames. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("childFrames"), IsRequired = (false))] + public System.Collections.Generic.IList ChildFrames + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/GetAppManifestResponse.cs b/CefSharp/DevTools/Page/GetAppManifestResponse.cs new file mode 100644 index 0000000000..c578f95330 --- /dev/null +++ b/CefSharp/DevTools/Page/GetAppManifestResponse.cs @@ -0,0 +1,84 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// GetAppManifestResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetAppManifestResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string url + { + get; + set; + } + + /// + /// url + /// + public string Url + { + get + { + return url; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList errors + { + get; + set; + } + + /// + /// errors + /// + public System.Collections.Generic.IList Errors + { + get + { + return errors; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string data + { + get; + set; + } + + /// + /// data + /// + public string Data + { + get + { + return data; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Page.AppManifestParsedProperties parsed + { + get; + set; + } + + /// + /// parsed + /// + public CefSharp.DevTools.Page.AppManifestParsedProperties Parsed + { + get + { + return parsed; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/GetFrameTreeResponse.cs b/CefSharp/DevTools/Page/GetFrameTreeResponse.cs new file mode 100644 index 0000000000..d4affdbf05 --- /dev/null +++ b/CefSharp/DevTools/Page/GetFrameTreeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// GetFrameTreeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetFrameTreeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Page.FrameTree frameTree + { + get; + set; + } + + /// + /// frameTree + /// + public CefSharp.DevTools.Page.FrameTree FrameTree + { + get + { + return frameTree; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/GetInstallabilityErrorsResponse.cs b/CefSharp/DevTools/Page/GetInstallabilityErrorsResponse.cs new file mode 100644 index 0000000000..2bf83d30b4 --- /dev/null +++ b/CefSharp/DevTools/Page/GetInstallabilityErrorsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// GetInstallabilityErrorsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetInstallabilityErrorsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList installabilityErrors + { + get; + set; + } + + /// + /// installabilityErrors + /// + public System.Collections.Generic.IList InstallabilityErrors + { + get + { + return installabilityErrors; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/GetLayoutMetricsResponse.cs b/CefSharp/DevTools/Page/GetLayoutMetricsResponse.cs new file mode 100644 index 0000000000..d82825c101 --- /dev/null +++ b/CefSharp/DevTools/Page/GetLayoutMetricsResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// GetLayoutMetricsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetLayoutMetricsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Page.LayoutViewport layoutViewport + { + get; + set; + } + + /// + /// layoutViewport + /// + public CefSharp.DevTools.Page.LayoutViewport LayoutViewport + { + get + { + return layoutViewport; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Page.VisualViewport visualViewport + { + get; + set; + } + + /// + /// visualViewport + /// + public CefSharp.DevTools.Page.VisualViewport VisualViewport + { + get + { + return visualViewport; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.DOM.Rect contentSize + { + get; + set; + } + + /// + /// contentSize + /// + public CefSharp.DevTools.DOM.Rect ContentSize + { + get + { + return contentSize; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/GetManifestIconsResponse.cs b/CefSharp/DevTools/Page/GetManifestIconsResponse.cs new file mode 100644 index 0000000000..9152d79fea --- /dev/null +++ b/CefSharp/DevTools/Page/GetManifestIconsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// GetManifestIconsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetManifestIconsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string primaryIcon + { + get; + set; + } + + /// + /// primaryIcon + /// + public byte[] PrimaryIcon + { + get + { + return Convert(primaryIcon); + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/GetNavigationHistoryResponse.cs b/CefSharp/DevTools/Page/GetNavigationHistoryResponse.cs new file mode 100644 index 0000000000..304343204b --- /dev/null +++ b/CefSharp/DevTools/Page/GetNavigationHistoryResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// GetNavigationHistoryResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetNavigationHistoryResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal int currentIndex + { + get; + set; + } + + /// + /// currentIndex + /// + public int CurrentIndex + { + get + { + return currentIndex; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList entries + { + get; + set; + } + + /// + /// entries + /// + public System.Collections.Generic.IList Entries + { + get + { + return entries; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/GetResourceContentResponse.cs b/CefSharp/DevTools/Page/GetResourceContentResponse.cs new file mode 100644 index 0000000000..f7e33a0ed9 --- /dev/null +++ b/CefSharp/DevTools/Page/GetResourceContentResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// GetResourceContentResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetResourceContentResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string content + { + get; + set; + } + + /// + /// content + /// + public string Content + { + get + { + return content; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal bool base64Encoded + { + get; + set; + } + + /// + /// base64Encoded + /// + public bool Base64Encoded + { + get + { + return base64Encoded; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/GetResourceTreeResponse.cs b/CefSharp/DevTools/Page/GetResourceTreeResponse.cs new file mode 100644 index 0000000000..9b90b4bc0f --- /dev/null +++ b/CefSharp/DevTools/Page/GetResourceTreeResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// GetResourceTreeResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetResourceTreeResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Page.FrameResourceTree frameTree + { + get; + set; + } + + /// + /// frameTree + /// + public CefSharp.DevTools.Page.FrameResourceTree FrameTree + { + get + { + return frameTree; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/InstallabilityError.cs b/CefSharp/DevTools/Page/InstallabilityError.cs new file mode 100644 index 0000000000..55ab205722 --- /dev/null +++ b/CefSharp/DevTools/Page/InstallabilityError.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// The installability error + /// + [System.Runtime.Serialization.DataContractAttribute] + public class InstallabilityError : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The error id (e.g. 'manifest-missing-suitable-icon'). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("errorId"), IsRequired = (true))] + public string ErrorId + { + get; + set; + } + + /// + /// The list of error arguments (e.g. {name:'minimum-icon-size-in-pixels', value:'64'}). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("errorArguments"), IsRequired = (true))] + public System.Collections.Generic.IList ErrorArguments + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/InstallabilityErrorArgument.cs b/CefSharp/DevTools/Page/InstallabilityErrorArgument.cs new file mode 100644 index 0000000000..1575ff70cb --- /dev/null +++ b/CefSharp/DevTools/Page/InstallabilityErrorArgument.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// InstallabilityErrorArgument + /// + [System.Runtime.Serialization.DataContractAttribute] + public class InstallabilityErrorArgument : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Argument name (e.g. name:'minimum-icon-size-in-pixels'). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Argument value (e.g. value:'64'). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public string Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/LayoutViewport.cs b/CefSharp/DevTools/Page/LayoutViewport.cs new file mode 100644 index 0000000000..1fcb6930e0 --- /dev/null +++ b/CefSharp/DevTools/Page/LayoutViewport.cs @@ -0,0 +1,52 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Layout viewport position and dimensions. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class LayoutViewport : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Horizontal offset relative to the document (CSS pixels). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pageX"), IsRequired = (true))] + public int PageX + { + get; + set; + } + + /// + /// Vertical offset relative to the document (CSS pixels). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pageY"), IsRequired = (true))] + public int PageY + { + get; + set; + } + + /// + /// Width (CSS pixels), excludes scrollbar if present. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("clientWidth"), IsRequired = (true))] + public int ClientWidth + { + get; + set; + } + + /// + /// Height (CSS pixels), excludes scrollbar if present. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("clientHeight"), IsRequired = (true))] + public int ClientHeight + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/NavigateResponse.cs b/CefSharp/DevTools/Page/NavigateResponse.cs new file mode 100644 index 0000000000..7af5cb892a --- /dev/null +++ b/CefSharp/DevTools/Page/NavigateResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// NavigateResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class NavigateResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string frameId + { + get; + set; + } + + /// + /// frameId + /// + public string FrameId + { + get + { + return frameId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string loaderId + { + get; + set; + } + + /// + /// loaderId + /// + public string LoaderId + { + get + { + return loaderId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string errorText + { + get; + set; + } + + /// + /// errorText + /// + public string ErrorText + { + get + { + return errorText; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/NavigationEntry.cs b/CefSharp/DevTools/Page/NavigationEntry.cs new file mode 100644 index 0000000000..339594f1cd --- /dev/null +++ b/CefSharp/DevTools/Page/NavigationEntry.cs @@ -0,0 +1,75 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Navigation history entry. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class NavigationEntry : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Unique id of the navigation history entry. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("id"), IsRequired = (true))] + public int Id + { + get; + set; + } + + /// + /// URL of the navigation history entry. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// URL that the user typed in the url bar. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("userTypedURL"), IsRequired = (true))] + public string UserTypedURL + { + get; + set; + } + + /// + /// Title of the navigation history entry. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("title"), IsRequired = (true))] + public string Title + { + get; + set; + } + + public CefSharp.DevTools.Page.TransitionType TransitionType + { + get + { + return (CefSharp.DevTools.Page.TransitionType)(StringToEnum(typeof(CefSharp.DevTools.Page.TransitionType), transitionType)); + } + + set + { + transitionType = (EnumToString(value)); + } + } + + /// + /// Transition type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("transitionType"), IsRequired = (true))] + internal string transitionType + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/Page.cs b/CefSharp/DevTools/Page/Page.cs new file mode 100644 index 0000000000..ca19d8cb73 --- /dev/null +++ b/CefSharp/DevTools/Page/Page.cs @@ -0,0 +1,811 @@ +// Copyright © 2020 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.DevTools.Page +{ + using System.Linq; + + /// + /// Actions and events related to the inspected page belong to the page domain. + /// + public partial class Page : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Page(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateAddScriptToEvaluateOnNewDocument(string source, string worldName = null); + /// + /// Evaluates given script in every frame upon creation (before loading frame's scripts). + /// + /// source + /// If specified, creates an isolated world with the given name and evaluates given script in it. + public async System.Threading.Tasks.Task AddScriptToEvaluateOnNewDocumentAsync(string source, string worldName = null) + { + ValidateAddScriptToEvaluateOnNewDocument(source, worldName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("source", source); + if (!(string.IsNullOrEmpty(worldName))) + { + dict.Add("worldName", worldName); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.addScriptToEvaluateOnNewDocument", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Brings page to front (activates tab). + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task BringToFrontAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.bringToFront", dict); + return methodResult; + } + + partial void ValidateCaptureScreenshot(string format = null, int? quality = null, CefSharp.DevTools.Page.Viewport clip = null, bool? fromSurface = null); + /// + /// Capture page screenshot. + /// + /// Image compression format (defaults to png). + /// Compression quality from range [0..100] (jpeg only). + /// Capture the screenshot of a given region only. + /// Capture the screenshot from the surface, rather than the view. Defaults to true. + /// returns System.Threading.Tasks.Task<CaptureScreenshotResponse> + public async System.Threading.Tasks.Task CaptureScreenshotAsync(string format = null, int? quality = null, CefSharp.DevTools.Page.Viewport clip = null, bool? fromSurface = null) + { + ValidateCaptureScreenshot(format, quality, clip, fromSurface); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(format))) + { + dict.Add("format", format); + } + + if (quality.HasValue) + { + dict.Add("quality", quality.Value); + } + + if ((clip) != (null)) + { + dict.Add("clip", clip.ToDictionary()); + } + + if (fromSurface.HasValue) + { + dict.Add("fromSurface", fromSurface.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.captureScreenshot", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateCaptureSnapshot(string format = null); + /// + /// Returns a snapshot of the page as a string. For MHTML format, the serialization includes + /// iframes, shadow DOM, external resources, and element-inline styles. + /// + /// Format (defaults to mhtml). + /// returns System.Threading.Tasks.Task<CaptureSnapshotResponse> + public async System.Threading.Tasks.Task CaptureSnapshotAsync(string format = null) + { + ValidateCaptureSnapshot(format); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(format))) + { + dict.Add("format", format); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.captureSnapshot", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateCreateIsolatedWorld(string frameId, string worldName = null, bool? grantUniveralAccess = null); + /// + /// Creates an isolated world for the given frame. + /// + /// Id of the frame in which the isolated world should be created. + /// An optional name which is reported in the Execution Context. + /// Whether or not universal access should be granted to the isolated world. This is a powerful + public async System.Threading.Tasks.Task CreateIsolatedWorldAsync(string frameId, string worldName = null, bool? grantUniveralAccess = null) + { + ValidateCreateIsolatedWorld(frameId, worldName, grantUniveralAccess); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("frameId", frameId); + if (!(string.IsNullOrEmpty(worldName))) + { + dict.Add("worldName", worldName); + } + + if (grantUniveralAccess.HasValue) + { + dict.Add("grantUniveralAccess", grantUniveralAccess.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.createIsolatedWorld", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Disables page domain notifications. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.disable", dict); + return methodResult; + } + + /// + /// Enables page domain notifications. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.enable", dict); + return methodResult; + } + + /// + /// GetAppManifest + /// + /// returns System.Threading.Tasks.Task<GetAppManifestResponse> + public async System.Threading.Tasks.Task GetAppManifestAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.getAppManifest", dict); + return methodResult.DeserializeJson(); + } + + /// + /// GetInstallabilityErrors + /// + /// returns System.Threading.Tasks.Task<GetInstallabilityErrorsResponse> + public async System.Threading.Tasks.Task GetInstallabilityErrorsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.getInstallabilityErrors", dict); + return methodResult.DeserializeJson(); + } + + /// + /// GetManifestIcons + /// + /// returns System.Threading.Tasks.Task<GetManifestIconsResponse> + public async System.Threading.Tasks.Task GetManifestIconsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.getManifestIcons", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns present frame tree structure. + /// + /// returns System.Threading.Tasks.Task<GetFrameTreeResponse> + public async System.Threading.Tasks.Task GetFrameTreeAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.getFrameTree", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns metrics relating to the layouting of the page, such as viewport bounds/scale. + /// + /// returns System.Threading.Tasks.Task<GetLayoutMetricsResponse> + public async System.Threading.Tasks.Task GetLayoutMetricsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.getLayoutMetrics", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns navigation history for the current page. + /// + /// returns System.Threading.Tasks.Task<GetNavigationHistoryResponse> + public async System.Threading.Tasks.Task GetNavigationHistoryAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.getNavigationHistory", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Resets navigation history for the current page. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ResetNavigationHistoryAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.resetNavigationHistory", dict); + return methodResult; + } + + partial void ValidateGetResourceContent(string frameId, string url); + /// + /// Returns content of the given resource. + /// + /// Frame id to get resource for. + /// URL of the resource to get content for. + /// returns System.Threading.Tasks.Task<GetResourceContentResponse> + public async System.Threading.Tasks.Task GetResourceContentAsync(string frameId, string url) + { + ValidateGetResourceContent(frameId, url); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("frameId", frameId); + dict.Add("url", url); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.getResourceContent", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns present frame / resource tree structure. + /// + /// returns System.Threading.Tasks.Task<GetResourceTreeResponse> + public async System.Threading.Tasks.Task GetResourceTreeAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.getResourceTree", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateHandleJavaScriptDialog(bool accept, string promptText = null); + /// + /// Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload). + /// + /// Whether to accept or dismiss the dialog. + /// The text to enter into the dialog prompt before accepting. Used only if this is a prompt + public async System.Threading.Tasks.Task HandleJavaScriptDialogAsync(bool accept, string promptText = null) + { + ValidateHandleJavaScriptDialog(accept, promptText); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("accept", accept); + if (!(string.IsNullOrEmpty(promptText))) + { + dict.Add("promptText", promptText); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.handleJavaScriptDialog", dict); + return methodResult; + } + + partial void ValidateNavigate(string url, string referrer = null, CefSharp.DevTools.Page.TransitionType? transitionType = null, string frameId = null, CefSharp.DevTools.Page.ReferrerPolicy? referrerPolicy = null); + /// + /// Navigates current page to the given URL. + /// + /// URL to navigate the page to. + /// Referrer URL. + /// Intended transition type. + /// Frame id to navigate, if not specified navigates the top frame. + /// Referrer-policy used for the navigation. + /// returns System.Threading.Tasks.Task<NavigateResponse> + public async System.Threading.Tasks.Task NavigateAsync(string url, string referrer = null, CefSharp.DevTools.Page.TransitionType? transitionType = null, string frameId = null, CefSharp.DevTools.Page.ReferrerPolicy? referrerPolicy = null) + { + ValidateNavigate(url, referrer, transitionType, frameId, referrerPolicy); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("url", url); + if (!(string.IsNullOrEmpty(referrer))) + { + dict.Add("referrer", referrer); + } + + if (transitionType.HasValue) + { + dict.Add("transitionType", this.EnumToString(transitionType)); + } + + if (!(string.IsNullOrEmpty(frameId))) + { + dict.Add("frameId", frameId); + } + + if (referrerPolicy.HasValue) + { + dict.Add("referrerPolicy", this.EnumToString(referrerPolicy)); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.navigate", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateNavigateToHistoryEntry(int entryId); + /// + /// Navigates current page to the given history entry. + /// + /// Unique id of the entry to navigate to. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task NavigateToHistoryEntryAsync(int entryId) + { + ValidateNavigateToHistoryEntry(entryId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("entryId", entryId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.navigateToHistoryEntry", dict); + return methodResult; + } + + partial void ValidatePrintToPDF(bool? landscape = null, bool? displayHeaderFooter = null, bool? printBackground = null, long? scale = null, long? paperWidth = null, long? paperHeight = null, long? marginTop = null, long? marginBottom = null, long? marginLeft = null, long? marginRight = null, string pageRanges = null, bool? ignoreInvalidPageRanges = null, string headerTemplate = null, string footerTemplate = null, bool? preferCSSPageSize = null, string transferMode = null); + /// + /// Print page as PDF. + /// + /// Paper orientation. Defaults to false. + /// Display header and footer. Defaults to false. + /// Print background graphics. Defaults to false. + /// Scale of the webpage rendering. Defaults to 1. + /// Paper width in inches. Defaults to 8.5 inches. + /// Paper height in inches. Defaults to 11 inches. + /// Top margin in inches. Defaults to 1cm (~0.4 inches). + /// Bottom margin in inches. Defaults to 1cm (~0.4 inches). + /// Left margin in inches. Defaults to 1cm (~0.4 inches). + /// Right margin in inches. Defaults to 1cm (~0.4 inches). + /// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means + public async System.Threading.Tasks.Task PrintToPDFAsync(bool? landscape = null, bool? displayHeaderFooter = null, bool? printBackground = null, long? scale = null, long? paperWidth = null, long? paperHeight = null, long? marginTop = null, long? marginBottom = null, long? marginLeft = null, long? marginRight = null, string pageRanges = null, bool? ignoreInvalidPageRanges = null, string headerTemplate = null, string footerTemplate = null, bool? preferCSSPageSize = null, string transferMode = null) + { + ValidatePrintToPDF(landscape, displayHeaderFooter, printBackground, scale, paperWidth, paperHeight, marginTop, marginBottom, marginLeft, marginRight, pageRanges, ignoreInvalidPageRanges, headerTemplate, footerTemplate, preferCSSPageSize, transferMode); + var dict = new System.Collections.Generic.Dictionary(); + if (landscape.HasValue) + { + dict.Add("landscape", landscape.Value); + } + + if (displayHeaderFooter.HasValue) + { + dict.Add("displayHeaderFooter", displayHeaderFooter.Value); + } + + if (printBackground.HasValue) + { + dict.Add("printBackground", printBackground.Value); + } + + if (scale.HasValue) + { + dict.Add("scale", scale.Value); + } + + if (paperWidth.HasValue) + { + dict.Add("paperWidth", paperWidth.Value); + } + + if (paperHeight.HasValue) + { + dict.Add("paperHeight", paperHeight.Value); + } + + if (marginTop.HasValue) + { + dict.Add("marginTop", marginTop.Value); + } + + if (marginBottom.HasValue) + { + dict.Add("marginBottom", marginBottom.Value); + } + + if (marginLeft.HasValue) + { + dict.Add("marginLeft", marginLeft.Value); + } + + if (marginRight.HasValue) + { + dict.Add("marginRight", marginRight.Value); + } + + if (!(string.IsNullOrEmpty(pageRanges))) + { + dict.Add("pageRanges", pageRanges); + } + + if (ignoreInvalidPageRanges.HasValue) + { + dict.Add("ignoreInvalidPageRanges", ignoreInvalidPageRanges.Value); + } + + if (!(string.IsNullOrEmpty(headerTemplate))) + { + dict.Add("headerTemplate", headerTemplate); + } + + if (!(string.IsNullOrEmpty(footerTemplate))) + { + dict.Add("footerTemplate", footerTemplate); + } + + if (preferCSSPageSize.HasValue) + { + dict.Add("preferCSSPageSize", preferCSSPageSize.Value); + } + + if (!(string.IsNullOrEmpty(transferMode))) + { + dict.Add("transferMode", transferMode); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.printToPDF", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateReload(bool? ignoreCache = null, string scriptToEvaluateOnLoad = null); + /// + /// Reloads given page optionally ignoring the cache. + /// + /// If true, browser cache is ignored (as if the user pressed Shift+refresh). + /// If set, the script will be injected into all frames of the inspected page after reload. + public async System.Threading.Tasks.Task ReloadAsync(bool? ignoreCache = null, string scriptToEvaluateOnLoad = null) + { + ValidateReload(ignoreCache, scriptToEvaluateOnLoad); + var dict = new System.Collections.Generic.Dictionary(); + if (ignoreCache.HasValue) + { + dict.Add("ignoreCache", ignoreCache.Value); + } + + if (!(string.IsNullOrEmpty(scriptToEvaluateOnLoad))) + { + dict.Add("scriptToEvaluateOnLoad", scriptToEvaluateOnLoad); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.reload", dict); + return methodResult; + } + + partial void ValidateRemoveScriptToEvaluateOnNewDocument(string identifier); + /// + /// Removes given script from the list. + /// + /// identifier + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveScriptToEvaluateOnNewDocumentAsync(string identifier) + { + ValidateRemoveScriptToEvaluateOnNewDocument(identifier); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("identifier", identifier); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.removeScriptToEvaluateOnNewDocument", dict); + return methodResult; + } + + partial void ValidateScreencastFrameAck(int sessionId); + /// + /// Acknowledges that a screencast frame has been received by the frontend. + /// + /// Frame number. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ScreencastFrameAckAsync(int sessionId) + { + ValidateScreencastFrameAck(sessionId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("sessionId", sessionId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.screencastFrameAck", dict); + return methodResult; + } + + partial void ValidateSearchInResource(string frameId, string url, string query, bool? caseSensitive = null, bool? isRegex = null); + /// + /// Searches for given string in resource content. + /// + /// Frame id for resource to search in. + /// URL of the resource to search in. + /// String to search for. + /// If true, search is case sensitive. + /// If true, treats string parameter as regex. + /// returns System.Threading.Tasks.Task<SearchInResourceResponse> + public async System.Threading.Tasks.Task SearchInResourceAsync(string frameId, string url, string query, bool? caseSensitive = null, bool? isRegex = null) + { + ValidateSearchInResource(frameId, url, query, caseSensitive, isRegex); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("frameId", frameId); + dict.Add("url", url); + dict.Add("query", query); + if (caseSensitive.HasValue) + { + dict.Add("caseSensitive", caseSensitive.Value); + } + + if (isRegex.HasValue) + { + dict.Add("isRegex", isRegex.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.searchInResource", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetAdBlockingEnabled(bool enabled); + /// + /// Enable Chrome's experimental ad filter on all sites. + /// + /// Whether to block ads. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetAdBlockingEnabledAsync(bool enabled) + { + ValidateSetAdBlockingEnabled(enabled); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enabled", enabled); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.setAdBlockingEnabled", dict); + return methodResult; + } + + partial void ValidateSetBypassCSP(bool enabled); + /// + /// Enable page Content Security Policy by-passing. + /// + /// Whether to bypass page CSP. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetBypassCSPAsync(bool enabled) + { + ValidateSetBypassCSP(enabled); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enabled", enabled); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.setBypassCSP", dict); + return methodResult; + } + + partial void ValidateSetFontFamilies(CefSharp.DevTools.Page.FontFamilies fontFamilies); + /// + /// Set generic font families. + /// + /// Specifies font families to set. If a font family is not specified, it won't be changed. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetFontFamiliesAsync(CefSharp.DevTools.Page.FontFamilies fontFamilies) + { + ValidateSetFontFamilies(fontFamilies); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("fontFamilies", fontFamilies.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.setFontFamilies", dict); + return methodResult; + } + + partial void ValidateSetFontSizes(CefSharp.DevTools.Page.FontSizes fontSizes); + /// + /// Set default font sizes. + /// + /// Specifies font sizes to set. If a font size is not specified, it won't be changed. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetFontSizesAsync(CefSharp.DevTools.Page.FontSizes fontSizes) + { + ValidateSetFontSizes(fontSizes); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("fontSizes", fontSizes.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.setFontSizes", dict); + return methodResult; + } + + partial void ValidateSetDocumentContent(string frameId, string html); + /// + /// Sets given markup as the document's HTML. + /// + /// Frame id to set HTML for. + /// HTML content to set. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetDocumentContentAsync(string frameId, string html) + { + ValidateSetDocumentContent(frameId, html); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("frameId", frameId); + dict.Add("html", html); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.setDocumentContent", dict); + return methodResult; + } + + partial void ValidateSetLifecycleEventsEnabled(bool enabled); + /// + /// Controls whether page will emit lifecycle events. + /// + /// If true, starts emitting lifecycle events. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetLifecycleEventsEnabledAsync(bool enabled) + { + ValidateSetLifecycleEventsEnabled(enabled); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enabled", enabled); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.setLifecycleEventsEnabled", dict); + return methodResult; + } + + partial void ValidateStartScreencast(string format = null, int? quality = null, int? maxWidth = null, int? maxHeight = null, int? everyNthFrame = null); + /// + /// Starts sending each frame using the `screencastFrame` event. + /// + /// Image compression format. + /// Compression quality from range [0..100]. + /// Maximum screenshot width. + /// Maximum screenshot height. + /// Send every n-th frame. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartScreencastAsync(string format = null, int? quality = null, int? maxWidth = null, int? maxHeight = null, int? everyNthFrame = null) + { + ValidateStartScreencast(format, quality, maxWidth, maxHeight, everyNthFrame); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(format))) + { + dict.Add("format", format); + } + + if (quality.HasValue) + { + dict.Add("quality", quality.Value); + } + + if (maxWidth.HasValue) + { + dict.Add("maxWidth", maxWidth.Value); + } + + if (maxHeight.HasValue) + { + dict.Add("maxHeight", maxHeight.Value); + } + + if (everyNthFrame.HasValue) + { + dict.Add("everyNthFrame", everyNthFrame.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.startScreencast", dict); + return methodResult; + } + + /// + /// Force the page stop all navigations and pending resource fetches. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopLoadingAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.stopLoading", dict); + return methodResult; + } + + /// + /// Crashes renderer on the IO thread, generates minidumps. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task CrashAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.crash", dict); + return methodResult; + } + + /// + /// Tries to close page, running its beforeunload hooks, if any. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task CloseAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.close", dict); + return methodResult; + } + + partial void ValidateSetWebLifecycleState(string state); + /// + /// Tries to update the web lifecycle state of the page. + /// It will transition the page to the given state according to: + /// https://github.com/WICG/web-lifecycle/ + /// + /// Target lifecycle state + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetWebLifecycleStateAsync(string state) + { + ValidateSetWebLifecycleState(state); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("state", state); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.setWebLifecycleState", dict); + return methodResult; + } + + /// + /// Stops sending each frame in the `screencastFrame`. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopScreencastAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.stopScreencast", dict); + return methodResult; + } + + partial void ValidateSetProduceCompilationCache(bool enabled); + /// + /// Forces compilation cache to be generated for every subresource script. + /// + /// enabled + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetProduceCompilationCacheAsync(bool enabled) + { + ValidateSetProduceCompilationCache(enabled); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enabled", enabled); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.setProduceCompilationCache", dict); + return methodResult; + } + + partial void ValidateAddCompilationCache(string url, byte[] data); + /// + /// Seeds compilation cache for given url. Compilation cache does not survive + /// cross-process navigation. + /// + /// url + /// Base64-encoded data + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task AddCompilationCacheAsync(string url, byte[] data) + { + ValidateAddCompilationCache(url, data); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("url", url); + dict.Add("data", ToBase64String(data)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.addCompilationCache", dict); + return methodResult; + } + + /// + /// Clears seeded compilation cache. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearCompilationCacheAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.clearCompilationCache", dict); + return methodResult; + } + + partial void ValidateGenerateTestReport(string message, string group = null); + /// + /// Generates a report for testing. + /// + /// Message to be displayed in the report. + /// Specifies the endpoint group to deliver the report to. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task GenerateTestReportAsync(string message, string group = null) + { + ValidateGenerateTestReport(message, group); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("message", message); + if (!(string.IsNullOrEmpty(group))) + { + dict.Add("group", group); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.generateTestReport", dict); + return methodResult; + } + + /// + /// Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task WaitForDebuggerAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.waitForDebugger", dict); + return methodResult; + } + + partial void ValidateSetInterceptFileChooserDialog(bool enabled); + /// + /// Intercept file chooser requests and transfer control to protocol clients. + /// When file chooser interception is enabled, native file chooser dialog is not shown. + /// Instead, a protocol event `Page.fileChooserOpened` is emitted. + /// + /// enabled + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetInterceptFileChooserDialogAsync(bool enabled) + { + ValidateSetInterceptFileChooserDialog(enabled); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enabled", enabled); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Page.setInterceptFileChooserDialog", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/PrintToPDFResponse.cs b/CefSharp/DevTools/Page/PrintToPDFResponse.cs new file mode 100644 index 0000000000..a7aa5507be --- /dev/null +++ b/CefSharp/DevTools/Page/PrintToPDFResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// PrintToPDFResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PrintToPDFResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string data + { + get; + set; + } + + /// + /// data + /// + public byte[] Data + { + get + { + return Convert(data); + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string stream + { + get; + set; + } + + /// + /// stream + /// + public string Stream + { + get + { + return stream; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/ScreencastFrameMetadata.cs b/CefSharp/DevTools/Page/ScreencastFrameMetadata.cs new file mode 100644 index 0000000000..43fe282de8 --- /dev/null +++ b/CefSharp/DevTools/Page/ScreencastFrameMetadata.cs @@ -0,0 +1,82 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Screencast frame metadata. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ScreencastFrameMetadata : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Top offset in DIP. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("offsetTop"), IsRequired = (true))] + public long OffsetTop + { + get; + set; + } + + /// + /// Page scale factor. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pageScaleFactor"), IsRequired = (true))] + public long PageScaleFactor + { + get; + set; + } + + /// + /// Device screen width in DIP. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("deviceWidth"), IsRequired = (true))] + public long DeviceWidth + { + get; + set; + } + + /// + /// Device screen height in DIP. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("deviceHeight"), IsRequired = (true))] + public long DeviceHeight + { + get; + set; + } + + /// + /// Position of horizontal scroll in CSS pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scrollOffsetX"), IsRequired = (true))] + public long ScrollOffsetX + { + get; + set; + } + + /// + /// Position of vertical scroll in CSS pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scrollOffsetY"), IsRequired = (true))] + public long ScrollOffsetY + { + get; + set; + } + + /// + /// Frame swap timestamp. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("timestamp"), IsRequired = (false))] + public long? Timestamp + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/SearchInResourceResponse.cs b/CefSharp/DevTools/Page/SearchInResourceResponse.cs new file mode 100644 index 0000000000..a1aa63cda5 --- /dev/null +++ b/CefSharp/DevTools/Page/SearchInResourceResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// SearchInResourceResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SearchInResourceResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList result + { + get; + set; + } + + /// + /// result + /// + public System.Collections.Generic.IList Result + { + get + { + return result; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/Viewport.cs b/CefSharp/DevTools/Page/Viewport.cs new file mode 100644 index 0000000000..01de482f5e --- /dev/null +++ b/CefSharp/DevTools/Page/Viewport.cs @@ -0,0 +1,62 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Viewport for capturing screenshot. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Viewport : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// X offset in device independent pixels (dip). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("x"), IsRequired = (true))] + public long X + { + get; + set; + } + + /// + /// Y offset in device independent pixels (dip). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("y"), IsRequired = (true))] + public long Y + { + get; + set; + } + + /// + /// Rectangle width in device independent pixels (dip). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("width"), IsRequired = (true))] + public long Width + { + get; + set; + } + + /// + /// Rectangle height in device independent pixels (dip). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("height"), IsRequired = (true))] + public long Height + { + get; + set; + } + + /// + /// Page scale factor. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scale"), IsRequired = (true))] + public long Scale + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Page/VisualViewport.cs b/CefSharp/DevTools/Page/VisualViewport.cs new file mode 100644 index 0000000000..e0d5160f7b --- /dev/null +++ b/CefSharp/DevTools/Page/VisualViewport.cs @@ -0,0 +1,92 @@ +// Copyright © 2020 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.DevTools.Page +{ + /// + /// Visual viewport position, dimensions, and scale. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class VisualViewport : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Horizontal offset relative to the layout viewport (CSS pixels). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("offsetX"), IsRequired = (true))] + public long OffsetX + { + get; + set; + } + + /// + /// Vertical offset relative to the layout viewport (CSS pixels). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("offsetY"), IsRequired = (true))] + public long OffsetY + { + get; + set; + } + + /// + /// Horizontal offset relative to the document (CSS pixels). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pageX"), IsRequired = (true))] + public long PageX + { + get; + set; + } + + /// + /// Vertical offset relative to the document (CSS pixels). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("pageY"), IsRequired = (true))] + public long PageY + { + get; + set; + } + + /// + /// Width (CSS pixels), excludes scrollbar if present. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("clientWidth"), IsRequired = (true))] + public long ClientWidth + { + get; + set; + } + + /// + /// Height (CSS pixels), excludes scrollbar if present. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("clientHeight"), IsRequired = (true))] + public long ClientHeight + { + get; + set; + } + + /// + /// Scale relative to the ideal viewport (size at width=device-width). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scale"), IsRequired = (true))] + public long Scale + { + get; + set; + } + + /// + /// Page zoom factor (CSS to device independent pixels ratio). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("zoom"), IsRequired = (false))] + public long? Zoom + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Performance/GetMetricsResponse.cs b/CefSharp/DevTools/Performance/GetMetricsResponse.cs new file mode 100644 index 0000000000..f0090ea00b --- /dev/null +++ b/CefSharp/DevTools/Performance/GetMetricsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Performance +{ + /// + /// GetMetricsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetMetricsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList metrics + { + get; + set; + } + + /// + /// metrics + /// + public System.Collections.Generic.IList Metrics + { + get + { + return metrics; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Performance/Metric.cs b/CefSharp/DevTools/Performance/Metric.cs new file mode 100644 index 0000000000..889ed4b8f3 --- /dev/null +++ b/CefSharp/DevTools/Performance/Metric.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Performance +{ + /// + /// Run-time execution metric. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Metric : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Metric name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Metric value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public long Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Performance/Performance.cs b/CefSharp/DevTools/Performance/Performance.cs new file mode 100644 index 0000000000..e2a1109ad7 --- /dev/null +++ b/CefSharp/DevTools/Performance/Performance.cs @@ -0,0 +1,60 @@ +// Copyright © 2020 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.DevTools.Performance +{ + using System.Linq; + + /// + /// Performance + /// + public partial class Performance : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Performance(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disable collecting and reporting metrics. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Performance.disable", dict); + return methodResult; + } + + partial void ValidateEnable(string timeDomain = null); + /// + /// Enable collecting and reporting metrics. + /// + /// Time domain to use for collecting and reporting duration metrics. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync(string timeDomain = null) + { + ValidateEnable(timeDomain); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(timeDomain))) + { + dict.Add("timeDomain", timeDomain); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Performance.enable", dict); + return methodResult; + } + + /// + /// Retrieve current values of run-time metrics. + /// + /// returns System.Threading.Tasks.Task<GetMetricsResponse> + public async System.Threading.Tasks.Task GetMetricsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Performance.getMetrics", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/CounterInfo.cs b/CefSharp/DevTools/Profiler/CounterInfo.cs new file mode 100644 index 0000000000..ed668b11f0 --- /dev/null +++ b/CefSharp/DevTools/Profiler/CounterInfo.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Collected counter information. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CounterInfo : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Counter name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Counter value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public int Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/CoverageRange.cs b/CefSharp/DevTools/Profiler/CoverageRange.cs new file mode 100644 index 0000000000..29bceb6a81 --- /dev/null +++ b/CefSharp/DevTools/Profiler/CoverageRange.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Coverage data for a source range. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CoverageRange : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// JavaScript script source offset for the range start. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("startOffset"), IsRequired = (true))] + public int StartOffset + { + get; + set; + } + + /// + /// JavaScript script source offset for the range end. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("endOffset"), IsRequired = (true))] + public int EndOffset + { + get; + set; + } + + /// + /// Collected execution count of the source range. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("count"), IsRequired = (true))] + public int Count + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/FunctionCoverage.cs b/CefSharp/DevTools/Profiler/FunctionCoverage.cs new file mode 100644 index 0000000000..2a721a2307 --- /dev/null +++ b/CefSharp/DevTools/Profiler/FunctionCoverage.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Coverage data for a JavaScript function. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class FunctionCoverage : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// JavaScript function name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("functionName"), IsRequired = (true))] + public string FunctionName + { + get; + set; + } + + /// + /// Source ranges inside the function with coverage data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("ranges"), IsRequired = (true))] + public System.Collections.Generic.IList Ranges + { + get; + set; + } + + /// + /// Whether coverage data for this function has block granularity. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isBlockCoverage"), IsRequired = (true))] + public bool IsBlockCoverage + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/GetBestEffortCoverageResponse.cs b/CefSharp/DevTools/Profiler/GetBestEffortCoverageResponse.cs new file mode 100644 index 0000000000..54573a689b --- /dev/null +++ b/CefSharp/DevTools/Profiler/GetBestEffortCoverageResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// GetBestEffortCoverageResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetBestEffortCoverageResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList result + { + get; + set; + } + + /// + /// result + /// + public System.Collections.Generic.IList Result + { + get + { + return result; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/GetRuntimeCallStatsResponse.cs b/CefSharp/DevTools/Profiler/GetRuntimeCallStatsResponse.cs new file mode 100644 index 0000000000..34dec9223d --- /dev/null +++ b/CefSharp/DevTools/Profiler/GetRuntimeCallStatsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// GetRuntimeCallStatsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetRuntimeCallStatsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList result + { + get; + set; + } + + /// + /// result + /// + public System.Collections.Generic.IList Result + { + get + { + return result; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/PositionTickInfo.cs b/CefSharp/DevTools/Profiler/PositionTickInfo.cs new file mode 100644 index 0000000000..cf2dc422fc --- /dev/null +++ b/CefSharp/DevTools/Profiler/PositionTickInfo.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Specifies a number of samples attributed to a certain source position. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PositionTickInfo : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Source line number (1-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("line"), IsRequired = (true))] + public int Line + { + get; + set; + } + + /// + /// Number of samples attributed to the source line. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("ticks"), IsRequired = (true))] + public int Ticks + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/Profile.cs b/CefSharp/DevTools/Profiler/Profile.cs new file mode 100644 index 0000000000..0e2766d1be --- /dev/null +++ b/CefSharp/DevTools/Profiler/Profile.cs @@ -0,0 +1,63 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Profile. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Profile : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The list of profile nodes. First item is the root node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodes"), IsRequired = (true))] + public System.Collections.Generic.IList Nodes + { + get; + set; + } + + /// + /// Profiling start timestamp in microseconds. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("startTime"), IsRequired = (true))] + public long StartTime + { + get; + set; + } + + /// + /// Profiling end timestamp in microseconds. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("endTime"), IsRequired = (true))] + public long EndTime + { + get; + set; + } + + /// + /// Ids of samples top nodes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("samples"), IsRequired = (false))] + public int[] Samples + { + get; + set; + } + + /// + /// Time intervals between adjacent samples in microseconds. The first delta is relative to the + /// profile startTime. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("timeDeltas"), IsRequired = (false))] + public int[] TimeDeltas + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/ProfileNode.cs b/CefSharp/DevTools/Profiler/ProfileNode.cs new file mode 100644 index 0000000000..a6fea6589b --- /dev/null +++ b/CefSharp/DevTools/Profiler/ProfileNode.cs @@ -0,0 +1,73 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Profile node. Holds callsite information, execution statistics and child nodes. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ProfileNode : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Unique id of the node. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("id"), IsRequired = (true))] + public int Id + { + get; + set; + } + + /// + /// Function location. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("callFrame"), IsRequired = (true))] + public CefSharp.DevTools.Runtime.CallFrame CallFrame + { + get; + set; + } + + /// + /// Number of samples where this node was on top of the call stack. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("hitCount"), IsRequired = (false))] + public int? HitCount + { + get; + set; + } + + /// + /// Child node ids. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("children"), IsRequired = (false))] + public int[] Children + { + get; + set; + } + + /// + /// The reason of being not optimized. The function may be deoptimized or marked as don't + /// optimize. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("deoptReason"), IsRequired = (false))] + public string DeoptReason + { + get; + set; + } + + /// + /// An array of source position ticks. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("positionTicks"), IsRequired = (false))] + public System.Collections.Generic.IList PositionTicks + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/Profiler.cs b/CefSharp/DevTools/Profiler/Profiler.cs new file mode 100644 index 0000000000..b3dc1caf51 --- /dev/null +++ b/CefSharp/DevTools/Profiler/Profiler.cs @@ -0,0 +1,213 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + using System.Linq; + + /// + /// Profiler + /// + public partial class Profiler : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Profiler(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disable + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.disable", dict); + return methodResult; + } + + /// + /// Enable + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.enable", dict); + return methodResult; + } + + /// + /// Collect coverage data for the current isolate. The coverage data may be incomplete due to + /// garbage collection. + /// + /// returns System.Threading.Tasks.Task<GetBestEffortCoverageResponse> + public async System.Threading.Tasks.Task GetBestEffortCoverageAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.getBestEffortCoverage", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetSamplingInterval(int interval); + /// + /// Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. + /// + /// New sampling interval in microseconds. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetSamplingIntervalAsync(int interval) + { + ValidateSetSamplingInterval(interval); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("interval", interval); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.setSamplingInterval", dict); + return methodResult; + } + + /// + /// Start + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.start", dict); + return methodResult; + } + + partial void ValidateStartPreciseCoverage(bool? callCount = null, bool? detailed = null, bool? allowTriggeredUpdates = null); + /// + /// Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code + /// coverage may be incomplete. Enabling prevents running optimized code and resets execution + /// counters. + /// + /// Collect accurate call counts beyond simple 'covered' or 'not covered'. + /// Collect block-based coverage. + /// Allow the backend to send updates on its own initiative + /// returns System.Threading.Tasks.Task<StartPreciseCoverageResponse> + public async System.Threading.Tasks.Task StartPreciseCoverageAsync(bool? callCount = null, bool? detailed = null, bool? allowTriggeredUpdates = null) + { + ValidateStartPreciseCoverage(callCount, detailed, allowTriggeredUpdates); + var dict = new System.Collections.Generic.Dictionary(); + if (callCount.HasValue) + { + dict.Add("callCount", callCount.Value); + } + + if (detailed.HasValue) + { + dict.Add("detailed", detailed.Value); + } + + if (allowTriggeredUpdates.HasValue) + { + dict.Add("allowTriggeredUpdates", allowTriggeredUpdates.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.startPreciseCoverage", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Enable type profile. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartTypeProfileAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.startTypeProfile", dict); + return methodResult; + } + + /// + /// Stop + /// + /// returns System.Threading.Tasks.Task<StopResponse> + public async System.Threading.Tasks.Task StopAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.stop", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Disable precise code coverage. Disabling releases unnecessary execution count records and allows + /// executing optimized code. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopPreciseCoverageAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.stopPreciseCoverage", dict); + return methodResult; + } + + /// + /// Disable type profile. Disabling releases type profile data collected so far. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopTypeProfileAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.stopTypeProfile", dict); + return methodResult; + } + + /// + /// Collect coverage data for the current isolate, and resets execution counters. Precise code + /// coverage needs to have started. + /// + /// returns System.Threading.Tasks.Task<TakePreciseCoverageResponse> + public async System.Threading.Tasks.Task TakePreciseCoverageAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.takePreciseCoverage", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Collect type profile. + /// + /// returns System.Threading.Tasks.Task<TakeTypeProfileResponse> + public async System.Threading.Tasks.Task TakeTypeProfileAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.takeTypeProfile", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Enable run time call stats collection. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableRuntimeCallStatsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.enableRuntimeCallStats", dict); + return methodResult; + } + + /// + /// Disable run time call stats collection. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableRuntimeCallStatsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.disableRuntimeCallStats", dict); + return methodResult; + } + + /// + /// Retrieve run time call stats. + /// + /// returns System.Threading.Tasks.Task<GetRuntimeCallStatsResponse> + public async System.Threading.Tasks.Task GetRuntimeCallStatsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Profiler.getRuntimeCallStats", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/ScriptCoverage.cs b/CefSharp/DevTools/Profiler/ScriptCoverage.cs new file mode 100644 index 0000000000..a4b457a64b --- /dev/null +++ b/CefSharp/DevTools/Profiler/ScriptCoverage.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Coverage data for a JavaScript script. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ScriptCoverage : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// JavaScript script id. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptId"), IsRequired = (true))] + public string ScriptId + { + get; + set; + } + + /// + /// JavaScript script name or url. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// Functions contained in the script that has coverage data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("functions"), IsRequired = (true))] + public System.Collections.Generic.IList Functions + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/ScriptTypeProfile.cs b/CefSharp/DevTools/Profiler/ScriptTypeProfile.cs new file mode 100644 index 0000000000..3f45ecc773 --- /dev/null +++ b/CefSharp/DevTools/Profiler/ScriptTypeProfile.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Type profile data collected during runtime for a JavaScript script. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ScriptTypeProfile : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// JavaScript script id. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptId"), IsRequired = (true))] + public string ScriptId + { + get; + set; + } + + /// + /// JavaScript script name or url. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// Type profile entries for parameters and return values of the functions in the script. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("entries"), IsRequired = (true))] + public System.Collections.Generic.IList Entries + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/StartPreciseCoverageResponse.cs b/CefSharp/DevTools/Profiler/StartPreciseCoverageResponse.cs new file mode 100644 index 0000000000..63af150f7c --- /dev/null +++ b/CefSharp/DevTools/Profiler/StartPreciseCoverageResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// StartPreciseCoverageResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class StartPreciseCoverageResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal long timestamp + { + get; + set; + } + + /// + /// timestamp + /// + public long Timestamp + { + get + { + return timestamp; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/StopResponse.cs b/CefSharp/DevTools/Profiler/StopResponse.cs new file mode 100644 index 0000000000..347ae3a55c --- /dev/null +++ b/CefSharp/DevTools/Profiler/StopResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// StopResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class StopResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Profiler.Profile profile + { + get; + set; + } + + /// + /// profile + /// + public CefSharp.DevTools.Profiler.Profile Profile + { + get + { + return profile; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/TakePreciseCoverageResponse.cs b/CefSharp/DevTools/Profiler/TakePreciseCoverageResponse.cs new file mode 100644 index 0000000000..9c9a881712 --- /dev/null +++ b/CefSharp/DevTools/Profiler/TakePreciseCoverageResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// TakePreciseCoverageResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TakePreciseCoverageResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList result + { + get; + set; + } + + /// + /// result + /// + public System.Collections.Generic.IList Result + { + get + { + return result; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal long timestamp + { + get; + set; + } + + /// + /// timestamp + /// + public long Timestamp + { + get + { + return timestamp; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/TakeTypeProfileResponse.cs b/CefSharp/DevTools/Profiler/TakeTypeProfileResponse.cs new file mode 100644 index 0000000000..64be180584 --- /dev/null +++ b/CefSharp/DevTools/Profiler/TakeTypeProfileResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// TakeTypeProfileResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TakeTypeProfileResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList result + { + get; + set; + } + + /// + /// result + /// + public System.Collections.Generic.IList Result + { + get + { + return result; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/TypeObject.cs b/CefSharp/DevTools/Profiler/TypeObject.cs new file mode 100644 index 0000000000..02d444b210 --- /dev/null +++ b/CefSharp/DevTools/Profiler/TypeObject.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Describes a type collected during runtime. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TypeObject : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Name of a type collected with type profiling. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Profiler/TypeProfileEntry.cs b/CefSharp/DevTools/Profiler/TypeProfileEntry.cs new file mode 100644 index 0000000000..105016caff --- /dev/null +++ b/CefSharp/DevTools/Profiler/TypeProfileEntry.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Profiler +{ + /// + /// Source offset and types for a parameter or return value. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TypeProfileEntry : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Source offset of the parameter or end of function for return values. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("offset"), IsRequired = (true))] + public int Offset + { + get; + set; + } + + /// + /// The types for this parameter or return value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("types"), IsRequired = (true))] + public System.Collections.Generic.IList Types + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/AwaitPromiseResponse.cs b/CefSharp/DevTools/Runtime/AwaitPromiseResponse.cs new file mode 100644 index 0000000000..b49bc3c7d7 --- /dev/null +++ b/CefSharp/DevTools/Runtime/AwaitPromiseResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// AwaitPromiseResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AwaitPromiseResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject result + { + get; + set; + } + + /// + /// result + /// + public CefSharp.DevTools.Runtime.RemoteObject Result + { + get + { + return result; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.ExceptionDetails exceptionDetails + { + get; + set; + } + + /// + /// exceptionDetails + /// + public CefSharp.DevTools.Runtime.ExceptionDetails ExceptionDetails + { + get + { + return exceptionDetails; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/CallArgument.cs b/CefSharp/DevTools/Runtime/CallArgument.cs new file mode 100644 index 0000000000..4bc414a8bd --- /dev/null +++ b/CefSharp/DevTools/Runtime/CallArgument.cs @@ -0,0 +1,43 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Represents function call argument. Either remote object id `objectId`, primitive `value`, + /// unserializable primitive value or neither of (for undefined) them should be specified. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CallArgument : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Primitive value or serializable javascript object. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public object Value + { + get; + set; + } + + /// + /// Primitive value which can not be JSON-stringified. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("unserializableValue"), IsRequired = (false))] + public string UnserializableValue + { + get; + set; + } + + /// + /// Remote object handle. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("objectId"), IsRequired = (false))] + public string ObjectId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/CallFrame.cs b/CefSharp/DevTools/Runtime/CallFrame.cs new file mode 100644 index 0000000000..4da0c186b4 --- /dev/null +++ b/CefSharp/DevTools/Runtime/CallFrame.cs @@ -0,0 +1,62 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Stack entry for runtime errors and assertions. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CallFrame : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// JavaScript function name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("functionName"), IsRequired = (true))] + public string FunctionName + { + get; + set; + } + + /// + /// JavaScript script id. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptId"), IsRequired = (true))] + public string ScriptId + { + get; + set; + } + + /// + /// JavaScript script name or url. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// JavaScript script line number (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (true))] + public int LineNumber + { + get; + set; + } + + /// + /// JavaScript script column number (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("columnNumber"), IsRequired = (true))] + public int ColumnNumber + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/CallFunctionOnResponse.cs b/CefSharp/DevTools/Runtime/CallFunctionOnResponse.cs new file mode 100644 index 0000000000..33e367064d --- /dev/null +++ b/CefSharp/DevTools/Runtime/CallFunctionOnResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// CallFunctionOnResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CallFunctionOnResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject result + { + get; + set; + } + + /// + /// result + /// + public CefSharp.DevTools.Runtime.RemoteObject Result + { + get + { + return result; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.ExceptionDetails exceptionDetails + { + get; + set; + } + + /// + /// exceptionDetails + /// + public CefSharp.DevTools.Runtime.ExceptionDetails ExceptionDetails + { + get + { + return exceptionDetails; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/CompileScriptResponse.cs b/CefSharp/DevTools/Runtime/CompileScriptResponse.cs new file mode 100644 index 0000000000..788f6d061d --- /dev/null +++ b/CefSharp/DevTools/Runtime/CompileScriptResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// CompileScriptResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CompileScriptResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string scriptId + { + get; + set; + } + + /// + /// scriptId + /// + public string ScriptId + { + get + { + return scriptId; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.ExceptionDetails exceptionDetails + { + get; + set; + } + + /// + /// exceptionDetails + /// + public CefSharp.DevTools.Runtime.ExceptionDetails ExceptionDetails + { + get + { + return exceptionDetails; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/CustomPreview.cs b/CefSharp/DevTools/Runtime/CustomPreview.cs new file mode 100644 index 0000000000..36b07104e5 --- /dev/null +++ b/CefSharp/DevTools/Runtime/CustomPreview.cs @@ -0,0 +1,35 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// CustomPreview + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CustomPreview : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The JSON-stringified result of formatter.header(object, config) call. + /// It contains json ML array that represents RemoteObject. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("header"), IsRequired = (true))] + public string Header + { + get; + set; + } + + /// + /// If formatter returns true as a result of formatter.hasBody call then bodyGetterId will + /// contain RemoteObjectId for the function that returns result of formatter.body(object, config) call. + /// The result value is json ML array. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("bodyGetterId"), IsRequired = (false))] + public string BodyGetterId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/EntryPreview.cs b/CefSharp/DevTools/Runtime/EntryPreview.cs new file mode 100644 index 0000000000..22820a9130 --- /dev/null +++ b/CefSharp/DevTools/Runtime/EntryPreview.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// EntryPreview + /// + [System.Runtime.Serialization.DataContractAttribute] + public class EntryPreview : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Preview of the key. Specified for map-like collection entries. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("key"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.ObjectPreview Key + { + get; + set; + } + + /// + /// Preview of the value. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (true))] + public CefSharp.DevTools.Runtime.ObjectPreview Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/EvaluateResponse.cs b/CefSharp/DevTools/Runtime/EvaluateResponse.cs new file mode 100644 index 0000000000..48230f8edc --- /dev/null +++ b/CefSharp/DevTools/Runtime/EvaluateResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// EvaluateResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class EvaluateResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject result + { + get; + set; + } + + /// + /// result + /// + public CefSharp.DevTools.Runtime.RemoteObject Result + { + get + { + return result; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.ExceptionDetails exceptionDetails + { + get; + set; + } + + /// + /// exceptionDetails + /// + public CefSharp.DevTools.Runtime.ExceptionDetails ExceptionDetails + { + get + { + return exceptionDetails; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/ExceptionDetails.cs b/CefSharp/DevTools/Runtime/ExceptionDetails.cs new file mode 100644 index 0000000000..7ff26a5c3e --- /dev/null +++ b/CefSharp/DevTools/Runtime/ExceptionDetails.cs @@ -0,0 +1,103 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Detailed information about exception (or error) that was thrown during script compilation or + /// execution. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ExceptionDetails : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Exception id. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("exceptionId"), IsRequired = (true))] + public int ExceptionId + { + get; + set; + } + + /// + /// Exception text, which should be used together with exception object when available. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("text"), IsRequired = (true))] + public string Text + { + get; + set; + } + + /// + /// Line number of the exception location (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (true))] + public int LineNumber + { + get; + set; + } + + /// + /// Column number of the exception location (0-based). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("columnNumber"), IsRequired = (true))] + public int ColumnNumber + { + get; + set; + } + + /// + /// Script ID of the exception location. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptId"), IsRequired = (false))] + public string ScriptId + { + get; + set; + } + + /// + /// URL of the exception location, to be used when the script was not reported. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (false))] + public string Url + { + get; + set; + } + + /// + /// JavaScript stack trace if available. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("stackTrace"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.StackTrace StackTrace + { + get; + set; + } + + /// + /// Exception object if available. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("exception"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Exception + { + get; + set; + } + + /// + /// Identifier of the context where exception happened. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("executionContextId"), IsRequired = (false))] + public int? ExecutionContextId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/ExecutionContextDescription.cs b/CefSharp/DevTools/Runtime/ExecutionContextDescription.cs new file mode 100644 index 0000000000..9308b3a16b --- /dev/null +++ b/CefSharp/DevTools/Runtime/ExecutionContextDescription.cs @@ -0,0 +1,53 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Description of an isolated world. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ExecutionContextDescription : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Unique id of the execution context. It can be used to specify in which execution context + /// script evaluation should be performed. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("id"), IsRequired = (true))] + public int Id + { + get; + set; + } + + /// + /// Execution context origin. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("origin"), IsRequired = (true))] + public string Origin + { + get; + set; + } + + /// + /// Human readable name describing given context. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Embedder-specific auxiliary data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("auxData"), IsRequired = (false))] + public object AuxData + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/GetHeapUsageResponse.cs b/CefSharp/DevTools/Runtime/GetHeapUsageResponse.cs new file mode 100644 index 0000000000..0802eddda3 --- /dev/null +++ b/CefSharp/DevTools/Runtime/GetHeapUsageResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// GetHeapUsageResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetHeapUsageResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal long usedSize + { + get; + set; + } + + /// + /// usedSize + /// + public long UsedSize + { + get + { + return usedSize; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal long totalSize + { + get; + set; + } + + /// + /// totalSize + /// + public long TotalSize + { + get + { + return totalSize; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/GetIsolateIdResponse.cs b/CefSharp/DevTools/Runtime/GetIsolateIdResponse.cs new file mode 100644 index 0000000000..6e5a441c98 --- /dev/null +++ b/CefSharp/DevTools/Runtime/GetIsolateIdResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// GetIsolateIdResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetIsolateIdResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string id + { + get; + set; + } + + /// + /// id + /// + public string Id + { + get + { + return id; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/GetPropertiesResponse.cs b/CefSharp/DevTools/Runtime/GetPropertiesResponse.cs new file mode 100644 index 0000000000..224c6eb8ae --- /dev/null +++ b/CefSharp/DevTools/Runtime/GetPropertiesResponse.cs @@ -0,0 +1,84 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// GetPropertiesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetPropertiesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList result + { + get; + set; + } + + /// + /// result + /// + public System.Collections.Generic.IList Result + { + get + { + return result; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList internalProperties + { + get; + set; + } + + /// + /// internalProperties + /// + public System.Collections.Generic.IList InternalProperties + { + get + { + return internalProperties; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList privateProperties + { + get; + set; + } + + /// + /// privateProperties + /// + public System.Collections.Generic.IList PrivateProperties + { + get + { + return privateProperties; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.ExceptionDetails exceptionDetails + { + get; + set; + } + + /// + /// exceptionDetails + /// + public CefSharp.DevTools.Runtime.ExceptionDetails ExceptionDetails + { + get + { + return exceptionDetails; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/GlobalLexicalScopeNamesResponse.cs b/CefSharp/DevTools/Runtime/GlobalLexicalScopeNamesResponse.cs new file mode 100644 index 0000000000..92bc4ba9c3 --- /dev/null +++ b/CefSharp/DevTools/Runtime/GlobalLexicalScopeNamesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// GlobalLexicalScopeNamesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GlobalLexicalScopeNamesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] names + { + get; + set; + } + + /// + /// names + /// + public string[] Names + { + get + { + return names; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/InternalPropertyDescriptor.cs b/CefSharp/DevTools/Runtime/InternalPropertyDescriptor.cs new file mode 100644 index 0000000000..aeac35a10f --- /dev/null +++ b/CefSharp/DevTools/Runtime/InternalPropertyDescriptor.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Object internal property descriptor. This property isn't normally visible in JavaScript code. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class InternalPropertyDescriptor : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Conventional property name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// The value associated with the property. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Value + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/ObjectPreview.cs b/CefSharp/DevTools/Runtime/ObjectPreview.cs new file mode 100644 index 0000000000..5f0af40703 --- /dev/null +++ b/CefSharp/DevTools/Runtime/ObjectPreview.cs @@ -0,0 +1,72 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Object containing abbreviated remote object value. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ObjectPreview : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Object type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// Object subtype hint. Specified for `object` type values only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("subtype"), IsRequired = (false))] + public string Subtype + { + get; + set; + } + + /// + /// String representation of the object. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("description"), IsRequired = (false))] + public string Description + { + get; + set; + } + + /// + /// True iff some of the properties or entries of the original object did not fit. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("overflow"), IsRequired = (true))] + public bool Overflow + { + get; + set; + } + + /// + /// List of the properties. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("properties"), IsRequired = (true))] + public System.Collections.Generic.IList Properties + { + get; + set; + } + + /// + /// List of the entries. Specified for `map` and `set` subtype values only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("entries"), IsRequired = (false))] + public System.Collections.Generic.IList Entries + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/PrivatePropertyDescriptor.cs b/CefSharp/DevTools/Runtime/PrivatePropertyDescriptor.cs new file mode 100644 index 0000000000..317dfcb169 --- /dev/null +++ b/CefSharp/DevTools/Runtime/PrivatePropertyDescriptor.cs @@ -0,0 +1,54 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Object private field descriptor. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PrivatePropertyDescriptor : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Private property name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// The value associated with the private property. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Value + { + get; + set; + } + + /// + /// A function which serves as a getter for the private property, + /// or `undefined` if there is no getter (accessor descriptors only). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("get"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Get + { + get; + set; + } + + /// + /// A function which serves as a setter for the private property, + /// or `undefined` if there is no setter (accessor descriptors only). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("set"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Set + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/PropertyDescriptor.cs b/CefSharp/DevTools/Runtime/PropertyDescriptor.cs new file mode 100644 index 0000000000..9c6515bd4a --- /dev/null +++ b/CefSharp/DevTools/Runtime/PropertyDescriptor.cs @@ -0,0 +1,116 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Object property descriptor. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PropertyDescriptor : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Property name or symbol description. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// The value associated with the property. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Value + { + get; + set; + } + + /// + /// True if the value associated with the property may be changed (data descriptors only). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("writable"), IsRequired = (false))] + public bool? Writable + { + get; + set; + } + + /// + /// A function which serves as a getter for the property, or `undefined` if there is no getter + /// (accessor descriptors only). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("get"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Get + { + get; + set; + } + + /// + /// A function which serves as a setter for the property, or `undefined` if there is no setter + /// (accessor descriptors only). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("set"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Set + { + get; + set; + } + + /// + /// True if the type of this property descriptor may be changed and if the property may be + /// deleted from the corresponding object. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("configurable"), IsRequired = (true))] + public bool Configurable + { + get; + set; + } + + /// + /// True if this property shows up during enumeration of the properties on the corresponding + /// object. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("enumerable"), IsRequired = (true))] + public bool Enumerable + { + get; + set; + } + + /// + /// True if the result was thrown during the evaluation. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("wasThrown"), IsRequired = (false))] + public bool? WasThrown + { + get; + set; + } + + /// + /// True if the property is owned for the object. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isOwn"), IsRequired = (false))] + public bool? IsOwn + { + get; + set; + } + + /// + /// Property symbol object, if the property is of the `symbol` type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("symbol"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.RemoteObject Symbol + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/PropertyPreview.cs b/CefSharp/DevTools/Runtime/PropertyPreview.cs new file mode 100644 index 0000000000..78c2d55276 --- /dev/null +++ b/CefSharp/DevTools/Runtime/PropertyPreview.cs @@ -0,0 +1,62 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// PropertyPreview + /// + [System.Runtime.Serialization.DataContractAttribute] + public class PropertyPreview : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Property name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("name"), IsRequired = (true))] + public string Name + { + get; + set; + } + + /// + /// Object type. Accessor means that the property itself is an accessor property. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// User-friendly property value string. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public string Value + { + get; + set; + } + + /// + /// Nested value preview. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("valuePreview"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.ObjectPreview ValuePreview + { + get; + set; + } + + /// + /// Object subtype hint. Specified for `object` type values only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("subtype"), IsRequired = (false))] + public string Subtype + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/QueryObjectsResponse.cs b/CefSharp/DevTools/Runtime/QueryObjectsResponse.cs new file mode 100644 index 0000000000..ee824e9bec --- /dev/null +++ b/CefSharp/DevTools/Runtime/QueryObjectsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// QueryObjectsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class QueryObjectsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject objects + { + get; + set; + } + + /// + /// objects + /// + public CefSharp.DevTools.Runtime.RemoteObject Objects + { + get + { + return objects; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/RemoteObject.cs b/CefSharp/DevTools/Runtime/RemoteObject.cs new file mode 100644 index 0000000000..fe250a4ec5 --- /dev/null +++ b/CefSharp/DevTools/Runtime/RemoteObject.cs @@ -0,0 +1,103 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Mirror object referencing original JavaScript object. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RemoteObject : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Object type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// Object subtype hint. Specified for `object` or `wasm` type values only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("subtype"), IsRequired = (false))] + public string Subtype + { + get; + set; + } + + /// + /// Object class (constructor) name. Specified for `object` type values only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("className"), IsRequired = (false))] + public string ClassName + { + get; + set; + } + + /// + /// Remote object value in case of primitive values or JSON values (if it was requested). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("value"), IsRequired = (false))] + public object Value + { + get; + set; + } + + /// + /// Primitive value which can not be JSON-stringified does not have `value`, but gets this + /// property. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("unserializableValue"), IsRequired = (false))] + public string UnserializableValue + { + get; + set; + } + + /// + /// String representation of the object. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("description"), IsRequired = (false))] + public string Description + { + get; + set; + } + + /// + /// Unique object identifier (for non-primitive values). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("objectId"), IsRequired = (false))] + public string ObjectId + { + get; + set; + } + + /// + /// Preview containing abbreviated property values. Specified for `object` type values only. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("preview"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.ObjectPreview Preview + { + get; + set; + } + + /// + /// CustomPreview + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("customPreview"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.CustomPreview CustomPreview + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/RunScriptResponse.cs b/CefSharp/DevTools/Runtime/RunScriptResponse.cs new file mode 100644 index 0000000000..c1888b9ecb --- /dev/null +++ b/CefSharp/DevTools/Runtime/RunScriptResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// RunScriptResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RunScriptResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.RemoteObject result + { + get; + set; + } + + /// + /// result + /// + public CefSharp.DevTools.Runtime.RemoteObject Result + { + get + { + return result; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Runtime.ExceptionDetails exceptionDetails + { + get; + set; + } + + /// + /// exceptionDetails + /// + public CefSharp.DevTools.Runtime.ExceptionDetails ExceptionDetails + { + get + { + return exceptionDetails; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/Runtime.cs b/CefSharp/DevTools/Runtime/Runtime.cs new file mode 100644 index 0000000000..96a6d4393b --- /dev/null +++ b/CefSharp/DevTools/Runtime/Runtime.cs @@ -0,0 +1,537 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + using System.Linq; + + /// + /// Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. + /// Evaluation results are returned as mirror object that expose object type, string representation + /// and unique identifier that can be used for further object reference. Original objects are + /// maintained in memory unless they are either explicitly released or are released along with the + /// other objects in their object group. + /// + public partial class Runtime : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Runtime(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateAwaitPromise(string promiseObjectId, bool? returnByValue = null, bool? generatePreview = null); + /// + /// Add handler to promise with given promise object id. + /// + /// Identifier of the promise. + /// Whether the result is expected to be a JSON object that should be sent by value. + /// Whether preview should be generated for the result. + /// returns System.Threading.Tasks.Task<AwaitPromiseResponse> + public async System.Threading.Tasks.Task AwaitPromiseAsync(string promiseObjectId, bool? returnByValue = null, bool? generatePreview = null) + { + ValidateAwaitPromise(promiseObjectId, returnByValue, generatePreview); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("promiseObjectId", promiseObjectId); + if (returnByValue.HasValue) + { + dict.Add("returnByValue", returnByValue.Value); + } + + if (generatePreview.HasValue) + { + dict.Add("generatePreview", generatePreview.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.awaitPromise", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateCallFunctionOn(string functionDeclaration, string objectId = null, System.Collections.Generic.IList arguments = null, bool? silent = null, bool? returnByValue = null, bool? generatePreview = null, bool? userGesture = null, bool? awaitPromise = null, int? executionContextId = null, string objectGroup = null); + /// + /// Calls function with given declaration on the given object. Object group of the result is + /// inherited from the target object. + /// + /// Declaration of the function to call. + /// Identifier of the object to call function on. Either objectId or executionContextId should + public async System.Threading.Tasks.Task CallFunctionOnAsync(string functionDeclaration, string objectId = null, System.Collections.Generic.IList arguments = null, bool? silent = null, bool? returnByValue = null, bool? generatePreview = null, bool? userGesture = null, bool? awaitPromise = null, int? executionContextId = null, string objectGroup = null) + { + ValidateCallFunctionOn(functionDeclaration, objectId, arguments, silent, returnByValue, generatePreview, userGesture, awaitPromise, executionContextId, objectGroup); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("functionDeclaration", functionDeclaration); + if (!(string.IsNullOrEmpty(objectId))) + { + dict.Add("objectId", objectId); + } + + if ((arguments) != (null)) + { + dict.Add("arguments", arguments.Select(x => x.ToDictionary())); + } + + if (silent.HasValue) + { + dict.Add("silent", silent.Value); + } + + if (returnByValue.HasValue) + { + dict.Add("returnByValue", returnByValue.Value); + } + + if (generatePreview.HasValue) + { + dict.Add("generatePreview", generatePreview.Value); + } + + if (userGesture.HasValue) + { + dict.Add("userGesture", userGesture.Value); + } + + if (awaitPromise.HasValue) + { + dict.Add("awaitPromise", awaitPromise.Value); + } + + if (executionContextId.HasValue) + { + dict.Add("executionContextId", executionContextId.Value); + } + + if (!(string.IsNullOrEmpty(objectGroup))) + { + dict.Add("objectGroup", objectGroup); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.callFunctionOn", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateCompileScript(string expression, string sourceURL, bool persistScript, int? executionContextId = null); + /// + /// Compiles expression. + /// + /// Expression to compile. + /// Source url to be set for the script. + /// Specifies whether the compiled script should be persisted. + /// Specifies in which execution context to perform script run. If the parameter is omitted the + public async System.Threading.Tasks.Task CompileScriptAsync(string expression, string sourceURL, bool persistScript, int? executionContextId = null) + { + ValidateCompileScript(expression, sourceURL, persistScript, executionContextId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("expression", expression); + dict.Add("sourceURL", sourceURL); + dict.Add("persistScript", persistScript); + if (executionContextId.HasValue) + { + dict.Add("executionContextId", executionContextId.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.compileScript", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Disables reporting of execution contexts creation. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.disable", dict); + return methodResult; + } + + /// + /// Discards collected exceptions and console API calls. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DiscardConsoleEntriesAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.discardConsoleEntries", dict); + return methodResult; + } + + /// + /// Enables reporting of execution contexts creation by means of `executionContextCreated` event. + /// When the reporting gets enabled the event will be sent immediately for each existing execution + /// context. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.enable", dict); + return methodResult; + } + + partial void ValidateEvaluate(string expression, string objectGroup = null, bool? includeCommandLineAPI = null, bool? silent = null, int? contextId = null, bool? returnByValue = null, bool? generatePreview = null, bool? userGesture = null, bool? awaitPromise = null, bool? throwOnSideEffect = null, long? timeout = null, bool? disableBreaks = null, bool? replMode = null, bool? allowUnsafeEvalBlockedByCSP = null); + /// + /// Evaluates expression on global object. + /// + /// Expression to evaluate. + /// Symbolic group name that can be used to release multiple objects. + /// Determines whether Command Line API should be available during the evaluation. + /// In silent mode exceptions thrown during evaluation are not reported and do not pause + public async System.Threading.Tasks.Task EvaluateAsync(string expression, string objectGroup = null, bool? includeCommandLineAPI = null, bool? silent = null, int? contextId = null, bool? returnByValue = null, bool? generatePreview = null, bool? userGesture = null, bool? awaitPromise = null, bool? throwOnSideEffect = null, long? timeout = null, bool? disableBreaks = null, bool? replMode = null, bool? allowUnsafeEvalBlockedByCSP = null) + { + ValidateEvaluate(expression, objectGroup, includeCommandLineAPI, silent, contextId, returnByValue, generatePreview, userGesture, awaitPromise, throwOnSideEffect, timeout, disableBreaks, replMode, allowUnsafeEvalBlockedByCSP); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("expression", expression); + if (!(string.IsNullOrEmpty(objectGroup))) + { + dict.Add("objectGroup", objectGroup); + } + + if (includeCommandLineAPI.HasValue) + { + dict.Add("includeCommandLineAPI", includeCommandLineAPI.Value); + } + + if (silent.HasValue) + { + dict.Add("silent", silent.Value); + } + + if (contextId.HasValue) + { + dict.Add("contextId", contextId.Value); + } + + if (returnByValue.HasValue) + { + dict.Add("returnByValue", returnByValue.Value); + } + + if (generatePreview.HasValue) + { + dict.Add("generatePreview", generatePreview.Value); + } + + if (userGesture.HasValue) + { + dict.Add("userGesture", userGesture.Value); + } + + if (awaitPromise.HasValue) + { + dict.Add("awaitPromise", awaitPromise.Value); + } + + if (throwOnSideEffect.HasValue) + { + dict.Add("throwOnSideEffect", throwOnSideEffect.Value); + } + + if (timeout.HasValue) + { + dict.Add("timeout", timeout.Value); + } + + if (disableBreaks.HasValue) + { + dict.Add("disableBreaks", disableBreaks.Value); + } + + if (replMode.HasValue) + { + dict.Add("replMode", replMode.Value); + } + + if (allowUnsafeEvalBlockedByCSP.HasValue) + { + dict.Add("allowUnsafeEvalBlockedByCSP", allowUnsafeEvalBlockedByCSP.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.evaluate", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns the isolate id. + /// + /// returns System.Threading.Tasks.Task<GetIsolateIdResponse> + public async System.Threading.Tasks.Task GetIsolateIdAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.getIsolateId", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns the JavaScript heap usage. + /// It is the total usage of the corresponding isolate not scoped to a particular Runtime. + /// + /// returns System.Threading.Tasks.Task<GetHeapUsageResponse> + public async System.Threading.Tasks.Task GetHeapUsageAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.getHeapUsage", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetProperties(string objectId, bool? ownProperties = null, bool? accessorPropertiesOnly = null, bool? generatePreview = null); + /// + /// Returns properties of a given object. Object group of the result is inherited from the target + /// object. + /// + /// Identifier of the object to return properties for. + /// If true, returns properties belonging only to the element itself, not to its prototype + public async System.Threading.Tasks.Task GetPropertiesAsync(string objectId, bool? ownProperties = null, bool? accessorPropertiesOnly = null, bool? generatePreview = null) + { + ValidateGetProperties(objectId, ownProperties, accessorPropertiesOnly, generatePreview); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectId", objectId); + if (ownProperties.HasValue) + { + dict.Add("ownProperties", ownProperties.Value); + } + + if (accessorPropertiesOnly.HasValue) + { + dict.Add("accessorPropertiesOnly", accessorPropertiesOnly.Value); + } + + if (generatePreview.HasValue) + { + dict.Add("generatePreview", generatePreview.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.getProperties", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGlobalLexicalScopeNames(int? executionContextId = null); + /// + /// Returns all let, const and class variables from global scope. + /// + /// Specifies in which execution context to lookup global scope variables. + /// returns System.Threading.Tasks.Task<GlobalLexicalScopeNamesResponse> + public async System.Threading.Tasks.Task GlobalLexicalScopeNamesAsync(int? executionContextId = null) + { + ValidateGlobalLexicalScopeNames(executionContextId); + var dict = new System.Collections.Generic.Dictionary(); + if (executionContextId.HasValue) + { + dict.Add("executionContextId", executionContextId.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.globalLexicalScopeNames", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateQueryObjects(string prototypeObjectId, string objectGroup = null); + /// + /// QueryObjects + /// + /// Identifier of the prototype to return objects for. + /// Symbolic group name that can be used to release the results. + /// returns System.Threading.Tasks.Task<QueryObjectsResponse> + public async System.Threading.Tasks.Task QueryObjectsAsync(string prototypeObjectId, string objectGroup = null) + { + ValidateQueryObjects(prototypeObjectId, objectGroup); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("prototypeObjectId", prototypeObjectId); + if (!(string.IsNullOrEmpty(objectGroup))) + { + dict.Add("objectGroup", objectGroup); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.queryObjects", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateReleaseObject(string objectId); + /// + /// Releases remote object with given id. + /// + /// Identifier of the object to release. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ReleaseObjectAsync(string objectId) + { + ValidateReleaseObject(objectId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectId", objectId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.releaseObject", dict); + return methodResult; + } + + partial void ValidateReleaseObjectGroup(string objectGroup); + /// + /// Releases all remote objects that belong to a given group. + /// + /// Symbolic object group name. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ReleaseObjectGroupAsync(string objectGroup) + { + ValidateReleaseObjectGroup(objectGroup); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("objectGroup", objectGroup); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.releaseObjectGroup", dict); + return methodResult; + } + + /// + /// Tells inspected instance to run if it was waiting for debugger to attach. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RunIfWaitingForDebuggerAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.runIfWaitingForDebugger", dict); + return methodResult; + } + + partial void ValidateRunScript(string scriptId, int? executionContextId = null, string objectGroup = null, bool? silent = null, bool? includeCommandLineAPI = null, bool? returnByValue = null, bool? generatePreview = null, bool? awaitPromise = null); + /// + /// Runs script with given id in a given context. + /// + /// Id of the script to run. + /// Specifies in which execution context to perform script run. If the parameter is omitted the + public async System.Threading.Tasks.Task RunScriptAsync(string scriptId, int? executionContextId = null, string objectGroup = null, bool? silent = null, bool? includeCommandLineAPI = null, bool? returnByValue = null, bool? generatePreview = null, bool? awaitPromise = null) + { + ValidateRunScript(scriptId, executionContextId, objectGroup, silent, includeCommandLineAPI, returnByValue, generatePreview, awaitPromise); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scriptId", scriptId); + if (executionContextId.HasValue) + { + dict.Add("executionContextId", executionContextId.Value); + } + + if (!(string.IsNullOrEmpty(objectGroup))) + { + dict.Add("objectGroup", objectGroup); + } + + if (silent.HasValue) + { + dict.Add("silent", silent.Value); + } + + if (includeCommandLineAPI.HasValue) + { + dict.Add("includeCommandLineAPI", includeCommandLineAPI.Value); + } + + if (returnByValue.HasValue) + { + dict.Add("returnByValue", returnByValue.Value); + } + + if (generatePreview.HasValue) + { + dict.Add("generatePreview", generatePreview.Value); + } + + if (awaitPromise.HasValue) + { + dict.Add("awaitPromise", awaitPromise.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.runScript", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetAsyncCallStackDepth(int maxDepth); + /// + /// Enables or disables async call stacks tracking. + /// + /// Maximum depth of async call stacks. Setting to `0` will effectively disable collecting async + public async System.Threading.Tasks.Task SetAsyncCallStackDepthAsync(int maxDepth) + { + ValidateSetAsyncCallStackDepth(maxDepth); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("maxDepth", maxDepth); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.setAsyncCallStackDepth", dict); + return methodResult; + } + + partial void ValidateSetCustomObjectFormatterEnabled(bool enabled); + /// + /// SetCustomObjectFormatterEnabled + /// + /// enabled + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetCustomObjectFormatterEnabledAsync(bool enabled) + { + ValidateSetCustomObjectFormatterEnabled(enabled); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("enabled", enabled); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.setCustomObjectFormatterEnabled", dict); + return methodResult; + } + + partial void ValidateSetMaxCallStackSizeToCapture(int size); + /// + /// SetMaxCallStackSizeToCapture + /// + /// size + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetMaxCallStackSizeToCaptureAsync(int size) + { + ValidateSetMaxCallStackSizeToCapture(size); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("size", size); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.setMaxCallStackSizeToCapture", dict); + return methodResult; + } + + /// + /// Terminate current or next JavaScript execution. + /// Will cancel the termination when the outer-most script execution ends. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task TerminateExecutionAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.terminateExecution", dict); + return methodResult; + } + + partial void ValidateAddBinding(string name, int? executionContextId = null); + /// + /// If executionContextId is empty, adds binding with the given name on the + /// global objects of all inspected contexts, including those created later, + /// bindings survive reloads. + /// If executionContextId is specified, adds binding only on global object of + /// given execution context. + /// Binding function takes exactly one argument, this argument should be string, + /// in case of any other input, function throws an exception. + /// Each binding function call produces Runtime.bindingCalled notification. + /// + /// name + /// executionContextId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task AddBindingAsync(string name, int? executionContextId = null) + { + ValidateAddBinding(name, executionContextId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("name", name); + if (executionContextId.HasValue) + { + dict.Add("executionContextId", executionContextId.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.addBinding", dict); + return methodResult; + } + + partial void ValidateRemoveBinding(string name); + /// + /// This method does not remove binding function from global object but + /// unsubscribes current runtime agent from Runtime.bindingCalled notifications. + /// + /// name + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveBindingAsync(string name) + { + ValidateRemoveBinding(name); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("name", name); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Runtime.removeBinding", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/StackTrace.cs b/CefSharp/DevTools/Runtime/StackTrace.cs new file mode 100644 index 0000000000..9a20af693e --- /dev/null +++ b/CefSharp/DevTools/Runtime/StackTrace.cs @@ -0,0 +1,53 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// Call frames for assertions or error messages. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class StackTrace : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// String label of this stack trace. For async traces this may be a name of the function that + /// initiated the async call. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("description"), IsRequired = (false))] + public string Description + { + get; + set; + } + + /// + /// JavaScript function name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("callFrames"), IsRequired = (true))] + public System.Collections.Generic.IList CallFrames + { + get; + set; + } + + /// + /// Asynchronous JavaScript stack trace that preceded this stack, if available. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("parent"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.StackTrace Parent + { + get; + set; + } + + /// + /// Asynchronous JavaScript stack trace that preceded this stack, if available. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("parentId"), IsRequired = (false))] + public CefSharp.DevTools.Runtime.StackTraceId ParentId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Runtime/StackTraceId.cs b/CefSharp/DevTools/Runtime/StackTraceId.cs new file mode 100644 index 0000000000..472fd964c3 --- /dev/null +++ b/CefSharp/DevTools/Runtime/StackTraceId.cs @@ -0,0 +1,33 @@ +// Copyright © 2020 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.DevTools.Runtime +{ + /// + /// If `debuggerId` is set stack trace comes from another debugger and can be resolved there. This + /// allows to track cross-debugger calls. See `Runtime.StackTrace` and `Debugger.paused` for usages. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class StackTraceId : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Id + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("id"), IsRequired = (true))] + public string Id + { + get; + set; + } + + /// + /// DebuggerId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("debuggerId"), IsRequired = (false))] + public string DebuggerId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/CertificateSecurityState.cs b/CefSharp/DevTools/Security/CertificateSecurityState.cs new file mode 100644 index 0000000000..42d42a57df --- /dev/null +++ b/CefSharp/DevTools/Security/CertificateSecurityState.cs @@ -0,0 +1,192 @@ +// Copyright © 2020 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.DevTools.Security +{ + /// + /// Details about the security state of the page certificate. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CertificateSecurityState : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Protocol name (e.g. "TLS 1.2" or "QUIC"). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("protocol"), IsRequired = (true))] + public string Protocol + { + get; + set; + } + + /// + /// Key Exchange used by the connection, or the empty string if not applicable. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyExchange"), IsRequired = (true))] + public string KeyExchange + { + get; + set; + } + + /// + /// (EC)DH group used by the connection, if applicable. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("keyExchangeGroup"), IsRequired = (false))] + public string KeyExchangeGroup + { + get; + set; + } + + /// + /// Cipher name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cipher"), IsRequired = (true))] + public string Cipher + { + get; + set; + } + + /// + /// TLS MAC. Note that AEAD ciphers do not have separate MACs. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mac"), IsRequired = (false))] + public string Mac + { + get; + set; + } + + /// + /// Page certificate. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certificate"), IsRequired = (true))] + public string[] Certificate + { + get; + set; + } + + /// + /// Certificate subject name. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("subjectName"), IsRequired = (true))] + public string SubjectName + { + get; + set; + } + + /// + /// Name of the issuing CA. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("issuer"), IsRequired = (true))] + public string Issuer + { + get; + set; + } + + /// + /// Certificate valid from date. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("validFrom"), IsRequired = (true))] + public long ValidFrom + { + get; + set; + } + + /// + /// Certificate valid to (expiration) date + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("validTo"), IsRequired = (true))] + public long ValidTo + { + get; + set; + } + + /// + /// The highest priority network error code, if the certificate has an error. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certificateNetworkError"), IsRequired = (false))] + public string CertificateNetworkError + { + get; + set; + } + + /// + /// True if the certificate uses a weak signature aglorithm. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certificateHasWeakSignature"), IsRequired = (true))] + public bool CertificateHasWeakSignature + { + get; + set; + } + + /// + /// True if the certificate has a SHA1 signature in the chain. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certificateHasSha1Signature"), IsRequired = (true))] + public bool CertificateHasSha1Signature + { + get; + set; + } + + /// + /// True if modern SSL + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("modernSSL"), IsRequired = (true))] + public bool ModernSSL + { + get; + set; + } + + /// + /// True if the connection is using an obsolete SSL protocol. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("obsoleteSslProtocol"), IsRequired = (true))] + public bool ObsoleteSslProtocol + { + get; + set; + } + + /// + /// True if the connection is using an obsolete SSL key exchange. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("obsoleteSslKeyExchange"), IsRequired = (true))] + public bool ObsoleteSslKeyExchange + { + get; + set; + } + + /// + /// True if the connection is using an obsolete SSL cipher. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("obsoleteSslCipher"), IsRequired = (true))] + public bool ObsoleteSslCipher + { + get; + set; + } + + /// + /// True if the connection is using an obsolete SSL signature. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("obsoleteSslSignature"), IsRequired = (true))] + public bool ObsoleteSslSignature + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/Enums/CertificateErrorAction.cs b/CefSharp/DevTools/Security/Enums/CertificateErrorAction.cs new file mode 100644 index 0000000000..e95f579790 --- /dev/null +++ b/CefSharp/DevTools/Security/Enums/CertificateErrorAction.cs @@ -0,0 +1,23 @@ +// Copyright © 2020 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.DevTools.Security +{ + /// + /// The action to take when a certificate error occurs. continue will continue processing the + /// request and cancel will cancel the request. + /// + public enum CertificateErrorAction + { + /// + /// continue + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("continue"))] + Continue, + /// + /// cancel + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("cancel"))] + Cancel + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/Enums/MixedContentType.cs b/CefSharp/DevTools/Security/Enums/MixedContentType.cs new file mode 100644 index 0000000000..9070d658d6 --- /dev/null +++ b/CefSharp/DevTools/Security/Enums/MixedContentType.cs @@ -0,0 +1,28 @@ +// Copyright © 2020 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.DevTools.Security +{ + /// + /// A description of mixed content (HTTP resources on HTTPS pages), as defined by + /// https://www.w3.org/TR/mixed-content/#categories + /// + public enum MixedContentType + { + /// + /// blockable + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("blockable"))] + Blockable, + /// + /// optionally-blockable + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("optionally-blockable"))] + OptionallyBlockable, + /// + /// none + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("none"))] + None + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/Enums/SafetyTipStatus.cs b/CefSharp/DevTools/Security/Enums/SafetyTipStatus.cs new file mode 100644 index 0000000000..168734575a --- /dev/null +++ b/CefSharp/DevTools/Security/Enums/SafetyTipStatus.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Security +{ + /// + /// SafetyTipStatus + /// + public enum SafetyTipStatus + { + /// + /// badReputation + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("badReputation"))] + BadReputation, + /// + /// lookalike + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("lookalike"))] + Lookalike + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/Enums/SecurityState.cs b/CefSharp/DevTools/Security/Enums/SecurityState.cs new file mode 100644 index 0000000000..fb907dd8af --- /dev/null +++ b/CefSharp/DevTools/Security/Enums/SecurityState.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.Security +{ + /// + /// The security level of a page or resource. + /// + public enum SecurityState + { + /// + /// unknown + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("unknown"))] + Unknown, + /// + /// neutral + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("neutral"))] + Neutral, + /// + /// insecure + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("insecure"))] + Insecure, + /// + /// secure + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("secure"))] + Secure, + /// + /// info + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("info"))] + Info, + /// + /// insecure-broken + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("insecure-broken"))] + InsecureBroken + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/InsecureContentStatus.cs b/CefSharp/DevTools/Security/InsecureContentStatus.cs new file mode 100644 index 0000000000..8274f9fc69 --- /dev/null +++ b/CefSharp/DevTools/Security/InsecureContentStatus.cs @@ -0,0 +1,108 @@ +// Copyright © 2020 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.DevTools.Security +{ + /// + /// Information about insecure content on the page. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class InsecureContentStatus : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Always false. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("ranMixedContent"), IsRequired = (true))] + public bool RanMixedContent + { + get; + set; + } + + /// + /// Always false. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("displayedMixedContent"), IsRequired = (true))] + public bool DisplayedMixedContent + { + get; + set; + } + + /// + /// Always false. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("containedMixedForm"), IsRequired = (true))] + public bool ContainedMixedForm + { + get; + set; + } + + /// + /// Always false. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("ranContentWithCertErrors"), IsRequired = (true))] + public bool RanContentWithCertErrors + { + get; + set; + } + + /// + /// Always false. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("displayedContentWithCertErrors"), IsRequired = (true))] + public bool DisplayedContentWithCertErrors + { + get; + set; + } + + public CefSharp.DevTools.Security.SecurityState RanInsecureContentStyle + { + get + { + return (CefSharp.DevTools.Security.SecurityState)(StringToEnum(typeof(CefSharp.DevTools.Security.SecurityState), ranInsecureContentStyle)); + } + + set + { + ranInsecureContentStyle = (EnumToString(value)); + } + } + + /// + /// Always set to unknown. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("ranInsecureContentStyle"), IsRequired = (true))] + internal string ranInsecureContentStyle + { + get; + set; + } + + public CefSharp.DevTools.Security.SecurityState DisplayedInsecureContentStyle + { + get + { + return (CefSharp.DevTools.Security.SecurityState)(StringToEnum(typeof(CefSharp.DevTools.Security.SecurityState), displayedInsecureContentStyle)); + } + + set + { + displayedInsecureContentStyle = (EnumToString(value)); + } + } + + /// + /// Always set to unknown. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("displayedInsecureContentStyle"), IsRequired = (true))] + internal string displayedInsecureContentStyle + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/SafetyTipInfo.cs b/CefSharp/DevTools/Security/SafetyTipInfo.cs new file mode 100644 index 0000000000..72c4e2809c --- /dev/null +++ b/CefSharp/DevTools/Security/SafetyTipInfo.cs @@ -0,0 +1,45 @@ +// Copyright © 2020 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.DevTools.Security +{ + /// + /// SafetyTipInfo + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SafetyTipInfo : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Security.SafetyTipStatus SafetyTipStatus + { + get + { + return (CefSharp.DevTools.Security.SafetyTipStatus)(StringToEnum(typeof(CefSharp.DevTools.Security.SafetyTipStatus), safetyTipStatus)); + } + + set + { + safetyTipStatus = (EnumToString(value)); + } + } + + /// + /// Describes whether the page triggers any safety tips or reputation warnings. Default is unknown. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("safetyTipStatus"), IsRequired = (true))] + internal string safetyTipStatus + { + get; + set; + } + + /// + /// The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("safeUrl"), IsRequired = (false))] + public string SafeUrl + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/Security.cs b/CefSharp/DevTools/Security/Security.cs new file mode 100644 index 0000000000..a7ff089790 --- /dev/null +++ b/CefSharp/DevTools/Security/Security.cs @@ -0,0 +1,56 @@ +// Copyright © 2020 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.DevTools.Security +{ + using System.Linq; + + /// + /// Security + /// + public partial class Security : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Security(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Disables tracking security state changes. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Security.disable", dict); + return methodResult; + } + + /// + /// Enables tracking security state changes. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Security.enable", dict); + return methodResult; + } + + partial void ValidateSetIgnoreCertificateErrors(bool ignore); + /// + /// Enable/disable whether all certificate errors should be ignored. + /// + /// If true, all certificate errors will be ignored. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetIgnoreCertificateErrorsAsync(bool ignore) + { + ValidateSetIgnoreCertificateErrors(ignore); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("ignore", ignore); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Security.setIgnoreCertificateErrors", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/SecurityStateExplanation.cs b/CefSharp/DevTools/Security/SecurityStateExplanation.cs new file mode 100644 index 0000000000..d3110ebb5a --- /dev/null +++ b/CefSharp/DevTools/Security/SecurityStateExplanation.cs @@ -0,0 +1,108 @@ +// Copyright © 2020 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.DevTools.Security +{ + /// + /// An explanation of an factor contributing to the security state. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class SecurityStateExplanation : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Security.SecurityState SecurityState + { + get + { + return (CefSharp.DevTools.Security.SecurityState)(StringToEnum(typeof(CefSharp.DevTools.Security.SecurityState), securityState)); + } + + set + { + securityState = (EnumToString(value)); + } + } + + /// + /// Security state representing the severity of the factor being explained. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("securityState"), IsRequired = (true))] + internal string securityState + { + get; + set; + } + + /// + /// Title describing the type of factor. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("title"), IsRequired = (true))] + public string Title + { + get; + set; + } + + /// + /// Short phrase describing the type of factor. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("summary"), IsRequired = (true))] + public string Summary + { + get; + set; + } + + /// + /// Full text explanation of the factor. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("description"), IsRequired = (true))] + public string Description + { + get; + set; + } + + public CefSharp.DevTools.Security.MixedContentType MixedContentType + { + get + { + return (CefSharp.DevTools.Security.MixedContentType)(StringToEnum(typeof(CefSharp.DevTools.Security.MixedContentType), mixedContentType)); + } + + set + { + mixedContentType = (EnumToString(value)); + } + } + + /// + /// The type of mixed content described by the explanation. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("mixedContentType"), IsRequired = (true))] + internal string mixedContentType + { + get; + set; + } + + /// + /// Page certificate. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certificate"), IsRequired = (true))] + public string[] Certificate + { + get; + set; + } + + /// + /// Recommendations to fix any issues. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("recommendations"), IsRequired = (false))] + public string[] Recommendations + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Security/VisibleSecurityState.cs b/CefSharp/DevTools/Security/VisibleSecurityState.cs new file mode 100644 index 0000000000..77e69cbbd2 --- /dev/null +++ b/CefSharp/DevTools/Security/VisibleSecurityState.cs @@ -0,0 +1,65 @@ +// Copyright © 2020 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.DevTools.Security +{ + /// + /// Security state information about the page. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class VisibleSecurityState : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Security.SecurityState SecurityState + { + get + { + return (CefSharp.DevTools.Security.SecurityState)(StringToEnum(typeof(CefSharp.DevTools.Security.SecurityState), securityState)); + } + + set + { + securityState = (EnumToString(value)); + } + } + + /// + /// The security level of the page. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("securityState"), IsRequired = (true))] + internal string securityState + { + get; + set; + } + + /// + /// Security state details about the page certificate. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("certificateSecurityState"), IsRequired = (false))] + public CefSharp.DevTools.Security.CertificateSecurityState CertificateSecurityState + { + get; + set; + } + + /// + /// The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("safetyTipInfo"), IsRequired = (false))] + public CefSharp.DevTools.Security.SafetyTipInfo SafetyTipInfo + { + get; + set; + } + + /// + /// Array of security state issues ids. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("securityStateIssueIds"), IsRequired = (true))] + public string[] SecurityStateIssueIds + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ServiceWorker/Enums/ServiceWorkerVersionRunningStatus.cs b/CefSharp/DevTools/ServiceWorker/Enums/ServiceWorkerVersionRunningStatus.cs new file mode 100644 index 0000000000..aa8c3e2c8c --- /dev/null +++ b/CefSharp/DevTools/ServiceWorker/Enums/ServiceWorkerVersionRunningStatus.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.ServiceWorker +{ + /// + /// ServiceWorkerVersionRunningStatus + /// + public enum ServiceWorkerVersionRunningStatus + { + /// + /// stopped + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("stopped"))] + Stopped, + /// + /// starting + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("starting"))] + Starting, + /// + /// running + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("running"))] + Running, + /// + /// stopping + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("stopping"))] + Stopping + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ServiceWorker/Enums/ServiceWorkerVersionStatus.cs b/CefSharp/DevTools/ServiceWorker/Enums/ServiceWorkerVersionStatus.cs new file mode 100644 index 0000000000..b6b7583ffe --- /dev/null +++ b/CefSharp/DevTools/ServiceWorker/Enums/ServiceWorkerVersionStatus.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.ServiceWorker +{ + /// + /// ServiceWorkerVersionStatus + /// + public enum ServiceWorkerVersionStatus + { + /// + /// new + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("new"))] + New, + /// + /// installing + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("installing"))] + Installing, + /// + /// installed + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("installed"))] + Installed, + /// + /// activating + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("activating"))] + Activating, + /// + /// activated + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("activated"))] + Activated, + /// + /// redundant + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("redundant"))] + Redundant + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ServiceWorker/ServiceWorker.cs b/CefSharp/DevTools/ServiceWorker/ServiceWorker.cs new file mode 100644 index 0000000000..17a2baf1ea --- /dev/null +++ b/CefSharp/DevTools/ServiceWorker/ServiceWorker.cs @@ -0,0 +1,216 @@ +// Copyright © 2020 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.DevTools.ServiceWorker +{ + using System.Linq; + + /// + /// ServiceWorker + /// + public partial class ServiceWorker : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public ServiceWorker(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateDeliverPushMessage(string origin, string registrationId, string data); + /// + /// DeliverPushMessage + /// + /// origin + /// registrationId + /// data + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DeliverPushMessageAsync(string origin, string registrationId, string data) + { + ValidateDeliverPushMessage(origin, registrationId, data); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + dict.Add("registrationId", registrationId); + dict.Add("data", data); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.deliverPushMessage", dict); + return methodResult; + } + + /// + /// Disable + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.disable", dict); + return methodResult; + } + + partial void ValidateDispatchSyncEvent(string origin, string registrationId, string tag, bool lastChance); + /// + /// DispatchSyncEvent + /// + /// origin + /// registrationId + /// tag + /// lastChance + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DispatchSyncEventAsync(string origin, string registrationId, string tag, bool lastChance) + { + ValidateDispatchSyncEvent(origin, registrationId, tag, lastChance); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + dict.Add("registrationId", registrationId); + dict.Add("tag", tag); + dict.Add("lastChance", lastChance); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.dispatchSyncEvent", dict); + return methodResult; + } + + partial void ValidateDispatchPeriodicSyncEvent(string origin, string registrationId, string tag); + /// + /// DispatchPeriodicSyncEvent + /// + /// origin + /// registrationId + /// tag + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DispatchPeriodicSyncEventAsync(string origin, string registrationId, string tag) + { + ValidateDispatchPeriodicSyncEvent(origin, registrationId, tag); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + dict.Add("registrationId", registrationId); + dict.Add("tag", tag); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.dispatchPeriodicSyncEvent", dict); + return methodResult; + } + + /// + /// Enable + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.enable", dict); + return methodResult; + } + + partial void ValidateInspectWorker(string versionId); + /// + /// InspectWorker + /// + /// versionId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task InspectWorkerAsync(string versionId) + { + ValidateInspectWorker(versionId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("versionId", versionId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.inspectWorker", dict); + return methodResult; + } + + partial void ValidateSetForceUpdateOnPageLoad(bool forceUpdateOnPageLoad); + /// + /// SetForceUpdateOnPageLoad + /// + /// forceUpdateOnPageLoad + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetForceUpdateOnPageLoadAsync(bool forceUpdateOnPageLoad) + { + ValidateSetForceUpdateOnPageLoad(forceUpdateOnPageLoad); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("forceUpdateOnPageLoad", forceUpdateOnPageLoad); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.setForceUpdateOnPageLoad", dict); + return methodResult; + } + + partial void ValidateSkipWaiting(string scopeURL); + /// + /// SkipWaiting + /// + /// scopeURL + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SkipWaitingAsync(string scopeURL) + { + ValidateSkipWaiting(scopeURL); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scopeURL", scopeURL); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.skipWaiting", dict); + return methodResult; + } + + partial void ValidateStartWorker(string scopeURL); + /// + /// StartWorker + /// + /// scopeURL + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StartWorkerAsync(string scopeURL) + { + ValidateStartWorker(scopeURL); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scopeURL", scopeURL); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.startWorker", dict); + return methodResult; + } + + /// + /// StopAllWorkers + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopAllWorkersAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.stopAllWorkers", dict); + return methodResult; + } + + partial void ValidateStopWorker(string versionId); + /// + /// StopWorker + /// + /// versionId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task StopWorkerAsync(string versionId) + { + ValidateStopWorker(versionId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("versionId", versionId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.stopWorker", dict); + return methodResult; + } + + partial void ValidateUnregister(string scopeURL); + /// + /// Unregister + /// + /// scopeURL + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task UnregisterAsync(string scopeURL) + { + ValidateUnregister(scopeURL); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scopeURL", scopeURL); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.unregister", dict); + return methodResult; + } + + partial void ValidateUpdateRegistration(string scopeURL); + /// + /// UpdateRegistration + /// + /// scopeURL + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task UpdateRegistrationAsync(string scopeURL) + { + ValidateUpdateRegistration(scopeURL); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("scopeURL", scopeURL); + var methodResult = await _client.ExecuteDevToolsMethodAsync("ServiceWorker.updateRegistration", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ServiceWorker/ServiceWorkerErrorMessage.cs b/CefSharp/DevTools/ServiceWorker/ServiceWorkerErrorMessage.cs new file mode 100644 index 0000000000..634b132156 --- /dev/null +++ b/CefSharp/DevTools/ServiceWorker/ServiceWorkerErrorMessage.cs @@ -0,0 +1,72 @@ +// Copyright © 2020 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.DevTools.ServiceWorker +{ + /// + /// ServiceWorker error message. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ServiceWorkerErrorMessage : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// ErrorMessage + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("errorMessage"), IsRequired = (true))] + public string ErrorMessage + { + get; + set; + } + + /// + /// RegistrationId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("registrationId"), IsRequired = (true))] + public string RegistrationId + { + get; + set; + } + + /// + /// VersionId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("versionId"), IsRequired = (true))] + public string VersionId + { + get; + set; + } + + /// + /// SourceURL + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sourceURL"), IsRequired = (true))] + public string SourceURL + { + get; + set; + } + + /// + /// LineNumber + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("lineNumber"), IsRequired = (true))] + public int LineNumber + { + get; + set; + } + + /// + /// ColumnNumber + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("columnNumber"), IsRequired = (true))] + public int ColumnNumber + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ServiceWorker/ServiceWorkerRegistration.cs b/CefSharp/DevTools/ServiceWorker/ServiceWorkerRegistration.cs new file mode 100644 index 0000000000..adc62917f8 --- /dev/null +++ b/CefSharp/DevTools/ServiceWorker/ServiceWorkerRegistration.cs @@ -0,0 +1,42 @@ +// Copyright © 2020 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.DevTools.ServiceWorker +{ + /// + /// ServiceWorker registration. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ServiceWorkerRegistration : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// RegistrationId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("registrationId"), IsRequired = (true))] + public string RegistrationId + { + get; + set; + } + + /// + /// ScopeURL + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scopeURL"), IsRequired = (true))] + public string ScopeURL + { + get; + set; + } + + /// + /// IsDeleted + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isDeleted"), IsRequired = (true))] + public bool IsDeleted + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/ServiceWorker/ServiceWorkerVersion.cs b/CefSharp/DevTools/ServiceWorker/ServiceWorkerVersion.cs new file mode 100644 index 0000000000..e1870357b3 --- /dev/null +++ b/CefSharp/DevTools/ServiceWorker/ServiceWorkerVersion.cs @@ -0,0 +1,129 @@ +// Copyright © 2020 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.DevTools.ServiceWorker +{ + /// + /// ServiceWorker version. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ServiceWorkerVersion : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// VersionId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("versionId"), IsRequired = (true))] + public string VersionId + { + get; + set; + } + + /// + /// RegistrationId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("registrationId"), IsRequired = (true))] + public string RegistrationId + { + get; + set; + } + + /// + /// ScriptURL + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptURL"), IsRequired = (true))] + public string ScriptURL + { + get; + set; + } + + public CefSharp.DevTools.ServiceWorker.ServiceWorkerVersionRunningStatus RunningStatus + { + get + { + return (CefSharp.DevTools.ServiceWorker.ServiceWorkerVersionRunningStatus)(StringToEnum(typeof(CefSharp.DevTools.ServiceWorker.ServiceWorkerVersionRunningStatus), runningStatus)); + } + + set + { + runningStatus = (EnumToString(value)); + } + } + + /// + /// RunningStatus + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("runningStatus"), IsRequired = (true))] + internal string runningStatus + { + get; + set; + } + + public CefSharp.DevTools.ServiceWorker.ServiceWorkerVersionStatus Status + { + get + { + return (CefSharp.DevTools.ServiceWorker.ServiceWorkerVersionStatus)(StringToEnum(typeof(CefSharp.DevTools.ServiceWorker.ServiceWorkerVersionStatus), status)); + } + + set + { + status = (EnumToString(value)); + } + } + + /// + /// Status + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("status"), IsRequired = (true))] + internal string status + { + get; + set; + } + + /// + /// The Last-Modified header value of the main script. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptLastModified"), IsRequired = (false))] + public long? ScriptLastModified + { + get; + set; + } + + /// + /// The time at which the response headers of the main script were received from the server. + /// For cached script it is the last time the cache entry was validated. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("scriptResponseTime"), IsRequired = (false))] + public long? ScriptResponseTime + { + get; + set; + } + + /// + /// ControlledClients + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("controlledClients"), IsRequired = (false))] + public string[] ControlledClients + { + get; + set; + } + + /// + /// TargetId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("targetId"), IsRequired = (false))] + public string TargetId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Storage/Enums/StorageType.cs b/CefSharp/DevTools/Storage/Enums/StorageType.cs new file mode 100644 index 0000000000..7828a349ef --- /dev/null +++ b/CefSharp/DevTools/Storage/Enums/StorageType.cs @@ -0,0 +1,67 @@ +// Copyright © 2020 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.DevTools.Storage +{ + /// + /// Enum of possible storage types. + /// + public enum StorageType + { + /// + /// appcache + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("appcache"))] + Appcache, + /// + /// cookies + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("cookies"))] + Cookies, + /// + /// file_systems + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("file_systems"))] + FileSystems, + /// + /// indexeddb + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("indexeddb"))] + Indexeddb, + /// + /// local_storage + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("local_storage"))] + LocalStorage, + /// + /// shader_cache + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("shader_cache"))] + ShaderCache, + /// + /// websql + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("websql"))] + Websql, + /// + /// service_workers + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("service_workers"))] + ServiceWorkers, + /// + /// cache_storage + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("cache_storage"))] + CacheStorage, + /// + /// all + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("all"))] + All, + /// + /// other + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("other"))] + Other + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Storage/GetCookiesResponse.cs b/CefSharp/DevTools/Storage/GetCookiesResponse.cs new file mode 100644 index 0000000000..690b8fa87e --- /dev/null +++ b/CefSharp/DevTools/Storage/GetCookiesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Storage +{ + /// + /// GetCookiesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetCookiesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList cookies + { + get; + set; + } + + /// + /// cookies + /// + public System.Collections.Generic.IList Cookies + { + get + { + return cookies; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Storage/GetUsageAndQuotaResponse.cs b/CefSharp/DevTools/Storage/GetUsageAndQuotaResponse.cs new file mode 100644 index 0000000000..f8a1b8686a --- /dev/null +++ b/CefSharp/DevTools/Storage/GetUsageAndQuotaResponse.cs @@ -0,0 +1,66 @@ +// Copyright © 2020 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.DevTools.Storage +{ + /// + /// GetUsageAndQuotaResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetUsageAndQuotaResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal long usage + { + get; + set; + } + + /// + /// usage + /// + public long Usage + { + get + { + return usage; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal long quota + { + get; + set; + } + + /// + /// quota + /// + public long Quota + { + get + { + return quota; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList usageBreakdown + { + get; + set; + } + + /// + /// usageBreakdown + /// + public System.Collections.Generic.IList UsageBreakdown + { + get + { + return usageBreakdown; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Storage/Storage.cs b/CefSharp/DevTools/Storage/Storage.cs new file mode 100644 index 0000000000..cb7cae8721 --- /dev/null +++ b/CefSharp/DevTools/Storage/Storage.cs @@ -0,0 +1,170 @@ +// Copyright © 2020 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.DevTools.Storage +{ + using System.Linq; + + /// + /// Storage + /// + public partial class Storage : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Storage(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateClearDataForOrigin(string origin, string storageTypes); + /// + /// Clears storage for origin. + /// + /// Security origin. + /// Comma separated list of StorageType to clear. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearDataForOriginAsync(string origin, string storageTypes) + { + ValidateClearDataForOrigin(origin, storageTypes); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + dict.Add("storageTypes", storageTypes); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.clearDataForOrigin", dict); + return methodResult; + } + + partial void ValidateGetCookies(string browserContextId = null); + /// + /// Returns all browser cookies. + /// + /// Browser context to use when called on the browser endpoint. + /// returns System.Threading.Tasks.Task<GetCookiesResponse> + public async System.Threading.Tasks.Task GetCookiesAsync(string browserContextId = null) + { + ValidateGetCookies(browserContextId); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(browserContextId))) + { + dict.Add("browserContextId", browserContextId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.getCookies", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetCookies(System.Collections.Generic.IList cookies, string browserContextId = null); + /// + /// Sets given cookies. + /// + /// Cookies to be set. + /// Browser context to use when called on the browser endpoint. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetCookiesAsync(System.Collections.Generic.IList cookies, string browserContextId = null) + { + ValidateSetCookies(cookies, browserContextId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("cookies", cookies.Select(x => x.ToDictionary())); + if (!(string.IsNullOrEmpty(browserContextId))) + { + dict.Add("browserContextId", browserContextId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.setCookies", dict); + return methodResult; + } + + partial void ValidateClearCookies(string browserContextId = null); + /// + /// Clears cookies. + /// + /// Browser context to use when called on the browser endpoint. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearCookiesAsync(string browserContextId = null) + { + ValidateClearCookies(browserContextId); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(browserContextId))) + { + dict.Add("browserContextId", browserContextId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.clearCookies", dict); + return methodResult; + } + + partial void ValidateGetUsageAndQuota(string origin); + /// + /// Returns usage and quota in bytes. + /// + /// Security origin. + /// returns System.Threading.Tasks.Task<GetUsageAndQuotaResponse> + public async System.Threading.Tasks.Task GetUsageAndQuotaAsync(string origin) + { + ValidateGetUsageAndQuota(origin); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.getUsageAndQuota", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateTrackCacheStorageForOrigin(string origin); + /// + /// Registers origin to be notified when an update occurs to its cache storage list. + /// + /// Security origin. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task TrackCacheStorageForOriginAsync(string origin) + { + ValidateTrackCacheStorageForOrigin(origin); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.trackCacheStorageForOrigin", dict); + return methodResult; + } + + partial void ValidateTrackIndexedDBForOrigin(string origin); + /// + /// Registers origin to be notified when an update occurs to its IndexedDB. + /// + /// Security origin. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task TrackIndexedDBForOriginAsync(string origin) + { + ValidateTrackIndexedDBForOrigin(origin); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.trackIndexedDBForOrigin", dict); + return methodResult; + } + + partial void ValidateUntrackCacheStorageForOrigin(string origin); + /// + /// Unregisters origin from receiving notifications for cache storage. + /// + /// Security origin. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task UntrackCacheStorageForOriginAsync(string origin) + { + ValidateUntrackCacheStorageForOrigin(origin); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.untrackCacheStorageForOrigin", dict); + return methodResult; + } + + partial void ValidateUntrackIndexedDBForOrigin(string origin); + /// + /// Unregisters origin from receiving notifications for IndexedDB. + /// + /// Security origin. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task UntrackIndexedDBForOriginAsync(string origin) + { + ValidateUntrackIndexedDBForOrigin(origin); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("origin", origin); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.untrackIndexedDBForOrigin", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Storage/UsageForType.cs b/CefSharp/DevTools/Storage/UsageForType.cs new file mode 100644 index 0000000000..69e7e6d2e4 --- /dev/null +++ b/CefSharp/DevTools/Storage/UsageForType.cs @@ -0,0 +1,45 @@ +// Copyright © 2020 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.DevTools.Storage +{ + /// + /// Usage for a storage type. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class UsageForType : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.Storage.StorageType StorageType + { + get + { + return (CefSharp.DevTools.Storage.StorageType)(StringToEnum(typeof(CefSharp.DevTools.Storage.StorageType), storageType)); + } + + set + { + storageType = (EnumToString(value)); + } + } + + /// + /// Name of storage type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("storageType"), IsRequired = (true))] + internal string storageType + { + get; + set; + } + + /// + /// Storage usage (bytes). + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("usage"), IsRequired = (true))] + public long Usage + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/Enums/ImageType.cs b/CefSharp/DevTools/SystemInfo/Enums/ImageType.cs new file mode 100644 index 0000000000..70b2dcc4e8 --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/Enums/ImageType.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// Image format of a given image. + /// + public enum ImageType + { + /// + /// jpeg + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("jpeg"))] + Jpeg, + /// + /// webp + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("webp"))] + Webp, + /// + /// unknown + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("unknown"))] + Unknown + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/Enums/SubsamplingFormat.cs b/CefSharp/DevTools/SystemInfo/Enums/SubsamplingFormat.cs new file mode 100644 index 0000000000..2aef74fb52 --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/Enums/SubsamplingFormat.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// YUV subsampling type of the pixels of a given image. + /// + public enum SubsamplingFormat + { + /// + /// yuv420 + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("yuv420"))] + Yuv420, + /// + /// yuv422 + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("yuv422"))] + Yuv422, + /// + /// yuv444 + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("yuv444"))] + Yuv444 + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/GPUDevice.cs b/CefSharp/DevTools/SystemInfo/GPUDevice.cs new file mode 100644 index 0000000000..38368b7c6d --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/GPUDevice.cs @@ -0,0 +1,92 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// Describes a single graphics processor (GPU). + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GPUDevice : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// PCI ID of the GPU vendor, if available; 0 otherwise. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("vendorId"), IsRequired = (true))] + public long VendorId + { + get; + set; + } + + /// + /// PCI ID of the GPU device, if available; 0 otherwise. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("deviceId"), IsRequired = (true))] + public long DeviceId + { + get; + set; + } + + /// + /// Sub sys ID of the GPU, only available on Windows. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("subSysId"), IsRequired = (false))] + public long? SubSysId + { + get; + set; + } + + /// + /// Revision of the GPU, only available on Windows. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("revision"), IsRequired = (false))] + public long? Revision + { + get; + set; + } + + /// + /// String description of the GPU vendor, if the PCI ID is not available. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("vendorString"), IsRequired = (true))] + public string VendorString + { + get; + set; + } + + /// + /// String description of the GPU device, if the PCI ID is not available. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("deviceString"), IsRequired = (true))] + public string DeviceString + { + get; + set; + } + + /// + /// String description of the GPU driver vendor. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("driverVendor"), IsRequired = (true))] + public string DriverVendor + { + get; + set; + } + + /// + /// String description of the GPU driver version. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("driverVersion"), IsRequired = (true))] + public string DriverVersion + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/GPUInfo.cs b/CefSharp/DevTools/SystemInfo/GPUInfo.cs new file mode 100644 index 0000000000..cc203f1601 --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/GPUInfo.cs @@ -0,0 +1,82 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// Provides information about the GPU(s) on the system. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GPUInfo : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The graphics devices on the system. Element 0 is the primary GPU. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("devices"), IsRequired = (true))] + public System.Collections.Generic.IList Devices + { + get; + set; + } + + /// + /// An optional dictionary of additional GPU related attributes. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("auxAttributes"), IsRequired = (false))] + public object AuxAttributes + { + get; + set; + } + + /// + /// An optional dictionary of graphics features and their status. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("featureStatus"), IsRequired = (false))] + public object FeatureStatus + { + get; + set; + } + + /// + /// An optional array of GPU driver bug workarounds. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("driverBugWorkarounds"), IsRequired = (true))] + public string[] DriverBugWorkarounds + { + get; + set; + } + + /// + /// Supported accelerated video decoding capabilities. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("videoDecoding"), IsRequired = (true))] + public System.Collections.Generic.IList VideoDecoding + { + get; + set; + } + + /// + /// Supported accelerated video encoding capabilities. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("videoEncoding"), IsRequired = (true))] + public System.Collections.Generic.IList VideoEncoding + { + get; + set; + } + + /// + /// Supported accelerated image decoding capabilities. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("imageDecoding"), IsRequired = (true))] + public System.Collections.Generic.IList ImageDecoding + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/GetInfoResponse.cs b/CefSharp/DevTools/SystemInfo/GetInfoResponse.cs new file mode 100644 index 0000000000..77d46c1535 --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/GetInfoResponse.cs @@ -0,0 +1,84 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// GetInfoResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetInfoResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.SystemInfo.GPUInfo gpu + { + get; + set; + } + + /// + /// gpu + /// + public CefSharp.DevTools.SystemInfo.GPUInfo Gpu + { + get + { + return gpu; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string modelName + { + get; + set; + } + + /// + /// modelName + /// + public string ModelName + { + get + { + return modelName; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string modelVersion + { + get; + set; + } + + /// + /// modelVersion + /// + public string ModelVersion + { + get + { + return modelVersion; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal string commandLine + { + get; + set; + } + + /// + /// commandLine + /// + public string CommandLine + { + get + { + return commandLine; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/GetProcessInfoResponse.cs b/CefSharp/DevTools/SystemInfo/GetProcessInfoResponse.cs new file mode 100644 index 0000000000..cc0a3939a9 --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/GetProcessInfoResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// GetProcessInfoResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetProcessInfoResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList processInfo + { + get; + set; + } + + /// + /// processInfo + /// + public System.Collections.Generic.IList ProcessInfo + { + get + { + return processInfo; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/ImageDecodeAcceleratorCapability.cs b/CefSharp/DevTools/SystemInfo/ImageDecodeAcceleratorCapability.cs new file mode 100644 index 0000000000..af13ab2b1d --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/ImageDecodeAcceleratorCapability.cs @@ -0,0 +1,79 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// Describes a supported image decoding profile with its associated minimum and + /// maximum resolutions and subsampling. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ImageDecodeAcceleratorCapability : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.SystemInfo.ImageType ImageType + { + get + { + return (CefSharp.DevTools.SystemInfo.ImageType)(StringToEnum(typeof(CefSharp.DevTools.SystemInfo.ImageType), imageType)); + } + + set + { + imageType = (EnumToString(value)); + } + } + + /// + /// Image coded, e.g. Jpeg. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("imageType"), IsRequired = (true))] + internal string imageType + { + get; + set; + } + + /// + /// Maximum supported dimensions of the image in pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("maxDimensions"), IsRequired = (true))] + public CefSharp.DevTools.SystemInfo.Size MaxDimensions + { + get; + set; + } + + /// + /// Minimum supported dimensions of the image in pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("minDimensions"), IsRequired = (true))] + public CefSharp.DevTools.SystemInfo.Size MinDimensions + { + get; + set; + } + + public CefSharp.DevTools.SystemInfo.SubsamplingFormat[] Subsamplings + { + get + { + return (CefSharp.DevTools.SystemInfo.SubsamplingFormat[])(StringToEnum(typeof(CefSharp.DevTools.SystemInfo.SubsamplingFormat[]), subsamplings)); + } + + set + { + subsamplings = (EnumToString(value)); + } + } + + /// + /// Optional array of supported subsampling formats, e.g. 4:2:0, if known. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("subsamplings"), IsRequired = (true))] + internal string subsamplings + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/ProcessInfo.cs b/CefSharp/DevTools/SystemInfo/ProcessInfo.cs new file mode 100644 index 0000000000..cdc67cb7d6 --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/ProcessInfo.cs @@ -0,0 +1,43 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// Represents process info. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ProcessInfo : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Specifies process type. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// Specifies process id. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("id"), IsRequired = (true))] + public int Id + { + get; + set; + } + + /// + /// Specifies cumulative CPU usage in seconds across all threads of the + /// process since the process start. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("cpuTime"), IsRequired = (true))] + public long CpuTime + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/Size.cs b/CefSharp/DevTools/SystemInfo/Size.cs new file mode 100644 index 0000000000..2c37ff8c24 --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/Size.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// Describes the width and height dimensions of an entity. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Size : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Width in pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("width"), IsRequired = (true))] + public int Width + { + get; + set; + } + + /// + /// Height in pixels. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("height"), IsRequired = (true))] + public int Height + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/SystemInfo.cs b/CefSharp/DevTools/SystemInfo/SystemInfo.cs new file mode 100644 index 0000000000..8a6d044b4e --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/SystemInfo.cs @@ -0,0 +1,41 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + using System.Linq; + + /// + /// The SystemInfo domain defines methods and events for querying low-level system information. + /// + public partial class SystemInfo : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public SystemInfo(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Returns information about the system. + /// + /// returns System.Threading.Tasks.Task<GetInfoResponse> + public async System.Threading.Tasks.Task GetInfoAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("SystemInfo.getInfo", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns information about all running processes. + /// + /// returns System.Threading.Tasks.Task<GetProcessInfoResponse> + public async System.Threading.Tasks.Task GetProcessInfoAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("SystemInfo.getProcessInfo", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/VideoDecodeAcceleratorCapability.cs b/CefSharp/DevTools/SystemInfo/VideoDecodeAcceleratorCapability.cs new file mode 100644 index 0000000000..a7b521b7bd --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/VideoDecodeAcceleratorCapability.cs @@ -0,0 +1,43 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// Describes a supported video decoding profile with its associated minimum and + /// maximum resolutions. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class VideoDecodeAcceleratorCapability : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Video codec profile that is supported, e.g. VP9 Profile 2. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("profile"), IsRequired = (true))] + public string Profile + { + get; + set; + } + + /// + /// Maximum video dimensions in pixels supported for this |profile|. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("maxResolution"), IsRequired = (true))] + public CefSharp.DevTools.SystemInfo.Size MaxResolution + { + get; + set; + } + + /// + /// Minimum video dimensions in pixels supported for this |profile|. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("minResolution"), IsRequired = (true))] + public CefSharp.DevTools.SystemInfo.Size MinResolution + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/SystemInfo/VideoEncodeAcceleratorCapability.cs b/CefSharp/DevTools/SystemInfo/VideoEncodeAcceleratorCapability.cs new file mode 100644 index 0000000000..1cf195a01f --- /dev/null +++ b/CefSharp/DevTools/SystemInfo/VideoEncodeAcceleratorCapability.cs @@ -0,0 +1,55 @@ +// Copyright © 2020 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.DevTools.SystemInfo +{ + /// + /// Describes a supported video encoding profile with its associated maximum + /// resolution and maximum framerate. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class VideoEncodeAcceleratorCapability : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Video codec profile that is supported, e.g H264 Main. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("profile"), IsRequired = (true))] + public string Profile + { + get; + set; + } + + /// + /// Maximum video dimensions in pixels supported for this |profile|. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("maxResolution"), IsRequired = (true))] + public CefSharp.DevTools.SystemInfo.Size MaxResolution + { + get; + set; + } + + /// + /// Maximum encoding framerate in frames per second supported for this + /// |profile|, as fraction's numerator and denominator, e.g. 24/1 fps, + /// 24000/1001 fps, etc. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("maxFramerateNumerator"), IsRequired = (true))] + public int MaxFramerateNumerator + { + get; + set; + } + + /// + /// MaxFramerateDenominator + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("maxFramerateDenominator"), IsRequired = (true))] + public int MaxFramerateDenominator + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/AttachToBrowserTargetResponse.cs b/CefSharp/DevTools/Target/AttachToBrowserTargetResponse.cs new file mode 100644 index 0000000000..e155c0365a --- /dev/null +++ b/CefSharp/DevTools/Target/AttachToBrowserTargetResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// AttachToBrowserTargetResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AttachToBrowserTargetResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string sessionId + { + get; + set; + } + + /// + /// sessionId + /// + public string SessionId + { + get + { + return sessionId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/AttachToTargetResponse.cs b/CefSharp/DevTools/Target/AttachToTargetResponse.cs new file mode 100644 index 0000000000..39834bd8ac --- /dev/null +++ b/CefSharp/DevTools/Target/AttachToTargetResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// AttachToTargetResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AttachToTargetResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string sessionId + { + get; + set; + } + + /// + /// sessionId + /// + public string SessionId + { + get + { + return sessionId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/CloseTargetResponse.cs b/CefSharp/DevTools/Target/CloseTargetResponse.cs new file mode 100644 index 0000000000..4a77a5e949 --- /dev/null +++ b/CefSharp/DevTools/Target/CloseTargetResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// CloseTargetResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CloseTargetResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal bool success + { + get; + set; + } + + /// + /// success + /// + public bool Success + { + get + { + return success; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/CreateBrowserContextResponse.cs b/CefSharp/DevTools/Target/CreateBrowserContextResponse.cs new file mode 100644 index 0000000000..1f0ef78a28 --- /dev/null +++ b/CefSharp/DevTools/Target/CreateBrowserContextResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// CreateBrowserContextResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CreateBrowserContextResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string browserContextId + { + get; + set; + } + + /// + /// browserContextId + /// + public string BrowserContextId + { + get + { + return browserContextId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/CreateTargetResponse.cs b/CefSharp/DevTools/Target/CreateTargetResponse.cs new file mode 100644 index 0000000000..711cc3f7c3 --- /dev/null +++ b/CefSharp/DevTools/Target/CreateTargetResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// CreateTargetResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class CreateTargetResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string targetId + { + get; + set; + } + + /// + /// targetId + /// + public string TargetId + { + get + { + return targetId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/GetBrowserContextsResponse.cs b/CefSharp/DevTools/Target/GetBrowserContextsResponse.cs new file mode 100644 index 0000000000..c8d48d4680 --- /dev/null +++ b/CefSharp/DevTools/Target/GetBrowserContextsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// GetBrowserContextsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetBrowserContextsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] browserContextIds + { + get; + set; + } + + /// + /// browserContextIds + /// + public string[] BrowserContextIds + { + get + { + return browserContextIds; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/GetTargetInfoResponse.cs b/CefSharp/DevTools/Target/GetTargetInfoResponse.cs new file mode 100644 index 0000000000..f24fbfecdb --- /dev/null +++ b/CefSharp/DevTools/Target/GetTargetInfoResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// GetTargetInfoResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetTargetInfoResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.Target.TargetInfo targetInfo + { + get; + set; + } + + /// + /// targetInfo + /// + public CefSharp.DevTools.Target.TargetInfo TargetInfo + { + get + { + return targetInfo; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/GetTargetsResponse.cs b/CefSharp/DevTools/Target/GetTargetsResponse.cs new file mode 100644 index 0000000000..bed8a09960 --- /dev/null +++ b/CefSharp/DevTools/Target/GetTargetsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// GetTargetsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetTargetsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList targetInfos + { + get; + set; + } + + /// + /// targetInfos + /// + public System.Collections.Generic.IList TargetInfos + { + get + { + return targetInfos; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/RemoteLocation.cs b/CefSharp/DevTools/Target/RemoteLocation.cs new file mode 100644 index 0000000000..38d91d6592 --- /dev/null +++ b/CefSharp/DevTools/Target/RemoteLocation.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// RemoteLocation + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RemoteLocation : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Host + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("host"), IsRequired = (true))] + public string Host + { + get; + set; + } + + /// + /// Port + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("port"), IsRequired = (true))] + public int Port + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/Target.cs b/CefSharp/DevTools/Target/Target.cs new file mode 100644 index 0000000000..c197a17cbb --- /dev/null +++ b/CefSharp/DevTools/Target/Target.cs @@ -0,0 +1,325 @@ +// Copyright © 2020 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.DevTools.Target +{ + using System.Linq; + + /// + /// Supports additional targets discovery and allows to attach to them. + /// + public partial class Target : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Target(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateActivateTarget(string targetId); + /// + /// Activates (focuses) the target. + /// + /// targetId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ActivateTargetAsync(string targetId) + { + ValidateActivateTarget(targetId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("targetId", targetId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.activateTarget", dict); + return methodResult; + } + + partial void ValidateAttachToTarget(string targetId, bool? flatten = null); + /// + /// Attaches to the target with given id. + /// + /// targetId + /// Enables "flat" access to the session via specifying sessionId attribute in the commands. + public async System.Threading.Tasks.Task AttachToTargetAsync(string targetId, bool? flatten = null) + { + ValidateAttachToTarget(targetId, flatten); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("targetId", targetId); + if (flatten.HasValue) + { + dict.Add("flatten", flatten.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.attachToTarget", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Attaches to the browser target, only uses flat sessionId mode. + /// + /// returns System.Threading.Tasks.Task<AttachToBrowserTargetResponse> + public async System.Threading.Tasks.Task AttachToBrowserTargetAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.attachToBrowserTarget", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateCloseTarget(string targetId); + /// + /// Closes the target. If the target is a page that gets closed too. + /// + /// targetId + /// returns System.Threading.Tasks.Task<CloseTargetResponse> + public async System.Threading.Tasks.Task CloseTargetAsync(string targetId) + { + ValidateCloseTarget(targetId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("targetId", targetId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.closeTarget", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateExposeDevToolsProtocol(string targetId, string bindingName = null); + /// + /// Inject object to the target's main frame that provides a communication + /// channel with browser target. + /// + /// Injected object will be available as `window[bindingName]`. + /// + /// The object has the follwing API: + /// - `binding.send(json)` - a method to send messages over the remote debugging protocol + /// - `binding.onmessage = json => handleMessage(json)` - a callback that will be called for the protocol notifications and command responses. + /// + /// targetId + /// Binding name, 'cdp' if not specified. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ExposeDevToolsProtocolAsync(string targetId, string bindingName = null) + { + ValidateExposeDevToolsProtocol(targetId, bindingName); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("targetId", targetId); + if (!(string.IsNullOrEmpty(bindingName))) + { + dict.Add("bindingName", bindingName); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.exposeDevToolsProtocol", dict); + return methodResult; + } + + partial void ValidateCreateBrowserContext(bool? disposeOnDetach = null, string proxyServer = null, string proxyBypassList = null); + /// + /// Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than + /// one. + /// + /// If specified, disposes this context when debugging session disconnects. + /// Proxy server, similar to the one passed to --proxy-server + /// Proxy bypass list, similar to the one passed to --proxy-bypass-list + /// returns System.Threading.Tasks.Task<CreateBrowserContextResponse> + public async System.Threading.Tasks.Task CreateBrowserContextAsync(bool? disposeOnDetach = null, string proxyServer = null, string proxyBypassList = null) + { + ValidateCreateBrowserContext(disposeOnDetach, proxyServer, proxyBypassList); + var dict = new System.Collections.Generic.Dictionary(); + if (disposeOnDetach.HasValue) + { + dict.Add("disposeOnDetach", disposeOnDetach.Value); + } + + if (!(string.IsNullOrEmpty(proxyServer))) + { + dict.Add("proxyServer", proxyServer); + } + + if (!(string.IsNullOrEmpty(proxyBypassList))) + { + dict.Add("proxyBypassList", proxyBypassList); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.createBrowserContext", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Returns all browser contexts created with `Target.createBrowserContext` method. + /// + /// returns System.Threading.Tasks.Task<GetBrowserContextsResponse> + public async System.Threading.Tasks.Task GetBrowserContextsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.getBrowserContexts", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateCreateTarget(string url, int? width = null, int? height = null, string browserContextId = null, bool? enableBeginFrameControl = null, bool? newWindow = null, bool? background = null); + /// + /// Creates a new page. + /// + /// The initial URL the page will be navigated to. + /// Frame width in DIP (headless chrome only). + /// Frame height in DIP (headless chrome only). + /// The browser context to create the page in. + /// Whether BeginFrames for this target will be controlled via DevTools (headless chrome only, + public async System.Threading.Tasks.Task CreateTargetAsync(string url, int? width = null, int? height = null, string browserContextId = null, bool? enableBeginFrameControl = null, bool? newWindow = null, bool? background = null) + { + ValidateCreateTarget(url, width, height, browserContextId, enableBeginFrameControl, newWindow, background); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("url", url); + if (width.HasValue) + { + dict.Add("width", width.Value); + } + + if (height.HasValue) + { + dict.Add("height", height.Value); + } + + if (!(string.IsNullOrEmpty(browserContextId))) + { + dict.Add("browserContextId", browserContextId); + } + + if (enableBeginFrameControl.HasValue) + { + dict.Add("enableBeginFrameControl", enableBeginFrameControl.Value); + } + + if (newWindow.HasValue) + { + dict.Add("newWindow", newWindow.Value); + } + + if (background.HasValue) + { + dict.Add("background", background.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.createTarget", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateDetachFromTarget(string sessionId = null, string targetId = null); + /// + /// Detaches session with given id. + /// + /// Session to detach. + /// Deprecated. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DetachFromTargetAsync(string sessionId = null, string targetId = null) + { + ValidateDetachFromTarget(sessionId, targetId); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(sessionId))) + { + dict.Add("sessionId", sessionId); + } + + if (!(string.IsNullOrEmpty(targetId))) + { + dict.Add("targetId", targetId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.detachFromTarget", dict); + return methodResult; + } + + partial void ValidateDisposeBrowserContext(string browserContextId); + /// + /// Deletes a BrowserContext. All the belonging pages will be closed without calling their + /// beforeunload hooks. + /// + /// browserContextId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisposeBrowserContextAsync(string browserContextId) + { + ValidateDisposeBrowserContext(browserContextId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("browserContextId", browserContextId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.disposeBrowserContext", dict); + return methodResult; + } + + partial void ValidateGetTargetInfo(string targetId = null); + /// + /// Returns information about a target. + /// + /// targetId + /// returns System.Threading.Tasks.Task<GetTargetInfoResponse> + public async System.Threading.Tasks.Task GetTargetInfoAsync(string targetId = null) + { + ValidateGetTargetInfo(targetId); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(targetId))) + { + dict.Add("targetId", targetId); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.getTargetInfo", dict); + return methodResult.DeserializeJson(); + } + + /// + /// Retrieves a list of available targets. + /// + /// returns System.Threading.Tasks.Task<GetTargetsResponse> + public async System.Threading.Tasks.Task GetTargetsAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.getTargets", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateSetAutoAttach(bool autoAttach, bool waitForDebuggerOnStart, bool? flatten = null); + /// + /// Controls whether to automatically attach to new targets which are considered to be related to + /// this one. When turned on, attaches to all existing related targets as well. When turned off, + /// automatically detaches from all currently attached targets. + /// + /// Whether to auto-attach to related targets. + /// Whether to pause new targets when attaching to them. Use `Runtime.runIfWaitingForDebugger` + public async System.Threading.Tasks.Task SetAutoAttachAsync(bool autoAttach, bool waitForDebuggerOnStart, bool? flatten = null) + { + ValidateSetAutoAttach(autoAttach, waitForDebuggerOnStart, flatten); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("autoAttach", autoAttach); + dict.Add("waitForDebuggerOnStart", waitForDebuggerOnStart); + if (flatten.HasValue) + { + dict.Add("flatten", flatten.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.setAutoAttach", dict); + return methodResult; + } + + partial void ValidateSetDiscoverTargets(bool discover); + /// + /// Controls whether to discover available targets and notify via + /// `targetCreated/targetInfoChanged/targetDestroyed` events. + /// + /// Whether to discover available targets. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetDiscoverTargetsAsync(bool discover) + { + ValidateSetDiscoverTargets(discover); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("discover", discover); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.setDiscoverTargets", dict); + return methodResult; + } + + partial void ValidateSetRemoteLocations(System.Collections.Generic.IList locations); + /// + /// Enables target discovery for the specified locations, when `setDiscoverTargets` was set to + /// `true`. + /// + /// List of remote locations. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetRemoteLocationsAsync(System.Collections.Generic.IList locations) + { + ValidateSetRemoteLocations(locations); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("locations", locations.Select(x => x.ToDictionary())); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Target.setRemoteLocations", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Target/TargetInfo.cs b/CefSharp/DevTools/Target/TargetInfo.cs new file mode 100644 index 0000000000..56f0410b62 --- /dev/null +++ b/CefSharp/DevTools/Target/TargetInfo.cs @@ -0,0 +1,82 @@ +// Copyright © 2020 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.DevTools.Target +{ + /// + /// TargetInfo + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TargetInfo : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// TargetId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("targetId"), IsRequired = (true))] + public string TargetId + { + get; + set; + } + + /// + /// Type + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("type"), IsRequired = (true))] + public string Type + { + get; + set; + } + + /// + /// Title + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("title"), IsRequired = (true))] + public string Title + { + get; + set; + } + + /// + /// Url + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("url"), IsRequired = (true))] + public string Url + { + get; + set; + } + + /// + /// Whether the target has an attached client. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("attached"), IsRequired = (true))] + public bool Attached + { + get; + set; + } + + /// + /// Opener target Id + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("openerId"), IsRequired = (false))] + public string OpenerId + { + get; + set; + } + + /// + /// BrowserContextId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("browserContextId"), IsRequired = (false))] + public string BrowserContextId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Tethering/Tethering.cs b/CefSharp/DevTools/Tethering/Tethering.cs new file mode 100644 index 0000000000..be7d4f05c2 --- /dev/null +++ b/CefSharp/DevTools/Tethering/Tethering.cs @@ -0,0 +1,49 @@ +// Copyright © 2020 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.DevTools.Tethering +{ + using System.Linq; + + /// + /// The Tethering domain defines methods and events for browser port binding. + /// + public partial class Tethering : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Tethering(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + partial void ValidateBind(int port); + /// + /// Request browser port binding. + /// + /// Port number to bind. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task BindAsync(int port) + { + ValidateBind(port); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("port", port); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Tethering.bind", dict); + return methodResult; + } + + partial void ValidateUnbind(int port); + /// + /// Request browser port unbinding. + /// + /// Port number to unbind. + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task UnbindAsync(int port) + { + ValidateUnbind(port); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("port", port); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Tethering.unbind", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Tracing/Enums/StreamCompression.cs b/CefSharp/DevTools/Tracing/Enums/StreamCompression.cs new file mode 100644 index 0000000000..434e278058 --- /dev/null +++ b/CefSharp/DevTools/Tracing/Enums/StreamCompression.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.Tracing +{ + /// + /// Compression type to use for traces returned via streams. + /// + public enum StreamCompression + { + /// + /// none + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("none"))] + None, + /// + /// gzip + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("gzip"))] + Gzip + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Tracing/Enums/StreamFormat.cs b/CefSharp/DevTools/Tracing/Enums/StreamFormat.cs new file mode 100644 index 0000000000..7d082d8a6b --- /dev/null +++ b/CefSharp/DevTools/Tracing/Enums/StreamFormat.cs @@ -0,0 +1,23 @@ +// Copyright © 2020 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.DevTools.Tracing +{ + /// + /// Data format of a trace. Can be either the legacy JSON format or the + /// protocol buffer format. Note that the JSON format will be deprecated soon. + /// + public enum StreamFormat + { + /// + /// json + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("json"))] + Json, + /// + /// proto + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("proto"))] + Proto + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Tracing/GetCategoriesResponse.cs b/CefSharp/DevTools/Tracing/GetCategoriesResponse.cs new file mode 100644 index 0000000000..bb5eaa133e --- /dev/null +++ b/CefSharp/DevTools/Tracing/GetCategoriesResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.Tracing +{ + /// + /// GetCategoriesResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetCategoriesResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string[] categories + { + get; + set; + } + + /// + /// categories + /// + public string[] Categories + { + get + { + return categories; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Tracing/RequestMemoryDumpResponse.cs b/CefSharp/DevTools/Tracing/RequestMemoryDumpResponse.cs new file mode 100644 index 0000000000..74cdc6ecba --- /dev/null +++ b/CefSharp/DevTools/Tracing/RequestMemoryDumpResponse.cs @@ -0,0 +1,48 @@ +// Copyright © 2020 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.DevTools.Tracing +{ + /// + /// RequestMemoryDumpResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class RequestMemoryDumpResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string dumpGuid + { + get; + set; + } + + /// + /// dumpGuid + /// + public string DumpGuid + { + get + { + return dumpGuid; + } + } + + [System.Runtime.Serialization.DataMemberAttribute] + internal bool success + { + get; + set; + } + + /// + /// success + /// + public bool Success + { + get + { + return success; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Tracing/TraceConfig.cs b/CefSharp/DevTools/Tracing/TraceConfig.cs new file mode 100644 index 0000000000..3a5b1108b0 --- /dev/null +++ b/CefSharp/DevTools/Tracing/TraceConfig.cs @@ -0,0 +1,92 @@ +// Copyright © 2020 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.DevTools.Tracing +{ + /// + /// TraceConfig + /// + [System.Runtime.Serialization.DataContractAttribute] + public class TraceConfig : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// Controls how the trace buffer stores data. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("recordMode"), IsRequired = (false))] + public string RecordMode + { + get; + set; + } + + /// + /// Turns on JavaScript stack sampling. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("enableSampling"), IsRequired = (false))] + public bool? EnableSampling + { + get; + set; + } + + /// + /// Turns on system tracing. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("enableSystrace"), IsRequired = (false))] + public bool? EnableSystrace + { + get; + set; + } + + /// + /// Turns on argument filter. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("enableArgumentFilter"), IsRequired = (false))] + public bool? EnableArgumentFilter + { + get; + set; + } + + /// + /// Included category filters. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("includedCategories"), IsRequired = (false))] + public string[] IncludedCategories + { + get; + set; + } + + /// + /// Excluded category filters. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("excludedCategories"), IsRequired = (false))] + public string[] ExcludedCategories + { + get; + set; + } + + /// + /// Configuration to synthesize the delays in tracing. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("syntheticDelays"), IsRequired = (false))] + public string[] SyntheticDelays + { + get; + set; + } + + /// + /// Configuration for memory dump triggers. Used only when "memory-infra" category is enabled. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("memoryDumpConfig"), IsRequired = (false))] + public CefSharp.DevTools.Tracing.MemoryDumpConfig MemoryDumpConfig + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/Tracing/Tracing.cs b/CefSharp/DevTools/Tracing/Tracing.cs new file mode 100644 index 0000000000..1cf29ce510 --- /dev/null +++ b/CefSharp/DevTools/Tracing/Tracing.cs @@ -0,0 +1,126 @@ +// Copyright © 2020 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.DevTools.Tracing +{ + using System.Linq; + + /// + /// Tracing + /// + public partial class Tracing : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public Tracing(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Stop trace events collection. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EndAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Tracing.end", dict); + return methodResult; + } + + /// + /// Gets supported tracing categories. + /// + /// returns System.Threading.Tasks.Task<GetCategoriesResponse> + public async System.Threading.Tasks.Task GetCategoriesAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("Tracing.getCategories", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateRecordClockSyncMarker(string syncId); + /// + /// Record a clock sync marker in the trace. + /// + /// The ID of this clock sync marker + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RecordClockSyncMarkerAsync(string syncId) + { + ValidateRecordClockSyncMarker(syncId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("syncId", syncId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("Tracing.recordClockSyncMarker", dict); + return methodResult; + } + + partial void ValidateRequestMemoryDump(bool? deterministic = null); + /// + /// Request a global memory dump. + /// + /// Enables more deterministic results by forcing garbage collection + /// returns System.Threading.Tasks.Task<RequestMemoryDumpResponse> + public async System.Threading.Tasks.Task RequestMemoryDumpAsync(bool? deterministic = null) + { + ValidateRequestMemoryDump(deterministic); + var dict = new System.Collections.Generic.Dictionary(); + if (deterministic.HasValue) + { + dict.Add("deterministic", deterministic.Value); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Tracing.requestMemoryDump", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateStart(string categories = null, string options = null, long? bufferUsageReportingInterval = null, string transferMode = null, CefSharp.DevTools.Tracing.StreamFormat? streamFormat = null, CefSharp.DevTools.Tracing.StreamCompression? streamCompression = null, CefSharp.DevTools.Tracing.TraceConfig traceConfig = null); + /// + /// Start trace events collection. + /// + /// Category/tag filter + /// Tracing options + /// If set, the agent will issue bufferUsage events at this interval, specified in milliseconds + /// Whether to report trace events as series of dataCollected events or to save trace to a + public async System.Threading.Tasks.Task StartAsync(string categories = null, string options = null, long? bufferUsageReportingInterval = null, string transferMode = null, CefSharp.DevTools.Tracing.StreamFormat? streamFormat = null, CefSharp.DevTools.Tracing.StreamCompression? streamCompression = null, CefSharp.DevTools.Tracing.TraceConfig traceConfig = null) + { + ValidateStart(categories, options, bufferUsageReportingInterval, transferMode, streamFormat, streamCompression, traceConfig); + var dict = new System.Collections.Generic.Dictionary(); + if (!(string.IsNullOrEmpty(categories))) + { + dict.Add("categories", categories); + } + + if (!(string.IsNullOrEmpty(options))) + { + dict.Add("options", options); + } + + if (bufferUsageReportingInterval.HasValue) + { + dict.Add("bufferUsageReportingInterval", bufferUsageReportingInterval.Value); + } + + if (!(string.IsNullOrEmpty(transferMode))) + { + dict.Add("transferMode", transferMode); + } + + if (streamFormat.HasValue) + { + dict.Add("streamFormat", this.EnumToString(streamFormat)); + } + + if (streamCompression.HasValue) + { + dict.Add("streamCompression", this.EnumToString(streamCompression)); + } + + if ((traceConfig) != (null)) + { + dict.Add("traceConfig", traceConfig.ToDictionary()); + } + + var methodResult = await _client.ExecuteDevToolsMethodAsync("Tracing.start", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/AudioListener.cs b/CefSharp/DevTools/WebAudio/AudioListener.cs new file mode 100644 index 0000000000..a63e2062db --- /dev/null +++ b/CefSharp/DevTools/WebAudio/AudioListener.cs @@ -0,0 +1,32 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Protocol object for AudioListner + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AudioListener : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// ListenerId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("listenerId"), IsRequired = (true))] + public string ListenerId + { + get; + set; + } + + /// + /// ContextId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contextId"), IsRequired = (true))] + public string ContextId + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/AudioNode.cs b/CefSharp/DevTools/WebAudio/AudioNode.cs new file mode 100644 index 0000000000..ef2151a9d4 --- /dev/null +++ b/CefSharp/DevTools/WebAudio/AudioNode.cs @@ -0,0 +1,118 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Protocol object for AudioNode + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AudioNode : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// NodeId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeId"), IsRequired = (true))] + public string NodeId + { + get; + set; + } + + /// + /// ContextId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contextId"), IsRequired = (true))] + public string ContextId + { + get; + set; + } + + /// + /// NodeType + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeType"), IsRequired = (true))] + public string NodeType + { + get; + set; + } + + /// + /// NumberOfInputs + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("numberOfInputs"), IsRequired = (true))] + public long NumberOfInputs + { + get; + set; + } + + /// + /// NumberOfOutputs + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("numberOfOutputs"), IsRequired = (true))] + public long NumberOfOutputs + { + get; + set; + } + + /// + /// ChannelCount + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("channelCount"), IsRequired = (true))] + public long ChannelCount + { + get; + set; + } + + public CefSharp.DevTools.WebAudio.ChannelCountMode ChannelCountMode + { + get + { + return (CefSharp.DevTools.WebAudio.ChannelCountMode)(StringToEnum(typeof(CefSharp.DevTools.WebAudio.ChannelCountMode), channelCountMode)); + } + + set + { + channelCountMode = (EnumToString(value)); + } + } + + /// + /// ChannelCountMode + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("channelCountMode"), IsRequired = (true))] + internal string channelCountMode + { + get; + set; + } + + public CefSharp.DevTools.WebAudio.ChannelInterpretation ChannelInterpretation + { + get + { + return (CefSharp.DevTools.WebAudio.ChannelInterpretation)(StringToEnum(typeof(CefSharp.DevTools.WebAudio.ChannelInterpretation), channelInterpretation)); + } + + set + { + channelInterpretation = (EnumToString(value)); + } + } + + /// + /// ChannelInterpretation + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("channelInterpretation"), IsRequired = (true))] + internal string channelInterpretation + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/AudioParam.cs b/CefSharp/DevTools/WebAudio/AudioParam.cs new file mode 100644 index 0000000000..35ec18ad4a --- /dev/null +++ b/CefSharp/DevTools/WebAudio/AudioParam.cs @@ -0,0 +1,105 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Protocol object for AudioParam + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AudioParam : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// ParamId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("paramId"), IsRequired = (true))] + public string ParamId + { + get; + set; + } + + /// + /// NodeId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("nodeId"), IsRequired = (true))] + public string NodeId + { + get; + set; + } + + /// + /// ContextId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contextId"), IsRequired = (true))] + public string ContextId + { + get; + set; + } + + /// + /// ParamType + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("paramType"), IsRequired = (true))] + public string ParamType + { + get; + set; + } + + public CefSharp.DevTools.WebAudio.AutomationRate Rate + { + get + { + return (CefSharp.DevTools.WebAudio.AutomationRate)(StringToEnum(typeof(CefSharp.DevTools.WebAudio.AutomationRate), rate)); + } + + set + { + rate = (EnumToString(value)); + } + } + + /// + /// Rate + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("rate"), IsRequired = (true))] + internal string rate + { + get; + set; + } + + /// + /// DefaultValue + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("defaultValue"), IsRequired = (true))] + public long DefaultValue + { + get; + set; + } + + /// + /// MinValue + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("minValue"), IsRequired = (true))] + public long MinValue + { + get; + set; + } + + /// + /// MaxValue + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("maxValue"), IsRequired = (true))] + public long MaxValue + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/BaseAudioContext.cs b/CefSharp/DevTools/WebAudio/BaseAudioContext.cs new file mode 100644 index 0000000000..3ca406b1fa --- /dev/null +++ b/CefSharp/DevTools/WebAudio/BaseAudioContext.cs @@ -0,0 +1,108 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Protocol object for BaseAudioContext + /// + [System.Runtime.Serialization.DataContractAttribute] + public class BaseAudioContext : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// ContextId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contextId"), IsRequired = (true))] + public string ContextId + { + get; + set; + } + + public CefSharp.DevTools.WebAudio.ContextType ContextType + { + get + { + return (CefSharp.DevTools.WebAudio.ContextType)(StringToEnum(typeof(CefSharp.DevTools.WebAudio.ContextType), contextType)); + } + + set + { + contextType = (EnumToString(value)); + } + } + + /// + /// ContextType + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contextType"), IsRequired = (true))] + internal string contextType + { + get; + set; + } + + public CefSharp.DevTools.WebAudio.ContextState ContextState + { + get + { + return (CefSharp.DevTools.WebAudio.ContextState)(StringToEnum(typeof(CefSharp.DevTools.WebAudio.ContextState), contextState)); + } + + set + { + contextState = (EnumToString(value)); + } + } + + /// + /// ContextState + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("contextState"), IsRequired = (true))] + internal string contextState + { + get; + set; + } + + /// + /// RealtimeData + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("realtimeData"), IsRequired = (false))] + public CefSharp.DevTools.WebAudio.ContextRealtimeData RealtimeData + { + get; + set; + } + + /// + /// Platform-dependent callback buffer size. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("callbackBufferSize"), IsRequired = (true))] + public long CallbackBufferSize + { + get; + set; + } + + /// + /// Number of output channels supported by audio hardware in use. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("maxOutputChannelCount"), IsRequired = (true))] + public long MaxOutputChannelCount + { + get; + set; + } + + /// + /// Context sample rate. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("sampleRate"), IsRequired = (true))] + public long SampleRate + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/ContextRealtimeData.cs b/CefSharp/DevTools/WebAudio/ContextRealtimeData.cs new file mode 100644 index 0000000000..7feec0f60e --- /dev/null +++ b/CefSharp/DevTools/WebAudio/ContextRealtimeData.cs @@ -0,0 +1,54 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Fields in AudioContext that change in real-time. + /// + [System.Runtime.Serialization.DataContractAttribute] + public class ContextRealtimeData : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// The current context time in second in BaseAudioContext. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("currentTime"), IsRequired = (true))] + public long CurrentTime + { + get; + set; + } + + /// + /// The time spent on rendering graph divided by render qunatum duration, + /// and multiplied by 100. 100 means the audio renderer reached the full + /// capacity and glitch may occur. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("renderCapacity"), IsRequired = (true))] + public long RenderCapacity + { + get; + set; + } + + /// + /// A running mean of callback interval. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("callbackIntervalMean"), IsRequired = (true))] + public long CallbackIntervalMean + { + get; + set; + } + + /// + /// A running variance of callback interval. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("callbackIntervalVariance"), IsRequired = (true))] + public long CallbackIntervalVariance + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/Enums/AutomationRate.cs b/CefSharp/DevTools/WebAudio/Enums/AutomationRate.cs new file mode 100644 index 0000000000..97f7096789 --- /dev/null +++ b/CefSharp/DevTools/WebAudio/Enums/AutomationRate.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Enum of AudioParam::AutomationRate from the spec + /// + public enum AutomationRate + { + /// + /// a-rate + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("a-rate"))] + ARate, + /// + /// k-rate + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("k-rate"))] + KRate + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/Enums/ChannelCountMode.cs b/CefSharp/DevTools/WebAudio/Enums/ChannelCountMode.cs new file mode 100644 index 0000000000..b7d629f8f6 --- /dev/null +++ b/CefSharp/DevTools/WebAudio/Enums/ChannelCountMode.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Enum of AudioNode::ChannelCountMode from the spec + /// + public enum ChannelCountMode + { + /// + /// clamped-max + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("clamped-max"))] + ClampedMax, + /// + /// explicit + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("explicit"))] + Explicit, + /// + /// max + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("max"))] + Max + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/Enums/ChannelInterpretation.cs b/CefSharp/DevTools/WebAudio/Enums/ChannelInterpretation.cs new file mode 100644 index 0000000000..edefef8958 --- /dev/null +++ b/CefSharp/DevTools/WebAudio/Enums/ChannelInterpretation.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Enum of AudioNode::ChannelInterpretation from the spec + /// + public enum ChannelInterpretation + { + /// + /// discrete + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("discrete"))] + Discrete, + /// + /// speakers + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("speakers"))] + Speakers + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/Enums/ContextState.cs b/CefSharp/DevTools/WebAudio/Enums/ContextState.cs new file mode 100644 index 0000000000..e19ce20381 --- /dev/null +++ b/CefSharp/DevTools/WebAudio/Enums/ContextState.cs @@ -0,0 +1,27 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Enum of AudioContextState from the spec + /// + public enum ContextState + { + /// + /// suspended + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("suspended"))] + Suspended, + /// + /// running + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("running"))] + Running, + /// + /// closed + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("closed"))] + Closed + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/Enums/ContextType.cs b/CefSharp/DevTools/WebAudio/Enums/ContextType.cs new file mode 100644 index 0000000000..d9ce1ad728 --- /dev/null +++ b/CefSharp/DevTools/WebAudio/Enums/ContextType.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// Enum of BaseAudioContext types + /// + public enum ContextType + { + /// + /// realtime + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("realtime"))] + Realtime, + /// + /// offline + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("offline"))] + Offline + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/GetRealtimeDataResponse.cs b/CefSharp/DevTools/WebAudio/GetRealtimeDataResponse.cs new file mode 100644 index 0000000000..c0e00dbb15 --- /dev/null +++ b/CefSharp/DevTools/WebAudio/GetRealtimeDataResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + /// + /// GetRealtimeDataResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetRealtimeDataResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.WebAudio.ContextRealtimeData realtimeData + { + get; + set; + } + + /// + /// realtimeData + /// + public CefSharp.DevTools.WebAudio.ContextRealtimeData RealtimeData + { + get + { + return realtimeData; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAudio/WebAudio.cs b/CefSharp/DevTools/WebAudio/WebAudio.cs new file mode 100644 index 0000000000..0a28c44612 --- /dev/null +++ b/CefSharp/DevTools/WebAudio/WebAudio.cs @@ -0,0 +1,57 @@ +// Copyright © 2020 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.DevTools.WebAudio +{ + using System.Linq; + + /// + /// This domain allows inspection of Web Audio API. + /// https://webaudio.github.io/web-audio-api/ + /// + public partial class WebAudio : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public WebAudio(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Enables the WebAudio domain and starts sending context lifetime events. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAudio.enable", dict); + return methodResult; + } + + /// + /// Disables the WebAudio domain. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAudio.disable", dict); + return methodResult; + } + + partial void ValidateGetRealtimeData(string contextId); + /// + /// Fetch the realtime data from the registered contexts. + /// + /// contextId + /// returns System.Threading.Tasks.Task<GetRealtimeDataResponse> + public async System.Threading.Tasks.Task GetRealtimeDataAsync(string contextId) + { + ValidateGetRealtimeData(contextId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("contextId", contextId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAudio.getRealtimeData", dict); + return methodResult.DeserializeJson(); + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAuthn/AddVirtualAuthenticatorResponse.cs b/CefSharp/DevTools/WebAuthn/AddVirtualAuthenticatorResponse.cs new file mode 100644 index 0000000000..465082fdb5 --- /dev/null +++ b/CefSharp/DevTools/WebAuthn/AddVirtualAuthenticatorResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.WebAuthn +{ + /// + /// AddVirtualAuthenticatorResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class AddVirtualAuthenticatorResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal string authenticatorId + { + get; + set; + } + + /// + /// authenticatorId + /// + public string AuthenticatorId + { + get + { + return authenticatorId; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAuthn/Credential.cs b/CefSharp/DevTools/WebAuthn/Credential.cs new file mode 100644 index 0000000000..67e8a8bc9c --- /dev/null +++ b/CefSharp/DevTools/WebAuthn/Credential.cs @@ -0,0 +1,76 @@ +// Copyright © 2020 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.DevTools.WebAuthn +{ + /// + /// Credential + /// + [System.Runtime.Serialization.DataContractAttribute] + public class Credential : CefSharp.DevTools.DevToolsDomainEntityBase + { + /// + /// CredentialId + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("credentialId"), IsRequired = (true))] + public byte[] CredentialId + { + get; + set; + } + + /// + /// IsResidentCredential + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isResidentCredential"), IsRequired = (true))] + public bool IsResidentCredential + { + get; + set; + } + + /// + /// Relying Party ID the credential is scoped to. Must be set when adding a + /// credential. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("rpId"), IsRequired = (false))] + public string RpId + { + get; + set; + } + + /// + /// The ECDSA P-256 private key in PKCS#8 format. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("privateKey"), IsRequired = (true))] + public byte[] PrivateKey + { + get; + set; + } + + /// + /// An opaque byte sequence with a maximum size of 64 bytes mapping the + /// credential to a specific user. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("userHandle"), IsRequired = (false))] + public byte[] UserHandle + { + get; + set; + } + + /// + /// Signature counter. This is incremented by one for each successful + /// assertion. + /// See https://w3c.github.io/webauthn/#signature-counter + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("signCount"), IsRequired = (true))] + public int SignCount + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAuthn/Enums/AuthenticatorProtocol.cs b/CefSharp/DevTools/WebAuthn/Enums/AuthenticatorProtocol.cs new file mode 100644 index 0000000000..e32333ef87 --- /dev/null +++ b/CefSharp/DevTools/WebAuthn/Enums/AuthenticatorProtocol.cs @@ -0,0 +1,22 @@ +// Copyright © 2020 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.DevTools.WebAuthn +{ + /// + /// AuthenticatorProtocol + /// + public enum AuthenticatorProtocol + { + /// + /// u2f + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("u2f"))] + U2f, + /// + /// ctap2 + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ctap2"))] + Ctap2 + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAuthn/Enums/AuthenticatorTransport.cs b/CefSharp/DevTools/WebAuthn/Enums/AuthenticatorTransport.cs new file mode 100644 index 0000000000..38ad61a8b7 --- /dev/null +++ b/CefSharp/DevTools/WebAuthn/Enums/AuthenticatorTransport.cs @@ -0,0 +1,37 @@ +// Copyright © 2020 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.DevTools.WebAuthn +{ + /// + /// AuthenticatorTransport + /// + public enum AuthenticatorTransport + { + /// + /// usb + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("usb"))] + Usb, + /// + /// nfc + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("nfc"))] + Nfc, + /// + /// ble + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("ble"))] + Ble, + /// + /// cable + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("cable"))] + Cable, + /// + /// internal + /// + [System.Runtime.Serialization.EnumMemberAttribute(Value = ("internal"))] + Internal + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAuthn/GetCredentialResponse.cs b/CefSharp/DevTools/WebAuthn/GetCredentialResponse.cs new file mode 100644 index 0000000000..dee241e030 --- /dev/null +++ b/CefSharp/DevTools/WebAuthn/GetCredentialResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.WebAuthn +{ + /// + /// GetCredentialResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetCredentialResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal CefSharp.DevTools.WebAuthn.Credential credential + { + get; + set; + } + + /// + /// credential + /// + public CefSharp.DevTools.WebAuthn.Credential Credential + { + get + { + return credential; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAuthn/GetCredentialsResponse.cs b/CefSharp/DevTools/WebAuthn/GetCredentialsResponse.cs new file mode 100644 index 0000000000..9293327574 --- /dev/null +++ b/CefSharp/DevTools/WebAuthn/GetCredentialsResponse.cs @@ -0,0 +1,30 @@ +// Copyright © 2020 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.DevTools.WebAuthn +{ + /// + /// GetCredentialsResponse + /// + [System.Runtime.Serialization.DataContractAttribute] + public class GetCredentialsResponse : CefSharp.DevTools.DevToolsDomainResponseBase + { + [System.Runtime.Serialization.DataMemberAttribute] + internal System.Collections.Generic.IList credentials + { + get; + set; + } + + /// + /// credentials + /// + public System.Collections.Generic.IList Credentials + { + get + { + return credentials; + } + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAuthn/VirtualAuthenticatorOptions.cs b/CefSharp/DevTools/WebAuthn/VirtualAuthenticatorOptions.cs new file mode 100644 index 0000000000..e07300c52b --- /dev/null +++ b/CefSharp/DevTools/WebAuthn/VirtualAuthenticatorOptions.cs @@ -0,0 +1,100 @@ +// Copyright © 2020 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.DevTools.WebAuthn +{ + /// + /// VirtualAuthenticatorOptions + /// + [System.Runtime.Serialization.DataContractAttribute] + public class VirtualAuthenticatorOptions : CefSharp.DevTools.DevToolsDomainEntityBase + { + public CefSharp.DevTools.WebAuthn.AuthenticatorProtocol Protocol + { + get + { + return (CefSharp.DevTools.WebAuthn.AuthenticatorProtocol)(StringToEnum(typeof(CefSharp.DevTools.WebAuthn.AuthenticatorProtocol), protocol)); + } + + set + { + protocol = (EnumToString(value)); + } + } + + /// + /// Protocol + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("protocol"), IsRequired = (true))] + internal string protocol + { + get; + set; + } + + public CefSharp.DevTools.WebAuthn.AuthenticatorTransport Transport + { + get + { + return (CefSharp.DevTools.WebAuthn.AuthenticatorTransport)(StringToEnum(typeof(CefSharp.DevTools.WebAuthn.AuthenticatorTransport), transport)); + } + + set + { + transport = (EnumToString(value)); + } + } + + /// + /// Transport + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("transport"), IsRequired = (true))] + internal string transport + { + get; + set; + } + + /// + /// Defaults to false. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("hasResidentKey"), IsRequired = (false))] + public bool? HasResidentKey + { + get; + set; + } + + /// + /// Defaults to false. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("hasUserVerification"), IsRequired = (false))] + public bool? HasUserVerification + { + get; + set; + } + + /// + /// If set to true, tests of user presence will succeed immediately. + /// Otherwise, they will not be resolved. Defaults to true. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("automaticPresenceSimulation"), IsRequired = (false))] + public bool? AutomaticPresenceSimulation + { + get; + set; + } + + /// + /// Sets whether User Verification succeeds or fails for an authenticator. + /// Defaults to false. + /// + [System.Runtime.Serialization.DataMemberAttribute(Name = ("isUserVerified"), IsRequired = (false))] + public bool? IsUserVerified + { + get; + set; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevTools/WebAuthn/WebAuthn.cs b/CefSharp/DevTools/WebAuthn/WebAuthn.cs new file mode 100644 index 0000000000..ab9c988b7c --- /dev/null +++ b/CefSharp/DevTools/WebAuthn/WebAuthn.cs @@ -0,0 +1,173 @@ +// Copyright © 2020 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.DevTools.WebAuthn +{ + using System.Linq; + + /// + /// This domain allows configuring virtual authenticators to test the WebAuthn + /// API. + /// + public partial class WebAuthn : DevToolsDomainBase + { + private CefSharp.DevTools.IDevToolsClient _client; + public WebAuthn(CefSharp.DevTools.IDevToolsClient client) + { + _client = (client); + } + + /// + /// Enable the WebAuthn domain and start intercepting credential storage and + /// retrieval with a virtual authenticator. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task EnableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.enable", dict); + return methodResult; + } + + /// + /// Disable the WebAuthn domain. + /// + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task DisableAsync() + { + System.Collections.Generic.Dictionary dict = null; + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.disable", dict); + return methodResult; + } + + partial void ValidateAddVirtualAuthenticator(CefSharp.DevTools.WebAuthn.VirtualAuthenticatorOptions options); + /// + /// Creates and adds a virtual authenticator. + /// + /// options + /// returns System.Threading.Tasks.Task<AddVirtualAuthenticatorResponse> + public async System.Threading.Tasks.Task AddVirtualAuthenticatorAsync(CefSharp.DevTools.WebAuthn.VirtualAuthenticatorOptions options) + { + ValidateAddVirtualAuthenticator(options); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("options", options.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.addVirtualAuthenticator", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateRemoveVirtualAuthenticator(string authenticatorId); + /// + /// Removes the given authenticator. + /// + /// authenticatorId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveVirtualAuthenticatorAsync(string authenticatorId) + { + ValidateRemoveVirtualAuthenticator(authenticatorId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("authenticatorId", authenticatorId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.removeVirtualAuthenticator", dict); + return methodResult; + } + + partial void ValidateAddCredential(string authenticatorId, CefSharp.DevTools.WebAuthn.Credential credential); + /// + /// Adds the credential to the specified authenticator. + /// + /// authenticatorId + /// credential + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task AddCredentialAsync(string authenticatorId, CefSharp.DevTools.WebAuthn.Credential credential) + { + ValidateAddCredential(authenticatorId, credential); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("authenticatorId", authenticatorId); + dict.Add("credential", credential.ToDictionary()); + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.addCredential", dict); + return methodResult; + } + + partial void ValidateGetCredential(string authenticatorId, byte[] credentialId); + /// + /// Returns a single credential stored in the given virtual authenticator that + /// matches the credential ID. + /// + /// authenticatorId + /// credentialId + /// returns System.Threading.Tasks.Task<GetCredentialResponse> + public async System.Threading.Tasks.Task GetCredentialAsync(string authenticatorId, byte[] credentialId) + { + ValidateGetCredential(authenticatorId, credentialId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("authenticatorId", authenticatorId); + dict.Add("credentialId", ToBase64String(credentialId)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.getCredential", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateGetCredentials(string authenticatorId); + /// + /// Returns all the credentials stored in the given virtual authenticator. + /// + /// authenticatorId + /// returns System.Threading.Tasks.Task<GetCredentialsResponse> + public async System.Threading.Tasks.Task GetCredentialsAsync(string authenticatorId) + { + ValidateGetCredentials(authenticatorId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("authenticatorId", authenticatorId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.getCredentials", dict); + return methodResult.DeserializeJson(); + } + + partial void ValidateRemoveCredential(string authenticatorId, byte[] credentialId); + /// + /// Removes a credential from the authenticator. + /// + /// authenticatorId + /// credentialId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task RemoveCredentialAsync(string authenticatorId, byte[] credentialId) + { + ValidateRemoveCredential(authenticatorId, credentialId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("authenticatorId", authenticatorId); + dict.Add("credentialId", ToBase64String(credentialId)); + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.removeCredential", dict); + return methodResult; + } + + partial void ValidateClearCredentials(string authenticatorId); + /// + /// Clears all the credentials from the specified device. + /// + /// authenticatorId + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task ClearCredentialsAsync(string authenticatorId) + { + ValidateClearCredentials(authenticatorId); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("authenticatorId", authenticatorId); + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.clearCredentials", dict); + return methodResult; + } + + partial void ValidateSetUserVerified(string authenticatorId, bool isUserVerified); + /// + /// Sets whether User Verification succeeds or fails for an authenticator. + /// The default is true. + /// + /// authenticatorId + /// isUserVerified + /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> + public async System.Threading.Tasks.Task SetUserVerifiedAsync(string authenticatorId, bool isUserVerified) + { + ValidateSetUserVerified(authenticatorId, isUserVerified); + var dict = new System.Collections.Generic.Dictionary(); + dict.Add("authenticatorId", authenticatorId); + dict.Add("isUserVerified", isUserVerified); + var methodResult = await _client.ExecuteDevToolsMethodAsync("WebAuthn.setUserVerified", dict); + return methodResult; + } + } +} \ No newline at end of file diff --git a/CefSharp/DevToolsExtensions.cs b/CefSharp/DevToolsExtensions.cs index c53e82abfc..7ef01507bb 100644 --- a/CefSharp/DevToolsExtensions.cs +++ b/CefSharp/DevToolsExtensions.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Threading.Tasks; +using CefSharp.DevTools; using CefSharp.Internals; using CefSharp.Web; @@ -100,5 +101,38 @@ public static Task ExecuteDevToolsMethodAsync(this IWebBrowser chromiumWebB return browser.ExecuteDevToolsMethodAsync(messageId, method, parameters); } + + /// + /// Gets a new Instance of the DevTools client for the chromiumWebBrowser + /// instance. + /// + /// the chromiumWebBrowser instance + /// DevToolsClient + public static DevToolsClient GetDevToolsClient(this IWebBrowser chromiumWebBrowser) + { + var browser = chromiumWebBrowser.GetBrowser(); + + return browser.GetDevToolsClient(); + } + + /// + /// Gets a new Instance of the DevTools client + /// + /// the IBrowser instance + /// DevToolsClient + public static DevToolsClient GetDevToolsClient(this IBrowser browser) + { + var browserHost = browser.GetHost(); + + WebBrowserExtensions.ThrowExceptionIfBrowserHostNull(browserHost); + + var devToolsClient = new DevToolsClient(browser); + + var observerRegistration = browserHost.AddDevToolsMessageObserver(devToolsClient); + + devToolsClient.SetDevToolsObserverRegistration(observerRegistration); + + return devToolsClient; + } } } diff --git a/CefSharp/Internals/Tasks/SyncContextTaskCompletionSource.cs b/CefSharp/Internals/Tasks/SyncContextTaskCompletionSource.cs new file mode 100644 index 0000000000..111358c32c --- /dev/null +++ b/CefSharp/Internals/Tasks/SyncContextTaskCompletionSource.cs @@ -0,0 +1,25 @@ +// Copyright © 2020 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.Threading; +using System.Threading.Tasks; + +namespace CefSharp.Internals.Tasks +{ + /// + /// TaskCompletionSource that executes it's continuation on the captured + /// . If is null. + /// then the current **executing** thread will be called. e.g. The thread that + /// called + /// (or other Set/Try set methods). + /// + /// Result Type + public class SyncContextTaskCompletionSource : TaskCompletionSource + { + /// + /// Captured Sync Context + /// + public SynchronizationContext SyncContext { get; set; } + } +}