1/*
2    Copyright (C) 2012 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.1 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_custom_handler_private.h"
22
23#if ENABLE(NAVIGATOR_CONTENT_UTILS)
24/**
25 * @internal
26 * Register a scheme handler.
27 *
28 * @param data Data of the handler including the protocol and the handler url.
29 *
30 * Emits signal: "protocolhandler,registration,requested" on View with a pointer to Ewk_Custom_Handler_Data.
31 */
32bool ewk_custom_handler_register_protocol_handler(Ewk_Custom_Handler_Data* data)
33{
34    EINA_SAFETY_ON_NULL_RETURN_VAL(data->ewkView, false);
35    evas_object_smart_callback_call(data->ewkView, "protocolhandler,registration,requested", data);
36    return true;
37}
38
39#if ENABLE(CUSTOM_SCHEME_HANDLER)
40/**
41 * @internal
42 * Query whether the handler is registered or not.
43 *
44 * @param data Data of the handler including the protocol and the handler url.
45 *
46 * Emits signal: "protocolhandler,isregistered" on View with a pointer to Ewk_Custom_Handler_Data.
47 */
48Ewk_Custom_Handlers_State ewk_custom_handler_is_protocol_handler_registered(Ewk_Custom_Handler_Data* data)
49{
50    EINA_SAFETY_ON_NULL_RETURN_VAL(data->ewkView, EWK_CUSTOM_HANDLERS_DECLINED);
51    evas_object_smart_callback_call(data->ewkView, "protocolhandler,isregistered", data);
52    Ewk_Custom_Handlers_State result = data->result;
53    return result;
54}
55
56/**
57 * @internal
58 * Remove the registered scheme handler.
59 *
60 * @param data Data of the handler including the protocol and the handler url.
61 *
62 * Emits signal: "protocolhandler,unregistration,requested" on View with a pointer to Ewk_Custom_Handler_Data.
63 */
64bool ewk_custom_handler_unregister_protocol_handler(Ewk_Custom_Handler_Data* data)
65{
66    EINA_SAFETY_ON_NULL_RETURN_VAL(data->ewkView, false);
67    evas_object_smart_callback_call(data->ewkView, "protocolhandler,unregistration,requested", data);
68    return true;
69}
70
71#endif // ENABLE(CUSTOM_SCHEME_HANDLER)
72#endif // ENABLE(NAVIGATOR_CONTENT_UTILS)
73