diff --git a/CefSharp.Core/CefSharp.Core.vcxproj b/CefSharp.Core/CefSharp.Core.vcxproj index 696e7ecac..24d695a71 100644 --- a/CefSharp.Core/CefSharp.Core.vcxproj +++ b/CefSharp.Core/CefSharp.Core.vcxproj @@ -223,7 +223,6 @@ - @@ -251,7 +250,6 @@ - diff --git a/CefSharp.Core/CefSharp.Core.vcxproj.filters b/CefSharp.Core/CefSharp.Core.vcxproj.filters index e1a242f19..2ff784837 100644 --- a/CefSharp.Core/CefSharp.Core.vcxproj.filters +++ b/CefSharp.Core/CefSharp.Core.vcxproj.filters @@ -41,9 +41,6 @@ Source Files - - Source Files - Source Files @@ -112,9 +109,6 @@ Header Files - - Header Files - Header Files diff --git a/CefSharp.Core/Internals/ClientAdapter.cpp b/CefSharp.Core/Internals/ClientAdapter.cpp index b5a2b9a0b..3af0a620b 100644 --- a/CefSharp.Core/Internals/ClientAdapter.cpp +++ b/CefSharp.Core/Internals/ClientAdapter.cpp @@ -7,13 +7,13 @@ #include "Internals/CefRequestWrapper.h" #include "Internals/CefWebPluginInfoWrapper.h" #include "Internals/JavascriptBinding/BindingHandler.h" -#include "Internals/RequestResponse.h" #include "ClientAdapter.h" #include "Cef.h" #include "DownloadAdapter.h" #include "StreamAdapter.h" using namespace std; +using namespace CefSharp; using namespace CefSharp::Internals::JavascriptBinding; namespace CefSharp diff --git a/CefSharp.Core/Internals/RequestResponse.cpp b/CefSharp.Core/Internals/RequestResponse.cpp deleted file mode 100644 index 50af436b7..000000000 --- a/CefSharp.Core/Internals/RequestResponse.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright © 2010-2014 The CefSharp Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. - -#include "Stdafx.h" -#include "RequestResponse.h" - -namespace CefSharp -{ - namespace Internals - { - void Response::Cancel() - { - _action = ResponseAction::Cancel; - } - - void Response::Redirect(String^ url) - { - _redirectUrl = url; - _action = ResponseAction::Redirect; - } - - void Response::RespondWith(Stream^ stream, String^ mimeType) - { - RespondWith(stream, mimeType, "OK", 200, nullptr); - } - - void Response::RespondWith(Stream^ stream, String^ mimeType, String^ statusText, int statusCode, NameValueCollection^ responseHeaders) - { - if (String::IsNullOrEmpty(mimeType)) - { - throw gcnew ArgumentException("must provide a mime type", "mimeType"); - } - - if (stream == nullptr) - { - throw gcnew ArgumentNullException("stream"); - } - - _responseStream = stream; - _mimeType = mimeType; - _statusText = statusText; - _statusCode = statusCode; - _responseHeaders = responseHeaders; - - _action = ResponseAction::Respond; - } - } -} \ No newline at end of file diff --git a/CefSharp.Core/Internals/RequestResponse.h b/CefSharp.Core/Internals/RequestResponse.h deleted file mode 100644 index 61ca18b9c..000000000 --- a/CefSharp.Core/Internals/RequestResponse.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright © 2010-2014 The CefSharp 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" - -using namespace System; -using namespace System::IO; -using namespace System::Collections::Specialized; -using namespace CefSharp; - -namespace CefSharp -{ - namespace Internals - { - - - private ref class Response : IResponse - { - IRequest^ _request; - Stream^ _responseStream; - String^ _mimeType; - String^ _redirectUrl; - ResponseAction _action; - String^ _statusText; - int _statusCode; - NameValueCollection^ _responseHeaders; - - internal: - Response() : _action(ResponseAction::Continue) - { - } - - property Stream^ ResponseStream { Stream^ get() { return _responseStream; } } - property String^ MimeType { String^ get() { return _mimeType; } } - property String^ StatusText { String^ get() { return _statusText; } } - property int StatusCode { int get() { return _statusCode; } } - property NameValueCollection^ ResponseHeaders { NameValueCollection^ get() { return _responseHeaders; } } - property String^ RedirectUrl { String^ get() { return _redirectUrl; } } - property ResponseAction Action { ResponseAction get() { return _action; } } - - public: - virtual void Cancel(); - virtual void Redirect(String^ url); - virtual void RespondWith(Stream^ stream, String^ mimeType); - virtual void RespondWith(Stream^ stream, String^ mimeType, String^ statusText, int statusCode, NameValueCollection^ responseHeaders); - }; - } -} \ No newline at end of file diff --git a/CefSharp/CefSharp.csproj b/CefSharp/CefSharp.csproj index 3e801345f..ebb6c69d6 100644 --- a/CefSharp/CefSharp.csproj +++ b/CefSharp/CefSharp.csproj @@ -108,6 +108,7 @@ + diff --git a/CefSharp/Response.cs b/CefSharp/Response.cs new file mode 100644 index 000000000..8471cfd1b --- /dev/null +++ b/CefSharp/Response.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Specialized; +using System.IO; + +namespace CefSharp +{ + public class Response : IResponse + { + public Stream ResponseStream { get;private set; } + public String MimeType { get; private set; } + public String StatusText { get; private set; } + public int StatusCode { get; private set; } + public NameValueCollection ResponseHeaders { get; private set; } + public String RedirectUrl { get; private set; } + public ResponseAction Action { get; private set; } + + public Response() + { + Action = ResponseAction.Continue; + } + + public void Cancel() + { + Action = ResponseAction.Cancel; + } + + public void Redirect(String url) + { + RedirectUrl = url; + Action = ResponseAction.Redirect; + } + + public void RespondWith(Stream stream, String mimeType) + { + RespondWith(stream, mimeType, "OK", 200, null); + } + + public void RespondWith(Stream stream, String mimeType, String statusText, int statusCode, NameValueCollection responseHeaders) + { + if (string.IsNullOrEmpty(mimeType)) + { + throw new ArgumentException("must provide a mime type", "mimeType"); + } + + if (stream == null) + { + throw new ArgumentNullException("stream"); + } + + ResponseStream = stream; + MimeType = mimeType; + StatusText = statusText; + StatusCode = statusCode; + ResponseHeaders = responseHeaders; + + Action = ResponseAction.Respond; + } + } +}