diff options
Diffstat (limited to 'WebKit/efl')
-rw-r--r-- | WebKit/efl/ChangeLog | 5 | ||||
-rw-r--r-- | WebKit/efl/EWebLauncher/main.c | 1 | ||||
-rw-r--r-- | WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp | 3 | ||||
-rw-r--r-- | WebKit/efl/WebCoreSupport/ChromeClientEfl.h | 2 | ||||
-rw-r--r-- | WebKit/efl/WebCoreSupport/EditorClientEfl.cpp | 5 | ||||
-rw-r--r-- | WebKit/efl/WebCoreSupport/EditorClientEfl.h | 1 | ||||
-rw-r--r-- | WebKit/efl/ewk/EWebKit.h | 1 | ||||
-rw-r--r-- | WebKit/efl/ewk/ewk_cookies.cpp | 221 | ||||
-rw-r--r-- | WebKit/efl/ewk/ewk_cookies.h | 64 | ||||
-rw-r--r-- | WebKit/efl/ewk/ewk_view.cpp | 2 |
10 files changed, 302 insertions, 3 deletions
diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog new file mode 100644 index 0000000..b5ad1d7 --- /dev/null +++ b/WebKit/efl/ChangeLog @@ -0,0 +1,5 @@ +2010-07-16 Leandro Pereira <leandro@profusion.mobi> + + Reviewed by Gustavo Noronha Silva. + + Creating ChangeLog for the EFL port. diff --git a/WebKit/efl/EWebLauncher/main.c b/WebKit/efl/EWebLauncher/main.c index 362eefd..6980a58 100644 --- a/WebKit/efl/EWebLauncher/main.c +++ b/WebKit/efl/EWebLauncher/main.c @@ -413,6 +413,7 @@ on_viewport_changed(void* user_data, Evas_Object* webview, void* event_info) app->viewport.minScale = minScale; app->viewport.maxScale = maxScale; app->viewport.userScalable = (Eina_Bool)userScalable; + viewport_set(); } static void diff --git a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp index 342654a..4b01b75 100644 --- a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp +++ b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp @@ -437,10 +437,9 @@ void ChromeClientEfl::formStateDidChange(const Node*) notImplemented(); } -bool ChromeClientEfl::setCursor(PlatformCursorHandle) +void ChromeClientEfl::setCursor(const Cursor&) { notImplemented(); - return false; } void ChromeClientEfl::requestGeolocationPermissionForFrame(Frame*, Geolocation*) diff --git a/WebKit/efl/WebCoreSupport/ChromeClientEfl.h b/WebKit/efl/WebCoreSupport/ChromeClientEfl.h index 45bda59..ce8abd1 100644 --- a/WebKit/efl/WebCoreSupport/ChromeClientEfl.h +++ b/WebKit/efl/WebCoreSupport/ChromeClientEfl.h @@ -119,7 +119,7 @@ public: virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; } - virtual bool setCursor(PlatformCursorHandle); + virtual void setCursor(const Cursor&); virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {} diff --git a/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp b/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp index 3c4016f..cf672eb 100644 --- a/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp +++ b/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp @@ -40,6 +40,11 @@ using namespace WebCore; namespace WebCore { +void EditorClientEfl::willSetInputMethodState() +{ + notImplemented(); +} + void EditorClientEfl::setInputMethodState(bool active) { notImplemented(); diff --git a/WebKit/efl/WebCoreSupport/EditorClientEfl.h b/WebKit/efl/WebCoreSupport/EditorClientEfl.h index a53d624..9f60cfb 100644 --- a/WebKit/efl/WebCoreSupport/EditorClientEfl.h +++ b/WebKit/efl/WebCoreSupport/EditorClientEfl.h @@ -111,6 +111,7 @@ public: virtual void showSpellingUI(bool show); virtual bool spellingUIIsShowing(); virtual void getGuessesForWord(const String&, WTF::Vector<String>& guesses); + virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); private: diff --git a/WebKit/efl/ewk/EWebKit.h b/WebKit/efl/ewk/EWebKit.h index e08c4a5..183e9dc 100644 --- a/WebKit/efl/ewk/EWebKit.h +++ b/WebKit/efl/ewk/EWebKit.h @@ -23,6 +23,7 @@ #define EWebKit_h #include "ewk_contextmenu.h" +#include "ewk_cookies.h" #include "ewk_eapi.h" #include "ewk_frame.h" #include "ewk_history.h" diff --git a/WebKit/efl/ewk/ewk_cookies.cpp b/WebKit/efl/ewk/ewk_cookies.cpp new file mode 100644 index 0000000..3b4949e --- /dev/null +++ b/WebKit/efl/ewk/ewk_cookies.cpp @@ -0,0 +1,221 @@ +/* + Copyright (C) 2010 ProFUSION embedded systems + Copyright (C) 2010 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_cookies.h" + +#include "CookieJarSoup.h" +#include "EWebKit.h" +#include "ResourceHandle.h" + +#include <Eina.h> +#include <eina_safety_checks.h> +#include <glib.h> +#include <libsoup/soup.h> +#include <wtf/text/CString.h> + + +/** + * Set the path where the cookies are going to be stored. Use NULL for keep + * them just in memory. + * + * @param filename path to the cookies.txt file. + * + * @returns EINA_FALSE if it wasn't possible to create the cookie jar, + * EINA_FALSE otherwise. + */ +EAPI Eina_Bool ewk_cookies_file_set(const char *filename) +{ + SoupCookieJar* cookieJar = 0; + if (filename) + cookieJar = soup_cookie_jar_text_new(filename, FALSE); + else + cookieJar = soup_cookie_jar_new(); + + if (!cookieJar) + return EINA_FALSE; + +#ifdef HAVE_LIBSOUP_2_29_90 + soup_cookie_jar_set_accept_policy(cookieJar, SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY); +#endif + + SoupSession* session = WebCore::ResourceHandle::defaultSession(); + SoupSessionFeature* oldjar = soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR); + if (oldjar) + soup_session_remove_feature(session, oldjar); + + WebCore::setDefaultCookieJar(cookieJar); + soup_session_add_feature(session, SOUP_SESSION_FEATURE(cookieJar)); + + return EINA_TRUE; +} + +/** + * Clear all the cookies from the cookie jar. + */ +EAPI void ewk_cookies_clear() +{ + GSList* l; + GSList* p; + SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); + + l = soup_cookie_jar_all_cookies(cookieJar); + for (p = l; p; p = p->next) + soup_cookie_jar_delete_cookie(cookieJar, (SoupCookie*)p->data); + + soup_cookies_free(l); +} + +/** + * Returns a list of cookies in the cookie jar. + * + * @returns an Eina_List with all the cookies in the cookie jar. + */ +EAPI Eina_List* ewk_cookies_get_all(void) +{ + GSList* l; + GSList* p; + Eina_List* el = 0; + SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); + + l = soup_cookie_jar_all_cookies(cookieJar); + for (p = l; p; p = p->next) { + SoupCookie* cookie = static_cast<SoupCookie*>(p->data); + Ewk_Cookie* c = static_cast<Ewk_Cookie*>(malloc(sizeof(*c))); + c->name = strdup(cookie->name); + c->value = strdup(cookie->value); + c->domain = strdup(cookie->domain); + c->path = strdup(cookie->path); + c->expires = soup_date_to_time_t(cookie->expires); + c->secure = static_cast<Eina_Bool>(cookie->secure); + c->http_only = static_cast<Eina_Bool>(cookie->http_only); + el = eina_list_append(el, c); + } + + soup_cookies_free(l); + return el; +} + +/* + * Deletes a cookie from the cookie jar. + * + * Note that the fields name, value, domain and path are used to match this + * cookie in the cookie jar. + * + * @param cookie an Ewk_Cookie that has the info relative to that cookie. + */ +EAPI void ewk_cookies_cookie_del(Ewk_Cookie *cookie) +{ + EINA_SAFETY_ON_NULL_RETURN(cookie); + GSList* l; + GSList* p; + SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); + SoupCookie* c1 = soup_cookie_new( + cookie->name, cookie->value, cookie->domain, cookie->path, -1); + + l = soup_cookie_jar_all_cookies(cookieJar); + for (p = l; p; p = p->next) { + SoupCookie* c2 = static_cast<SoupCookie*>(p->data); + if (soup_cookie_equal(c1, c2)) { + soup_cookie_jar_delete_cookie(cookieJar, c2); + break; + } + } + + soup_cookie_free(c1); + soup_cookies_free(l); +} + +/* + * Free the memory used by a cookie. + * + * @param cookie the Ewk_Cookie struct that will be freed. + */ +EAPI void ewk_cookies_cookie_free(Ewk_Cookie *cookie) +{ + EINA_SAFETY_ON_NULL_RETURN(cookie); + free(cookie->name); + free(cookie->value); + free(cookie->domain); + free(cookie->path); + free(cookie); +} + +/* + * Set the cookies accept policy. + * + * Possible values are: EWK_COOKIE_JAR_ACCEPT_ALWAYS, which accepts every + * cookie sent from any page; EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY, which + * accepts cookies only from the main page; and EWK_COOKIE_JAR_ACCEPT_NEVER, + * which rejects all cookies. + * + * @param p the acceptance policy + */ +EAPI void ewk_cookies_policy_set(Ewk_Cookie_Policy p) +{ +#ifdef HAVE_LIBSOUP_2_29_90 + SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); + SoupCookieJarAcceptPolicy policy; + + policy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS; + switch (p) { + case EWK_COOKIE_JAR_ACCEPT_NEVER: + policy = SOUP_COOKIE_JAR_ACCEPT_NEVER; + break; + case EWK_COOKIE_JAR_ACCEPT_ALWAYS: + policy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS; + break; + case EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY: + policy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY; + break; + } + + soup_cookie_jar_set_accept_policy(cookieJar, policy); +#endif +} + +/* + * Gets the acceptance policy used in the current cookie jar. + * + * @returns the current acceptance policy + */ +EAPI Ewk_Cookie_Policy ewk_cookies_policy_get() +{ + Ewk_Cookie_Policy ewk_policy = EWK_COOKIE_JAR_ACCEPT_ALWAYS; +#ifdef HAVE_LIBSOUP_2_29_90 + SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); + SoupCookieJarAcceptPolicy policy; + + policy = soup_cookie_jar_get_accept_policy(cookieJar); + switch (policy) { + case SOUP_COOKIE_JAR_ACCEPT_NEVER: + ewk_policy = EWK_COOKIE_JAR_ACCEPT_NEVER; + break; + case SOUP_COOKIE_JAR_ACCEPT_ALWAYS: + ewk_policy = EWK_COOKIE_JAR_ACCEPT_ALWAYS; + break; + case SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY: + ewk_policy = EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY; + break; + } +#endif + + return ewk_policy; +} diff --git a/WebKit/efl/ewk/ewk_cookies.h b/WebKit/efl/ewk/ewk_cookies.h new file mode 100644 index 0000000..6ba3c9a --- /dev/null +++ b/WebKit/efl/ewk/ewk_cookies.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2010 ProFUSION embedded systems + Copyright (C) 2010 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_cookies_h +#define ewk_cookies_h + +#include "ewk_eapi.h" +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct _Ewk_Cookie { + char *name; + char *value; + char *domain; + char *path; + time_t expires; + Eina_Bool secure; + Eina_Bool http_only; +}; + +typedef struct _Ewk_Cookie Ewk_Cookie; + +enum _Ewk_Cookie_Policy { + EWK_COOKIE_JAR_ACCEPT_NEVER, + EWK_COOKIE_JAR_ACCEPT_ALWAYS, + EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY +}; + +typedef enum _Ewk_Cookie_Policy Ewk_Cookie_Policy; + +/************************** Exported functions ***********************/ + +EAPI Eina_Bool ewk_cookies_file_set(const char *filename); +EAPI void ewk_cookies_clear(); +EAPI Eina_List* ewk_cookies_get_all(); +EAPI void ewk_cookies_cookie_del(Ewk_Cookie *cookie); +EAPI void ewk_cookies_cookie_free(Ewk_Cookie *cookie); +EAPI void ewk_cookies_policy_set(Ewk_Cookie_Policy p); +EAPI Ewk_Cookie_Policy ewk_cookies_policy_get(); + +#ifdef __cplusplus +} +#endif +#endif // ewk_cookies_h diff --git a/WebKit/efl/ewk/ewk_view.cpp b/WebKit/efl/ewk/ewk_view.cpp index 39dc0a7..1707a7d 100644 --- a/WebKit/efl/ewk/ewk_view.cpp +++ b/WebKit/efl/ewk/ewk_view.cpp @@ -595,6 +595,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd) // this functionality will be modified by the scale zoom patch. priv->settings.zoom_range.min_scale = ZOOM_MIN; priv->settings.zoom_range.max_scale = ZOOM_MAX; + priv->settings.zoom_range.user_scalable = EINA_TRUE; priv->main_frame = _ewk_view_core_frame_new(sd, priv, 0).get(); if (!priv->main_frame) { @@ -3737,6 +3738,7 @@ void ewk_view_popup_selected_set(Evas_Object* o, int index) INF("o=%p", o); EWK_VIEW_SD_GET_OR_RETURN(o, sd); EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv); + EINA_SAFETY_ON_NULL_RETURN(priv->popup.menu_client); priv->popup.menu_client->valueChanged(index); } |