From 6af44d7777bf7aa456d02aeffdd3fd546835d4ec Mon Sep 17 00:00:00 2001 From: amaitland Date: Sat, 23 Nov 2019 15:21:18 +1000 Subject: [PATCH] Core - Add IRequest.PostData setter can be used with the new PostData public class request.PostData = new PostData(); --- CefSharp.Core/PostData.h | 9 +++++++++ CefSharp.Core/Request.cpp | 9 +++++++++ CefSharp.Core/Request.h | 2 +- CefSharp/IPostData.cs | 2 +- CefSharp/IRequest.cs | 2 +- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CefSharp.Core/PostData.h b/CefSharp.Core/PostData.h index 814e6c53f..2f4c8d696 100644 --- a/CefSharp.Core/PostData.h +++ b/CefSharp.Core/PostData.h @@ -175,5 +175,14 @@ namespace CefSharp throw gcnew Exception(gcnew String(L"This IPostDataWrapper is readonly and cannot be modified.")); } } + + operator CefRefPtr() + { + if (this == nullptr) + { + return NULL; + } + return _postData.get(); + } }; } diff --git a/CefSharp.Core/Request.cpp b/CefSharp.Core/Request.cpp index 2a0b5e757..ca1e61b84 100644 --- a/CefSharp.Core/Request.cpp +++ b/CefSharp.Core/Request.cpp @@ -168,6 +168,15 @@ namespace CefSharp return _postData; } + void Request::PostData::set(IPostData^ postData) + { + ThrowIfDisposed(); + + ThrowIfReadOnly(); + + _request->SetPostData((CefSharp::PostData^)postData); + } + bool Request::IsReadOnly::get() { ThrowIfDisposed(); diff --git a/CefSharp.Core/Request.h b/CefSharp.Core/Request.h index 2e19b6ccd..ab1f7c0ec 100644 --- a/CefSharp.Core/Request.h +++ b/CefSharp.Core/Request.h @@ -53,7 +53,7 @@ namespace CefSharp virtual property ReferrerPolicy ReferrerPolicy { CefSharp::ReferrerPolicy get(); } virtual property NameValueCollection^ Headers { NameValueCollection^ get(); void set(NameValueCollection^ url); } virtual property TransitionType TransitionType { CefSharp::TransitionType get(); } - virtual property IPostData^ PostData { IPostData^ get(); } + virtual property IPostData^ PostData { IPostData^ get(); void set(IPostData^ postData); } virtual property bool IsReadOnly { bool get(); } virtual void InitializePostData(); diff --git a/CefSharp/IPostData.cs b/CefSharp/IPostData.cs index d44d3cd3c..26455fad1 100644 --- a/CefSharp/IPostData.cs +++ b/CefSharp/IPostData.cs @@ -49,7 +49,7 @@ namespace CefSharp /// /// Create a new instance /// - /// + /// PostDataElement IPostDataElement CreatePostDataElement(); /// diff --git a/CefSharp/IRequest.cs b/CefSharp/IRequest.cs index 4bc1511f3..27dfe3396 100644 --- a/CefSharp/IRequest.cs +++ b/CefSharp/IRequest.cs @@ -86,7 +86,7 @@ namespace CefSharp /// /// Post data /// - IPostData PostData { get; } + IPostData PostData { get; set; } /// /// Get the transition type for this request.