Create string tightly when retrive string from cbhm callback event
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / ewk_web_application_icon_data.cpp
1 /*
2  * Copyright (C) 2013 Samsung Electronics
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #include "config.h"
21 #include "ewk_web_application_icon_data.h"
22
23 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
24 #include "WKString.h"
25 #include <Eina.h>
26
27 struct _Ewk_Web_App_Icon_Data {
28     CString size;
29     CString url;
30
31     _Ewk_Web_App_Icon_Data(WKStringRef sizeRef, WKStringRef urlRef)
32     {
33         size = toImpl(sizeRef)->string().utf8();
34         url = toImpl(urlRef)->string().utf8();
35     }
36 };
37
38 Ewk_Web_App_Icon_Data* ewkWebAppIconDataCreate(WKStringRef sizeRef, WKStringRef urlRef)
39 {
40     return new Ewk_Web_App_Icon_Data(sizeRef, urlRef);
41 }
42
43 void ewkWebAppIconDataDelete(Ewk_Web_App_Icon_Data* iconData)
44 {
45     delete iconData;
46 }
47 #endif
48
49 EAPI const char* ewk_web_application_icon_data_size_get(Ewk_Web_App_Icon_Data* data)
50 {
51 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
52     EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
53
54     TIZEN_LOGI("size: %s", data->size.data());
55     return data->size.data();
56 #else
57     UNUSED_PARAM(data);
58 #endif
59 }
60
61 EAPI const char* ewk_web_application_icon_data_url_get(Ewk_Web_App_Icon_Data* data)
62 {
63 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
64     EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
65
66     TIZEN_LOGI("url: %s", data->url.data());
67     return data->url.data();
68 #else
69     UNUSED_PARAM(data);
70 #endif
71 }