summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-21 10:57:44 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-21 10:57:44 +0200
commit5ef7c8a6a70875d4430752d146bdcb069605d71d (patch)
treef6256640b6c46d7da221435803cae65326817ba2 /Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
parentdecad929f578d8db641febc8740649ca6c574638 (diff)
downloadqtwebkit-5ef7c8a6a70875d4430752d146bdcb069605d71d.tar.gz
Imported WebKit commit 356d83016b090995d08ad568f2d2c243aa55e831 (http://svn.webkit.org/repository/webkit/trunk@126147)
New snapshot including various build fixes for newer Qt 5
Diffstat (limited to 'Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp48
1 files changed, 11 insertions, 37 deletions
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
index 856179346..ed5950311 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
@@ -29,6 +29,7 @@
#include "WKAPICast.h"
#include "WKArray.h"
#include "WKDictionary.h"
+#include "WKEinaSharedString.h"
#include "WKIntentData.h"
#include "WKRetainPtr.h"
#include "WKString.h"
@@ -47,26 +48,23 @@ struct _Ewk_Intent {
#if ENABLE(WEB_INTENTS)
WKRetainPtr<WKIntentDataRef> wkIntent;
#endif
- const char* action;
- const char* type;
- const char* service;
+ WKEinaSharedString action;
+ WKEinaSharedString type;
+ WKEinaSharedString service;
_Ewk_Intent(WKIntentDataRef intentRef)
: __ref(1)
#if ENABLE(WEB_INTENTS)
, wkIntent(intentRef)
+ , action(AdoptWK, WKIntentDataCopyAction(intentRef))
+ , type(AdoptWK, WKIntentDataCopyType(intentRef))
+ , service(AdoptWK, WKIntentDataCopyService(intentRef))
#endif
- , action(0)
- , type(0)
- , service(0)
{ }
~_Ewk_Intent()
{
ASSERT(!__ref);
- eina_stringshare_del(action);
- eina_stringshare_del(type);
- eina_stringshare_del(service);
}
};
@@ -103,47 +101,23 @@ void ewk_intent_unref(Ewk_Intent* intent)
const char* ewk_intent_action_get(const Ewk_Intent* intent)
{
-#if ENABLE(WEB_INTENTS)
- EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
-
- WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentDataCopyAction(wkIntent));
- Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
- eina_stringshare_replace(&ewkIntent->action, toImpl(wkAction.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
return intent->action;
-#else
- return 0;
-#endif
}
const char* ewk_intent_type_get(const Ewk_Intent* intent)
{
-#if ENABLE(WEB_INTENTS)
- EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
-
- WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentDataCopyType(wkIntent));
- Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
- eina_stringshare_replace(&ewkIntent->type, toImpl(wkType.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
return intent->type;
-#else
- return 0;
-#endif
}
const char* ewk_intent_service_get(const Ewk_Intent* intent)
{
-#if ENABLE(WEB_INTENTS)
- EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
-
- WKRetainPtr<WKURLRef> wkService(AdoptWK, WKIntentDataCopyService(wkIntent));
- Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
- eina_stringshare_replace(&ewkIntent->service, toImpl(wkService.get())->string().utf8().data());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
return intent->service;
-#else
- return 0;
-#endif
}
Eina_List* ewk_intent_suggestions_get(const Ewk_Intent* intent)
@@ -171,7 +145,7 @@ const char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key)
EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
WKRetainPtr<WKStringRef> keyRef = adoptWK(WKStringCreateWithUTF8CString(key));
- WKRetainPtr<WKStringRef> wkValue(AdoptWK, WKIntentDataCopyExtra(wkIntent, keyRef.get()));
+ WKRetainPtr<WKStringRef> wkValue(AdoptWK, WKIntentDataCopyExtraValue(wkIntent, keyRef.get()));
String value = toImpl(wkValue.get())->string();
if (value.isEmpty())
return 0;