Create string tightly when retrive string from cbhm callback event
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / ewk_intent_service.cpp
1 /*
2  * Copyright (C) 2012 Intel Corporation. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "ewk_intent_service.h"
28
29 #include "IntentServiceInfo.h"
30 #include "WKAPICast.h"
31 #include "WKRetainPtr.h"
32 #include "WKURL.h"
33 #include "ewk_intent_service_private.h"
34 #include <wtf/text/CString.h>
35
36 using namespace WebKit;
37
38 #if ENABLE(WEB_INTENTS_TAG)
39 Ewk_Intent_Service::Ewk_Intent_Service(WKIntentServiceInfoRef serviceRef)
40     : m_action(AdoptWK, WKIntentServiceInfoCopyAction(serviceRef))
41     , m_type(AdoptWK, WKIntentServiceInfoCopyType(serviceRef))
42     , m_href(AdoptWK, WKIntentServiceInfoCopyHref(serviceRef))
43     , m_title(AdoptWK, WKIntentServiceInfoCopyTitle(serviceRef))
44     , m_disposition(AdoptWK, WKIntentServiceInfoCopyDisposition(serviceRef))
45 { }
46
47 const char* Ewk_Intent_Service::action() const
48 {
49     return m_action;
50 }
51
52 const char* Ewk_Intent_Service::type() const
53 {
54     return m_type;
55 }
56
57 const char* Ewk_Intent_Service::href() const
58 {
59     return m_href;
60 }
61
62 const char* Ewk_Intent_Service::title() const
63 {
64     return m_title;
65 }
66
67 const char* Ewk_Intent_Service::disposition() const
68 {
69     return m_disposition;
70 }
71 #endif
72
73 Ewk_Intent_Service* ewk_intent_service_ref(Ewk_Intent_Service* service)
74 {
75 #if ENABLE(WEB_INTENTS_TAG)
76     EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
77     service->ref();
78 #endif
79
80     return service;
81 }
82
83 void ewk_intent_service_unref(Ewk_Intent_Service* service)
84 {
85 #if ENABLE(WEB_INTENTS_TAG)
86     EINA_SAFETY_ON_NULL_RETURN(service);
87
88     service->deref();
89 #endif
90 }
91
92 const char* ewk_intent_service_action_get(const Ewk_Intent_Service* service)
93 {
94     EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
95
96 #if ENABLE(WEB_INTENTS_TAG)
97     return service->action();
98 #else
99     return 0;
100 #endif
101 }
102
103 const char* ewk_intent_service_type_get(const Ewk_Intent_Service* service)
104 {
105     EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
106
107 #if ENABLE(WEB_INTENTS_TAG)
108     return service->type();
109 #else
110     return 0;
111 #endif
112 }
113
114 const char* ewk_intent_service_href_get(const Ewk_Intent_Service* service)
115 {
116     EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
117
118 #if ENABLE(WEB_INTENTS_TAG)
119     return service->href();
120 #else
121     return 0;
122 #endif
123 }
124
125 const char* ewk_intent_service_title_get(const Ewk_Intent_Service* service)
126 {
127     EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
128
129 #if ENABLE(WEB_INTENTS_TAG)
130     return service->title();
131 #else
132     return 0;
133 #endif
134 }
135
136 const char* ewk_intent_service_disposition_get(const Ewk_Intent_Service* service)
137 {
138     EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
139
140 #if ENABLE(WEB_INTENTS_TAG)
141     return service->disposition();
142 #else
143     return 0;
144 #endif
145 }