2 Copyright (C) 2012 Samsung Electronics
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #include "ewk_security_origin.h"
24 #include "WKAPICast.h"
25 #include "WebSecurityOrigin.h"
26 #include "ewk_view_private.h"
27 #include <wtf/text/CString.h>
29 struct _Ewk_Security_Origin {
35 using namespace WebKit;
37 Ewk_Security_Origin* createSecurityOrigin(WKSecurityOriginRef securityOrigin)
39 Ewk_Security_Origin* origin = new Ewk_Security_Origin();
41 origin->host = eina_stringshare_add(toImpl(securityOrigin)->host().utf8().data());
42 origin->protocol = eina_stringshare_add(toImpl(securityOrigin)->protocol().utf8().data());
43 origin->port = toImpl(securityOrigin)->port();
48 void deleteSecurityOrigin(Ewk_Security_Origin* origin)
50 eina_stringshare_del(origin->host);
51 eina_stringshare_del(origin->protocol);
55 const char* ewk_security_origin_host_get(const Ewk_Security_Origin* origin)
57 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
62 const char* ewk_security_origin_protocol_get(const Ewk_Security_Origin* origin)
64 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
65 TIZEN_LOGI("protocol (%s)", origin->protocol);
67 return origin->protocol;
70 uint16_t ewk_security_origin_port_get(const Ewk_Security_Origin* origin)
72 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
73 TIZEN_LOGI("port (%d)", origin->port);