Move backend-specific wxWebRequest headers to private subdirs
There is no need to make these headers public and keeping them private will allow making backwards-incompatible changes to them in the future.
This commit is contained in:
112
include/wx/osx/private/webrequest_urlsession.h
Normal file
112
include/wx/osx/private/webrequest_urlsession.h
Normal file
@@ -0,0 +1,112 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/webrequest_urlsession.h
|
||||
// Purpose: wxWebRequest implementation using URLSession
|
||||
// Author: Tobias Taschner
|
||||
// Created: 2018-10-25
|
||||
// Copyright: (c) 2018 wxWidgets development team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OSX_WEBREQUEST_URLSESSION_H
|
||||
#define _WX_OSX_WEBREQUEST_URLSESSION_H
|
||||
|
||||
#if wxUSE_WEBREQUEST_URLSESSION
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSURLSession);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSURLSessionTask);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(wxWebSessionDelegate);
|
||||
|
||||
class wxWebSessionURLSession;
|
||||
class wxWebResponseURLSession;
|
||||
|
||||
class WXDLLIMPEXP_NET wxWebResponseURLSession : public wxWebResponse
|
||||
{
|
||||
public:
|
||||
wxWebResponseURLSession(wxWebRequest& request, WX_NSURLSessionTask task);
|
||||
|
||||
~wxWebResponseURLSession();
|
||||
|
||||
wxInt64 GetContentLength() const wxOVERRIDE;
|
||||
|
||||
wxString GetURL() const wxOVERRIDE;
|
||||
|
||||
wxString GetHeader(const wxString& name) const wxOVERRIDE;
|
||||
|
||||
int GetStatus() const wxOVERRIDE;
|
||||
|
||||
wxString GetStatusText() const wxOVERRIDE;
|
||||
|
||||
wxString GetSuggestedFileName() const wxOVERRIDE;
|
||||
|
||||
void HandleData(WX_NSData data);
|
||||
|
||||
private:
|
||||
WX_NSURLSessionTask m_task;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_NET wxWebRequestURLSession : public wxWebRequest
|
||||
{
|
||||
public:
|
||||
wxWebRequestURLSession(wxWebSessionURLSession& session, const wxString& url, int id);
|
||||
|
||||
~wxWebRequestURLSession();
|
||||
|
||||
void Start() wxOVERRIDE;
|
||||
|
||||
void Cancel() wxOVERRIDE;
|
||||
|
||||
wxWebResponse* GetResponse() const wxOVERRIDE
|
||||
{ return m_response.get(); }
|
||||
|
||||
wxWebAuthChallenge* GetAuthChallenge() const wxOVERRIDE;
|
||||
|
||||
wxFileOffset GetBytesSent() const wxOVERRIDE;
|
||||
|
||||
wxFileOffset GetBytesExpectedToSend() const wxOVERRIDE;
|
||||
|
||||
wxFileOffset GetBytesReceived() const wxOVERRIDE;
|
||||
|
||||
wxFileOffset GetBytesExpectedToReceive() const wxOVERRIDE;
|
||||
|
||||
void HandleCompletion();
|
||||
|
||||
private:
|
||||
wxString m_url;
|
||||
WX_NSURLSessionTask m_task;
|
||||
wxScopedPtr<wxWebResponseURLSession> m_response;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebRequestURLSession);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_NET wxWebSessionURLSession : public wxWebSession
|
||||
{
|
||||
public:
|
||||
wxWebSessionURLSession();
|
||||
|
||||
~wxWebSessionURLSession();
|
||||
|
||||
wxWebRequest* CreateRequest(const wxString& url, int id = wxID_ANY) wxOVERRIDE;
|
||||
|
||||
wxVersionInfo GetLibraryVersionInfo() wxOVERRIDE;
|
||||
|
||||
WX_NSURLSession GetSession() { return m_session; }
|
||||
|
||||
WX_wxWebSessionDelegate GetDelegate() { return m_delegate; }
|
||||
|
||||
private:
|
||||
WX_NSURLSession m_session;
|
||||
WX_wxWebSessionDelegate m_delegate;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebSessionURLSession);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_NET wxWebSessionFactoryURLSession : public wxWebSessionFactory
|
||||
{
|
||||
public:
|
||||
wxWebSession* Create() wxOVERRIDE
|
||||
{ return new wxWebSessionURLSession(); }
|
||||
};
|
||||
|
||||
#endif // wxUSE_WEBREQUEST_URLSESSION
|
||||
|
||||
#endif // _WX_OSX_WEBREQUEST_URLSESSION_H
|
Reference in New Issue
Block a user