UIProcess/API/efl/ewk_view_notification_provider.cpp
UIProcess/API/efl/ewk_view_tizen_client.cpp
UIProcess/API/efl/ewk_view_ui_client.cpp
+ UIProcess/API/efl/ewk_web_application_icon_data.cpp
UIProcess/API/efl/tizen/ClipboardHelper.cpp
UIProcess/API/efl/tizen/Drag.cpp
#endif
}
+void WKPageGetWebAppIconURLs(WKPageRef page, void* context, WKPageGetWebAppIconURLsFunction callback)
+{
+#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+ toImpl(page)->getWebAppIconURLs(DictionaryCallback::create(context, callback));
+#endif
+}
+
void WKPageExecuteCommandWithArgument(WKPageRef page, WKStringRef command, WKStringRef argument)
{
toImpl(page)->executeEditCommandWithArgument(toImpl(command)->string(), toImpl(argument)->string());
WK_EXPORT void WKPageGetWebAppCapable(WKPageRef page, void* context, WKPageGetWebAppCapableFunction function);
typedef void (*WKPageGetWebAppIconURLFunction)(WKStringRef iconURL, WKErrorRef, void*);
WK_EXPORT void WKPageGetWebAppIconURL(WKPageRef page, void* context, WKPageGetWebAppIconURLFunction function);
+typedef void (*WKPageGetWebAppIconURLsFunction)(WKDictionaryRef iconURLs, WKErrorRef, void*);
+WK_EXPORT void WKPageGetWebAppIconURLs(WKPageRef page, void* context, WKPageGetWebAppIconURLsFunction function);
// #endif
WK_EXPORT void WKPageExecuteCommandWithArgument(WKPageRef page, WKStringRef command, WKStringRef argument);
#include "ewk_text_checker.h"
#include "ewk_text_style.h"
#include "ewk_user_media.h"
+#include "ewk_web_application_icon_data.h"
#endif // EWebKit2_h
#include <WebCore/ContentSecurityPolicy.h>
#endif
+#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+#include "WKDictionary.h"
+#include "ewk_web_application_icon_data_private.h"
+#endif
+
#endif // #if OS(TIZEN)
using namespace WebKit;
const char* encoding;
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
const char* webAppIconURL;
+ Eina_List* webAppIconURLs;
#endif
OwnPtr<Ewk_View_Callback_Context> alertContext;
union {
Ewk_Web_App_Capable_Get_Callback webAppCapableCallback;
Ewk_Web_App_Icon_URL_Get_Callback webAppIconURLCallback;
+ Ewk_Web_App_Icon_URLs_Get_Callback webAppIconURLsCallback;
#if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
Ewk_Web_Storage_Quota_Get_Callback webStorageQuotaCallback;
#endif
eina_stringshare_del(priv->encoding);
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
eina_stringshare_del(priv->webAppIconURL);
+ if (priv->webAppIconURLs) {
+ void* data = 0;
+ EINA_LIST_FREE(priv->webAppIconURLs, data)
+ ewkWebAppIconDataDelete(static_cast<Ewk_Web_App_Icon_Data*>(data));
+ }
#endif
if (priv->authChallenge)
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
bool ewkViewGetStandaloneStatus(Evas_Object* ewkView)
{
+ TIZEN_LOGI("webapp,metatag,standalone");
bool standalone = true;
evas_object_smart_callback_call(ewkView, "webapp,metatag,standalone", (void*)&standalone);
return standalone;
ASSERT(webAppContext->webAppCapableCallback);
+ TIZEN_LOGI("webAppCapableCallback exist. capable(%b)", capable);
if (capable)
webAppContext->webAppCapableCallback(toImpl(capable)->value(), webAppContext->userData);
else
delete webAppContext;
}
+
+static void didGetWebAppIconURLs(WKDictionaryRef iconURLs, WKErrorRef, void* context)
+{
+ EINA_SAFETY_ON_NULL_RETURN(iconURLs);
+ EINA_SAFETY_ON_NULL_RETURN(context);
+
+ Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
+
+ EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+ ASSERT(webAppContext->webAppIconURLsCallback);
+
+ if (priv->webAppIconURLs) {
+ void* data = 0;
+ EINA_LIST_FREE(priv->webAppIconURLs, data)
+ ewkWebAppIconDataDelete(static_cast<Ewk_Web_App_Icon_Data*>(data));
+ }
+
+ WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(iconURLs));
+ size_t iconURLCount = WKArrayGetSize(wkKeys.get());
+ for (size_t i = 0; i < iconURLCount; i++) {
+ WKStringRef urlRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i));
+ WKStringRef sizeRef = static_cast<WKStringRef>(WKDictionaryGetItemForKey(iconURLs, urlRef));
+ priv->webAppIconURLs = eina_list_append(priv->webAppIconURLs, ewkWebAppIconDataCreate(sizeRef, urlRef));
+ }
+ TIZEN_LOGI("webAppIconURLsCallback exist. found %d icon urls", iconURLCount);
+
+ webAppContext->webAppIconURLsCallback(priv->webAppIconURLs, webAppContext->userData);
+ delete webAppContext;
+}
#endif
Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App_Capable_Get_Callback callback, void* userData)
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+ TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
context->webAppCapableCallback = callback;
context->ewkView = ewkView;
#endif
}
+Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URLs_Get_Callback callback, void* userData)
+{
+#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+ EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+
+ TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
+ Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
+ context->webAppIconURLsCallback = callback;
+ context->ewkView = ewkView;
+ context->userData = userData;
+
+ WKPageGetWebAppIconURLs(toAPI(priv->pageClient->page()), context, didGetWebAppIconURLs);
+
+ return true;
+#else
+ UNUSED_PARAM(ewkView);
+ UNUSED_PARAM(callback);
+ UNUSED_PARAM(userData);
+ return 0;
+#endif
+}
+
Eina_Bool ewk_view_command_execute(Evas_Object* ewkView, const char* command, const char* value)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
#include "ewk_enums.h"
//#endif
+// #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+#include "ewk_web_application_icon_data.h"
+// #endif
+
#ifdef __cplusplus
extern "C" {
#endif
* @param user_data user_data will be passsed when ewk_view_web_app_icon_get is called
*/
typedef void (*Ewk_Web_App_Icon_URL_Get_Callback)(const char* icon_url, void* user_data);
+
+/**
+ * Callback for ewk_view_web_app_icon_urls_get.
+ *
+ * @param icon_urls list of Ewk_Web_App_Icon_Data for web app
+ * @param user_data user_data will be passsed when ewk_view_web_app_icon_urls_get is called
+ */
+typedef void (*Ewk_Web_App_Icon_URLs_Get_Callback)(Eina_List *icon_urls, void *user_data);
// #endif
/**
EAPI Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* o, Ewk_Web_App_Icon_URL_Get_Callback callback, void* user_data);
/**
+ * Requests for getting web application icon list of Ewk_Web_App_Icon_Data.
+ *
+ * @param callback result callback to get web application icon urls
+ * @param user_data user_data will be passed when result_callback is called
+ * -I.e., user data will be kept until callback is called
+ *
+ * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object *o, Ewk_Web_App_Icon_URLs_Get_Callback callback, void *user_data);
+
+/**
* Executes editor command.
*
* @param o view object to execute command
--- /dev/null
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "ewk_web_application_icon_data.h"
+
+#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+#include "WKString.h"
+#include <Eina.h>
+
+struct _Ewk_Web_App_Icon_Data {
+ CString size;
+ CString url;
+
+ _Ewk_Web_App_Icon_Data(WKStringRef sizeRef, WKStringRef urlRef)
+ {
+ size = toImpl(sizeRef)->string().utf8();
+ url = toImpl(urlRef)->string().utf8();
+ }
+};
+
+Ewk_Web_App_Icon_Data* ewkWebAppIconDataCreate(WKStringRef sizeRef, WKStringRef urlRef)
+{
+ return new Ewk_Web_App_Icon_Data(sizeRef, urlRef);
+}
+
+void ewkWebAppIconDataDelete(Ewk_Web_App_Icon_Data* iconData)
+{
+ delete iconData;
+}
+#endif
+
+EAPI const char* ewk_web_application_icon_data_size_get(Ewk_Web_App_Icon_Data* data)
+{
+#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+ EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
+
+ TIZEN_LOGI("size: %s", data->size.data());
+ return data->size.data();
+#else
+ UNUSED_PARAM(data);
+#endif
+}
+
+EAPI const char* ewk_web_application_icon_data_url_get(Ewk_Web_App_Icon_Data* data)
+{
+#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+ EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
+
+ TIZEN_LOGI("url: %s", data->url.data());
+ return data->url.data();
+#else
+ UNUSED_PARAM(data);
+#endif
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ewk_web_application_icon_data_h
+#define ewk_web_application_icon_data_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// Creates a type name for _Ewk_Web_App_Icon_Data.
+typedef struct _Ewk_Web_App_Icon_Data Ewk_Web_App_Icon_Data;
+
+/**
+ * Requests for getting icon size string of Ewk_Web_App_Icon_Data.
+ *
+ * @param icon_data Ewk_Web_App_Icon_Data object to get icon size
+ *
+ * @return icon size string of requested icon data
+ */
+EAPI const char *ewk_web_application_icon_data_size_get(Ewk_Web_App_Icon_Data *data);
+
+/**
+ * Requests for getting icon url string of Ewk_Web_App_Icon_Data.
+ *
+ * @param icon_data Ewk_Web_App_Icon_Data object to get icon url
+ *
+ * @return icon url string of requested icon data
+ */
+EAPI const char *ewk_web_application_icon_data_url_get(Ewk_Web_App_Icon_Data *data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // ewk_web_application_icon_data_h
--- /dev/null
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ewk_web_application_icon_data_private_h
+#define ewk_web_application_icon_data_private_h
+
+#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+#include <WebKit2/WKBase.h>
+
+/// Creates a type name for _Ewk_Web_App_Icon_Data.
+typedef struct _Ewk_Web_App_Icon_Data Ewk_Web_App_Icon_Data;
+
+Ewk_Web_App_Icon_Data* ewkWebAppIconDataCreate(WKStringRef iconSize, WKStringRef iconURL);
+void ewkWebAppIconDataDelete(Ewk_Web_App_Icon_Data* iconData);
+
+#endif // ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+
+#endif // ewk_web_application_icon_data_private_h
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
invalidateCallbackMap(m_booleanCallbacks);
+ invalidateCallbackMap(m_dictionaryCallbacks);
#endif
invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
void WebPageProxy::didGetWebAppCapable(const bool capable, uint64_t callbackID)
{
RefPtr<BooleanCallback> callback = m_booleanCallbacks.take(callbackID);
- if (!callback) {
- // FIXME: Log error or assert.
- // this can validly happen if a load invalidated the callback, though
- return;
- }
-
m_booleanCallbacks.remove(callbackID);
callback->performCallbackWithReturnValue(WebBoolean::create(capable).leakRef());
}
m_stringCallbacks.remove(callbackID);
callback->performCallbackWithReturnValue(iconURL.impl());
}
+
+void WebPageProxy::getWebAppIconURLs(PassRefPtr<DictionaryCallback> prpCallback)
+{
+ RefPtr<DictionaryCallback> callback = prpCallback;
+ if (!isValid()) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_dictionaryCallbacks.set(callbackID, callback.get());
+ process()->send(Messages::WebPage::GetWebAppIconURLs(callbackID), m_pageID);
+}
+
+void WebPageProxy::didGetWebAppIconURLs(const StringPairVector& iconURLs, uint64_t callbackID)
+{
+ RefPtr<DictionaryCallback> callback = m_dictionaryCallbacks.take(callbackID);
+ ImmutableDictionary::MapType iconURLList;
+ size_t iconURLCount = iconURLs.stringPairVector().size();
+ for (size_t i = 0; i < iconURLCount; ++i)
+ iconURLList.set(iconURLs.stringPairVector()[i].first, WebString::create(iconURLs.stringPairVector()[i].second));
+
+ callback->performCallbackWithReturnValue(ImmutableDictionary::adopt(iconURLList).get());
+}
#endif
void WebPageProxy::setMediaVolume(float volume)
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
invalidateCallbackMap(m_booleanCallbacks);
+ invalidateCallbackMap(m_dictionaryCallbacks);
#endif
invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
typedef GenericCallback<WKSerializedScriptValueRef, WebSerializedScriptValue*> ScriptValueCallback;
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
typedef GenericCallback<WKBooleanRef> BooleanCallback;
+typedef GenericCallback<WKDictionaryRef> DictionaryCallback;
#endif
#if ENABLE(TIZEN_WEB_STORAGE)
#if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
void getStandaloneStatus(bool& standalone);
void getWebAppCapable(PassRefPtr<BooleanCallback>);
void getWebAppIconURL(PassRefPtr<StringCallback>);
+ void getWebAppIconURLs(PassRefPtr<DictionaryCallback>);
#endif
void setMediaVolume(float);
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
void didGetWebAppCapable(const bool capable, uint64_t callbackID);
void didGetWebAppIconURL(const String& iconURL, uint64_t callbackID);
+ void didGetWebAppIconURLs(const StringPairVector& iconURLs, uint64_t callbackID);
#endif
#if ENABLE(TIZEN_ICON_DATABASE)
void didReceiveIcon();
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
HashMap<uint64_t, RefPtr<BooleanCallback> > m_booleanCallbacks;
+ HashMap<uint64_t, RefPtr<DictionaryCallback> > m_dictionaryCallbacks;
#endif
HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks;
HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks;
GetStandaloneStatus() -> (bool standalone)
DidGetWebAppCapable(bool capable, uint64_t callbackID)
DidGetWebAppIconURL(WTF::String iconURL, uint64_t callbackID)
+ DidGetWebAppIconURLs(WebKit::StringPairVector iconURLs, uint64_t callbackID)
#endif
#if ENABLE(TIZEN_ICON_DATABASE)
send(Messages::WebPageProxy::DidGetWebAppIconURL(iconURL, callbackID));
}
+
+void WebPage::getWebAppIconURLs(uint64_t callbackID)
+{
+ RefPtr<WebCore::NodeList> nodeList = mainFrame()->document()->getElementsByTagName("link");
+ Vector<std::pair<String, String> > iconURLs;
+
+ for (unsigned i = 0; i < nodeList->length(); i++) {
+ WebCore::HTMLLinkElement* linkElement = static_cast<WebCore::HTMLLinkElement*>(nodeList->item(i));
+ if (linkElement->rel() == "apple-touch-icon" || linkElement->rel() == "apple-touch-icon-precomposed")
+ iconURLs.append(pair<String, String>(linkElement->href().string(), linkElement->iconSizes()));
+ }
+
+ send(Messages::WebPageProxy::DidGetWebAppIconURLs(iconURLs, callbackID));
+}
#endif
void WebPage::setMediaVolume(float volume)
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
void getWebAppCapable(uint64_t callbackID);
void getWebAppIconURL(uint64_t callbackID);
+ void getWebAppIconURLs(uint64_t callbackID);
#endif
void setMediaVolume(float);
#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
GetWebAppCapable(uint64_t callbackID)
GetWebAppIconURL(uint64_t callbackID)
+ GetWebAppIconURLs(uint64_t callbackID)
#endif
# Media