mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 11:42:36 +00:00
Core - Rename CefSharp.Internals.CefPostDataWrapper to CefSharp.PostDataElement
- Make public - Added public constructor Related issue #1721
This commit is contained in:
@@ -293,7 +293,6 @@
|
||||
<ClInclude Include="Internals\CefFrameWrapper.h" />
|
||||
<ClInclude Include="Internals\CefMenuModelWrapper.h" />
|
||||
<ClInclude Include="Internals\CefPdfPrintCallbackWrapper.h" />
|
||||
<ClInclude Include="Internals\CefPostDataElementWrapper.h" />
|
||||
<ClInclude Include="Internals\CefPostDataWrapper.h" />
|
||||
<ClInclude Include="Internals\CefRegisterCdmCallbackAdapter.h" />
|
||||
<ClInclude Include="Internals\CefResolveCallbackAdapter.h" />
|
||||
@@ -307,6 +306,7 @@
|
||||
<ClInclude Include="Internals\CefWrapper.h" />
|
||||
<ClInclude Include="PopupFeatures.h" />
|
||||
<ClInclude Include="Internals\CefRequestContextHandlerAdapter.h" />
|
||||
<ClInclude Include="PostDataElement.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="WindowInfo.h" />
|
||||
<ClInclude Include="Internals\CefCompletionCallbackAdapter.h" />
|
||||
|
||||
@@ -202,9 +202,6 @@
|
||||
<ClInclude Include="Internals\CefPostDataWrapper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Internals\CefPostDataElementWrapper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Internals\JavascriptCallbackProxy.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -325,6 +322,9 @@
|
||||
<ClInclude Include="Internals\CefUrlRequestWrapper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PostDataElement.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Internals\CefSharpBrowserWrapper.h">
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
// Copyright © 2015 The CefSharp Authors. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Stdafx.h"
|
||||
|
||||
#include "include\cef_request.h"
|
||||
#include "Internals\TypeConversion.h"
|
||||
#include "CefWrapper.h"
|
||||
|
||||
using namespace System::Collections::Specialized;
|
||||
|
||||
namespace CefSharp
|
||||
{
|
||||
namespace Internals
|
||||
{
|
||||
private ref class CefPostDataElementWrapper : public IPostDataElement, public CefWrapper
|
||||
{
|
||||
MCefRefPtr<CefPostDataElement> _postDataElement;
|
||||
internal:
|
||||
CefPostDataElementWrapper(CefRefPtr<CefPostDataElement> postDataElement) :
|
||||
_postDataElement(postDataElement)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
!CefPostDataElementWrapper()
|
||||
{
|
||||
_postDataElement = nullptr;
|
||||
}
|
||||
|
||||
~CefPostDataElementWrapper()
|
||||
{
|
||||
this->!CefPostDataElementWrapper();
|
||||
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual property bool IsReadOnly
|
||||
{
|
||||
bool get()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
return _postDataElement->IsReadOnly();
|
||||
}
|
||||
}
|
||||
|
||||
virtual property String^ File
|
||||
{
|
||||
String^ get()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
return StringUtils::ToClr(_postDataElement->GetFile());
|
||||
}
|
||||
void set(String^ val)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
_postDataElement->SetToFile(StringUtils::ToNative(val));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetToEmpty()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
_postDataElement->SetToEmpty();
|
||||
}
|
||||
|
||||
virtual property PostDataElementType Type
|
||||
{
|
||||
PostDataElementType get()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
return (PostDataElementType)_postDataElement->GetType();
|
||||
}
|
||||
}
|
||||
|
||||
virtual property cli::array<Byte>^ Bytes
|
||||
{
|
||||
cli::array<Byte>^ get()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
auto byteCount = _postDataElement->GetBytesCount();
|
||||
if (byteCount == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto bytes = gcnew cli::array<Byte>(byteCount);
|
||||
pin_ptr<Byte> src = &bytes[0]; // pin pointer to first element in arr
|
||||
|
||||
_postDataElement->GetBytes(byteCount, static_cast<void*>(src));
|
||||
|
||||
return bytes;
|
||||
}
|
||||
void set(cli::array<Byte>^ val)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
pin_ptr<Byte> src = &val[0];
|
||||
_postDataElement->SetToBytes(val->Length, static_cast<void*>(src));
|
||||
}
|
||||
}
|
||||
|
||||
operator CefRefPtr<CefPostDataElement>()
|
||||
{
|
||||
if (this == nullptr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return _postDataElement.get();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "include\cef_request.h"
|
||||
|
||||
#include "Internals\TypeConversion.h"
|
||||
#include "CefPostDataElementWrapper.h"
|
||||
#include "PostDataElement.h"
|
||||
#include "CefWrapper.h"
|
||||
|
||||
using namespace System::Collections::Generic;
|
||||
@@ -88,7 +88,7 @@ namespace CefSharp
|
||||
{
|
||||
CefPostDataElement *el = it->get();
|
||||
|
||||
_postDataElements->Add(gcnew CefPostDataElementWrapper(el));
|
||||
_postDataElements->Add(gcnew PostDataElement(el));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace CefSharp
|
||||
|
||||
_postDataElements->Add(element);
|
||||
|
||||
auto elementWrapper = (CefPostDataElementWrapper^)element;
|
||||
auto elementWrapper = (PostDataElement^)element;
|
||||
|
||||
return _postData->AddElement(elementWrapper);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ namespace CefSharp
|
||||
|
||||
_postDataElements->Remove(element);
|
||||
|
||||
auto elementWrapper = (CefPostDataElementWrapper^)element;
|
||||
auto elementWrapper = (PostDataElement^)element;
|
||||
|
||||
return _postData->RemoveElement(elementWrapper);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ namespace CefSharp
|
||||
{
|
||||
auto element = CefPostDataElement::Create();
|
||||
|
||||
return gcnew CefPostDataElementWrapper(element);
|
||||
return gcnew PostDataElement(element);
|
||||
}
|
||||
|
||||
virtual property bool HasExcludedElements
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
// Copyright © 2015 The CefSharp Authors. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Stdafx.h"
|
||||
|
||||
#include "include\cef_request.h"
|
||||
#include "Internals\TypeConversion.h"
|
||||
#include "Internals\CefWrapper.h"
|
||||
|
||||
using namespace System::Collections::Specialized;
|
||||
|
||||
namespace CefSharp
|
||||
{
|
||||
public ref class PostDataElement : public IPostDataElement, public CefWrapper
|
||||
{
|
||||
MCefRefPtr<CefPostDataElement> _postDataElement;
|
||||
internal:
|
||||
PostDataElement(CefRefPtr<CefPostDataElement> postDataElement) :
|
||||
_postDataElement(postDataElement)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
!PostDataElement()
|
||||
{
|
||||
_postDataElement = nullptr;
|
||||
}
|
||||
|
||||
~PostDataElement()
|
||||
{
|
||||
this->!PostDataElement();
|
||||
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
public:
|
||||
PostDataElement()
|
||||
{
|
||||
_postDataElement = CefPostDataElement::Create();
|
||||
}
|
||||
|
||||
virtual property bool IsReadOnly
|
||||
{
|
||||
bool get()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
return _postDataElement->IsReadOnly();
|
||||
}
|
||||
}
|
||||
|
||||
virtual property String^ File
|
||||
{
|
||||
String^ get()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
return StringUtils::ToClr(_postDataElement->GetFile());
|
||||
}
|
||||
void set(String^ val)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
_postDataElement->SetToFile(StringUtils::ToNative(val));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetToEmpty()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
_postDataElement->SetToEmpty();
|
||||
}
|
||||
|
||||
virtual property PostDataElementType Type
|
||||
{
|
||||
PostDataElementType get()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
return (PostDataElementType)_postDataElement->GetType();
|
||||
}
|
||||
}
|
||||
|
||||
virtual property cli::array<Byte>^ Bytes
|
||||
{
|
||||
cli::array<Byte>^ get()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
auto byteCount = _postDataElement->GetBytesCount();
|
||||
if (byteCount == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto bytes = gcnew cli::array<Byte>(byteCount);
|
||||
pin_ptr<Byte> src = &bytes[0]; // pin pointer to first element in arr
|
||||
|
||||
_postDataElement->GetBytes(byteCount, static_cast<void*>(src));
|
||||
|
||||
return bytes;
|
||||
}
|
||||
void set(cli::array<Byte>^ val)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
pin_ptr<Byte> src = &val[0];
|
||||
_postDataElement->SetToBytes(val->Length, static_cast<void*>(src));
|
||||
}
|
||||
}
|
||||
|
||||
operator CefRefPtr<CefPostDataElement>()
|
||||
{
|
||||
if (this == nullptr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return _postDataElement.get();
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user