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_custom_handlers.h"
23 #if (ENABLE_TIZEN_REGISTER_PROTOCOL_HANDLER) || (ENABLE_TIZEN_REGISTER_CONTENT_HANDLER) || (ENABLE_TIZEN_CUSTOM_SCHEME_HANDLER)
24 #include "ewk_view_private.h"
26 struct _Ewk_Custom_Handlers_Data {
31 Ewk_Custom_Handlers_State result;
34 const char* ewk_custom_handlers_data_target_get(Ewk_Custom_Handlers_Data* customHandlersData)
36 EINA_SAFETY_ON_NULL_RETURN_VAL(customHandlersData, 0);
38 return customHandlersData->target;
41 const char* ewk_custom_handlers_data_base_url_get(Ewk_Custom_Handlers_Data* customHandlersData)
43 EINA_SAFETY_ON_NULL_RETURN_VAL(customHandlersData, 0);
45 return customHandlersData->base_url;
48 const char* ewk_custom_handlers_data_url_get(Ewk_Custom_Handlers_Data* customHandlersData)
50 EINA_SAFETY_ON_NULL_RETURN_VAL(customHandlersData, 0);
52 return customHandlersData->url;
55 const char* ewk_custom_handlers_data_title_get(Ewk_Custom_Handlers_Data* customHandlersData)
57 EINA_SAFETY_ON_NULL_RETURN_VAL(customHandlersData, 0);
59 return customHandlersData->title;
62 void ewk_custom_handlers_data_result_set(Ewk_Custom_Handlers_Data* customHandlersData, Ewk_Custom_Handlers_State result)
64 EINA_SAFETY_ON_NULL_RETURN(customHandlersData);
66 customHandlersData->result = result;
69 Ewk_Custom_Handlers_State ewkGetCustomHandlersDataResult(Ewk_Custom_Handlers_Data* customHandlersData)
71 EINA_SAFETY_ON_NULL_RETURN_VAL(customHandlersData, EWK_CUSTOM_HANDLERS_DECLINED);
73 return customHandlersData->result;
76 Ewk_Custom_Handlers_Data* ewkCustomHandlersCreateData(const char* target, const char* baseUrl, const char* url, const char* title)
78 Ewk_Custom_Handlers_Data* customHandlersData = new Ewk_Custom_Handlers_Data;
79 customHandlersData->target = eina_stringshare_add(target);
80 customHandlersData->base_url = eina_stringshare_add(baseUrl);
81 customHandlersData->url = eina_stringshare_add(url);
82 customHandlersData->title = eina_stringshare_add(title);
84 return customHandlersData;
87 Ewk_Custom_Handlers_Data* ewkCustomHandlersCreateData(const char* target, const char* baseUrl, const char* url)
89 Ewk_Custom_Handlers_Data* customHandlersData = new Ewk_Custom_Handlers_Data;
90 customHandlersData->target = eina_stringshare_add(target);
91 customHandlersData->base_url = eina_stringshare_add(baseUrl);
92 customHandlersData->url = eina_stringshare_add(url);
93 customHandlersData->title = 0;
95 return customHandlersData;
98 void ewkCustomHandlersDeleteData(Ewk_Custom_Handlers_Data* customHandlersData)
100 eina_stringshare_del(customHandlersData->target);
101 eina_stringshare_del(customHandlersData->base_url);
102 eina_stringshare_del(customHandlersData->url);
103 if(customHandlersData->title)
104 eina_stringshare_del(customHandlersData->title);
105 delete customHandlersData;
107 #endif // #if (ENABLE_TIZEN_REGISTER_PROTOCOL_HANDLER) || (ENABLE_TIZEN_REGISTER_CONTENT_HANDLER) || (ENABLE_TIZEN_CUSTOM_SCHEME_HANDLER)