[EFL][WK2] Add WKURLRequestEfl and WKURLResponseEfl

https://bugs.webkit.org/show_bug.cgi?id=70231

Patch by Keunsoon Lee <keunsoon.lee@samsung.com> on 2012-05-31
Reviewed by Chang Shu.

These codes can be used for WKPageDecidePolicyForResponseCallback on page policy callbacks.
The callback conveys WKURLResponseRef and WKURLRequestRef as parameter.

By the way, EFL browser needs content type from response to decide correct policy.
Another information, cookie, is necessary with similar reason.
But, there is no way to obtain such information on WebKit2 main stream, except for WKURLRequestCopyURL().

So, EFL port created those files to extract necessary information from WKURLResponseRef and WKURLRequestRef,
and not to desturb WebKit2 main stream.

* Shared/API/c/efl/WKURLRequestEfl.cpp: Added.
(WKURLRequestEflCopyCookies): extracting cookie information from WKURLRequestRef.
* Shared/API/c/efl/WKURLRequestEfl.h: Added.
* Shared/API/c/efl/WKURLResponseEfl.cpp: Added.
(WKURLResponseEflCopyContentType): extracting content type (i.e. MIME type) from WKURLResponseRef.
* Shared/API/c/efl/WKURLResponseEfl.h: Added.
* Shared/efl/WebCoreArgumentCodersEfl.cpp: Added.
(CoreIPC):
(CoreIPC::::encode):
(CoreIPC::::decode):
* Shared/efl/WebURLRequestEfl.cpp: Added.
(WebKit):
(WebKit::WebURLRequestEfl::WebURLRequestEfl):
(WebKit::WebURLRequestEfl::cookies): obtaining cookie information from ResourceRequest.
* Shared/efl/WebURLRequestEfl.h: Added.
(WebKit):
(WebURLRequestEfl):
(WebKit::WebURLRequestEfl::create):
* Shared/efl/WebURLResponseEfl.cpp: Added.
(WebKit):
(WebKit::WebURLResponseEfl::WebURLResponseEfl):
(WebKit::WebURLResponseEfl::contentType): obtaining content type (i.e. MIME type) from ResourceResponse.
* Shared/efl/WebURLResponseEfl.h: Added.
(WebKit):
(WebURLResponseEfl):
(WebKit::WebURLResponseEfl::create):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3c33663e
2012-05-31 Keunsoon Lee <keunsoon.lee@samsung.com>
[EFL][WK2] Add WKURLRequestEfl and WKURLResponseEfl
https://bugs.webkit.org/show_bug.cgi?id=70231
Reviewed by Chang Shu.
These codes can be used for WKPageDecidePolicyForResponseCallback on page policy callbacks.
The callback conveys WKURLResponseRef and WKURLRequestRef as parameter.
By the way, EFL browser needs content type from response to decide correct policy.
Another information, cookie, is necessary with similar reason.
But, there is no way to obtain such information on WebKit2 main stream, except for WKURLRequestCopyURL().
So, EFL port created those files to extract necessary information from WKURLResponseRef and WKURLRequestRef,
and not to desturb WebKit2 main stream.
* Shared/API/c/efl/WKURLRequestEfl.cpp: Added.
(WKURLRequestEflCopyCookies): extracting cookie information from WKURLRequestRef.
* Shared/API/c/efl/WKURLRequestEfl.h: Added.
* Shared/API/c/efl/WKURLResponseEfl.cpp: Added.
(WKURLResponseEflCopyContentType): extracting content type (i.e. MIME type) from WKURLResponseRef.
* Shared/API/c/efl/WKURLResponseEfl.h: Added.
* Shared/efl/WebCoreArgumentCodersEfl.cpp: Added.
(CoreIPC):
(CoreIPC::::encode):
(CoreIPC::::decode):
* Shared/efl/WebURLRequestEfl.cpp: Added.
(WebKit):
(WebKit::WebURLRequestEfl::WebURLRequestEfl):
(WebKit::WebURLRequestEfl::cookies): obtaining cookie information from ResourceRequest.
* Shared/efl/WebURLRequestEfl.h: Added.
(WebKit):
(WebURLRequestEfl):
(WebKit::WebURLRequestEfl::create):
* Shared/efl/WebURLResponseEfl.cpp: Added.
(WebKit):
(WebKit::WebURLResponseEfl::WebURLResponseEfl):
(WebKit::WebURLResponseEfl::contentType): obtaining content type (i.e. MIME type) from ResourceResponse.
* Shared/efl/WebURLResponseEfl.h: Added.
(WebKit):
(WebURLResponseEfl):
(WebKit::WebURLResponseEfl::create):
2012-05-31 Gyuyoung Kim <gyuyoung.kim@samsung.com>
[EFL][WK2] Rename ewk_private.h to ewk_view_private.h
......
/*
* Copyright (C) 2012 Samsung Electronics
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "WKURLRequestEfl.h"
#include "WKAPICast.h"
#include "WebURLRequestEfl.h"
using namespace WebKit;
WKStringRef WKURLRequestEflCopyCookies(WKURLRequestRef requestRef)
{
RefPtr<WebURLRequestEfl> requestEfl = WebURLRequestEfl::create(toImpl(requestRef));
return toCopiedAPI(requestEfl->cookies());
}
/*
* Copyright (C) 2012 Samsung Electronics
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef WKURLRequestEfl_h
#define WKURLRequestEfl_h
#include <WebKit2/WKBase.h>
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKStringRef WKURLRequestEflCopyCookies(WKURLRequestRef);
#ifdef __cplusplus
}
#endif
#endif /* WKURLRequestEfl_h */
/*
* Copyright (C) 2012 Samsung Electronics
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "WKURLResponseEfl.h"
#include "WKAPICast.h"
#include "WebURLResponseEfl.h"
using namespace WebKit;
WKStringRef WKURLResponseEflCopyContentType(WKURLResponseRef responseRef)
{
RefPtr<WebURLResponseEfl> responseEfl = WebURLResponseEfl::create(toImpl(responseRef));
return toCopiedAPI(responseEfl->contentType());
}
/*
* Copyright (C) 2012 Samsung Electronics
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef WKURLResponseEfl_h
#define WKURLResponseEfl_h
#include <WebKit2/WKBase.h>
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKStringRef WKURLResponseEflCopyContentType(WKURLResponseRef);
#ifdef __cplusplus
}
#endif
#endif /* WKURLResponseEfl_h */
/*
* Copyright (C) 2012 Samsung Electronics
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "WebCoreArgumentCoders.h"
#include <WebCore/ResourceError.h>
#include <WebCore/ResourceRequest.h>
#include <WebCore/ResourceResponse.h>
using namespace WebCore;
namespace CoreIPC {
void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest)
{
encoder->encode(resourceRequest.url().string());
encoder->encode(resourceRequest.httpHeaderField("Cookie"));
}
bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest)
{
ResourceRequest request;
String url;
if (!decoder->decode(url))
return false;
request.setURL(KURL(KURL(), url));
String cookie;
if (!decoder->decode(cookie))
return false;
request.setHTTPHeaderField("Cookie", cookie);
resourceRequest = request;
return true;
}
void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse)
{
encoder->encode(resourceResponse.mimeType());
}
bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse)
{
ResourceResponse response;
String mimeType;
if (!decoder->decode(mimeType))
return false;
response.setMimeType(mimeType);
resourceResponse = response;
return true;
}
void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError)
{
encoder->encode(resourceError.domain());
encoder->encode(resourceError.errorCode());
encoder->encode(resourceError.failingURL());
encoder->encode(resourceError.localizedDescription());
}
bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError)
{
String domain;
if (!decoder->decode(domain))
return false;
int errorCode;
if (!decoder->decode(errorCode))
return false;
String failingURL;
if (!decoder->decode(failingURL))
return false;
String localizedDescription;
if (!decoder->decode(localizedDescription))
return false;
resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription);
return true;
}
} // namespace CoreIPC
/*
* Copyright (C) 2012 Samsung Electronics
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "WebURLRequestEfl.h"
using namespace WebCore;
namespace WebKit {
WebURLRequestEfl::WebURLRequestEfl(const WebURLRequest* request)
: m_request(request)
{
}
const String WebURLRequestEfl::cookies() const
{
if (!m_request)
return String();
return m_request->resourceRequest().httpHeaderField("Cookie");
}
} // namespace WebKit
/*
* Copyright (C) 2012 Samsung Electronics
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef WebURLRequestEfl_h
#define WebURLRequestEfl_h
#include "WebURLRequest.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
namespace WebKit {
class WebURLRequestEfl : public RefCounted<WebURLRequestEfl> {
public:
static PassRefPtr<WebURLRequestEfl> create(const WebURLRequest* request)
{
return adoptRef(new WebURLRequestEfl(request));
}
const String cookies() const;
private:
explicit WebURLRequestEfl(const WebURLRequest*);
const WebURLRequest* m_request;
};
} // namespace WebKit
#endif // WebURLRequestEfl_h
/*
* Copyright (C) 2012 Samsung Electronics
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "WebURLResponseEfl.h"
namespace WebKit {
WebURLResponseEfl::WebURLResponseEfl(const WebURLResponse* response)
: m_response(response)
{
}
const String& WebURLResponseEfl::contentType() const
{
if (!m_response)
return String();
return m_response->resourceResponse().mimeType();
}
} // namespace WebKit
/*
* Copyright (C) 2012 Samsung Electronics
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef WebURLResponseEfl_h
#define WebURLResponseEfl_h
#include "WebURLResponse.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
namespace WebKit {
class WebURLResponseEfl : public RefCounted<WebURLResponseEfl> {
public:
static PassRefPtr<WebURLResponseEfl> create(const WebURLResponse* response)
{
return adoptRef(new WebURLResponseEfl(response));
}
const String& contentType() const;
private:
explicit WebURLResponseEfl(const WebURLResponse*);
const WebURLResponse* m_response;
};
} // namespace WebKit
#endif // WebURLResponseEfl_h
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment