Title: [107260] trunk/Source/WebKit/efl
Revision
107260
Author
[email protected]
Date
2012-02-09 10:38:06 -0800 (Thu, 09 Feb 2012)

Log Message

[EFL] Introducing functions to set local storage db path and clear
those dbs.
https://bugs.webkit.org/show_bug.cgi?id=77107

This patch exposes the web local storage tracker database path
setting cabability, introduced on bug 77006, to the EFL port of
WebKit. Particularly, we have our own storage tracker client
object, to initialize the storage tracker backend on ewk_init().

Patch by Gustavo Lima Chaves <[email protected]> on 2012-02-09
Reviewed by Kenneth Rohde Christiansen.

* CMakeListsEfl.txt:
* WebCoreSupport/StorageTrackerClientEfl.cpp: Added.
(WebCore):
(WebCore::StorageTrackerClientEfl::dispatchDidModifyOrigin):
(WebCore::StorageTrackerClientEfl::didFinishLoadingOrigins):
* WebCoreSupport/StorageTrackerClientEfl.h: Added.
(WebCore):
(StorageTrackerClientEfl):
* ewk/ewk_main.cpp:
(trackerClient):
(_ewk_init_body):
* ewk/ewk_settings.cpp:
(ewk_settings_local_storage_path_set):
(ewk_settings_local_storage_path_get):
(ewk_settings_local_storage_database_clear):
(ewk_settings_local_storage_database_origin_clear):
* ewk/ewk_settings.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/efl/CMakeListsEfl.txt (107259 => 107260)


--- trunk/Source/WebKit/efl/CMakeListsEfl.txt	2012-02-09 18:27:06 UTC (rev 107259)
+++ trunk/Source/WebKit/efl/CMakeListsEfl.txt	2012-02-09 18:38:06 UTC (rev 107260)
@@ -73,6 +73,7 @@
     efl/WebCoreSupport/FrameLoaderClientEfl.cpp
     efl/WebCoreSupport/FullscreenVideoControllerEfl.cpp
     efl/WebCoreSupport/IconDatabaseClientEfl.cpp
+    efl/WebCoreSupport/StorageTrackerClientEfl.cpp
     efl/WebCoreSupport/InspectorClientEfl.cpp
     efl/WebCoreSupport/NotificationPresenterClientEfl.cpp
 

Modified: trunk/Source/WebKit/efl/ChangeLog (107259 => 107260)


--- trunk/Source/WebKit/efl/ChangeLog	2012-02-09 18:27:06 UTC (rev 107259)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-02-09 18:38:06 UTC (rev 107260)
@@ -1,3 +1,34 @@
+2012-02-09  Gustavo Lima Chaves  <[email protected]>
+
+        [EFL] Introducing functions to set local storage db path and clear
+        those dbs.
+        https://bugs.webkit.org/show_bug.cgi?id=77107
+
+        This patch exposes the web local storage tracker database path
+        setting cabability, introduced on bug 77006, to the EFL port of
+        WebKit. Particularly, we have our own storage tracker client
+        object, to initialize the storage tracker backend on ewk_init().
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * CMakeListsEfl.txt:
+        * WebCoreSupport/StorageTrackerClientEfl.cpp: Added.
+        (WebCore):
+        (WebCore::StorageTrackerClientEfl::dispatchDidModifyOrigin):
+        (WebCore::StorageTrackerClientEfl::didFinishLoadingOrigins):
+        * WebCoreSupport/StorageTrackerClientEfl.h: Added.
+        (WebCore):
+        (StorageTrackerClientEfl):
+        * ewk/ewk_main.cpp:
+        (trackerClient):
+        (_ewk_init_body):
+        * ewk/ewk_settings.cpp:
+        (ewk_settings_local_storage_path_set):
+        (ewk_settings_local_storage_path_get):
+        (ewk_settings_local_storage_database_clear):
+        (ewk_settings_local_storage_database_origin_clear):
+        * ewk/ewk_settings.h:
+
 2012-02-07  Krzysztof Czech  <[email protected]>
 
         [EFL] Add missing initialization of editable variable.

Added: trunk/Source/WebKit/efl/WebCoreSupport/StorageTrackerClientEfl.cpp (0 => 107260)


--- trunk/Source/WebKit/efl/WebCoreSupport/StorageTrackerClientEfl.cpp	                        (rev 0)
+++ trunk/Source/WebKit/efl/WebCoreSupport/StorageTrackerClientEfl.cpp	2012-02-09 18:38:06 UTC (rev 107260)
@@ -0,0 +1,37 @@
+/*
+ *  Copyright (C) 2012 ProFUSION Embedded Systems
+ *
+ *  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 "StorageTrackerClientEfl.h"
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+void StorageTrackerClientEfl::dispatchDidModifyOrigin(const String&)
+{
+    notImplemented();
+}
+
+void StorageTrackerClientEfl::didFinishLoadingOrigins()
+{
+    notImplemented();
+}
+
+}

Added: trunk/Source/WebKit/efl/WebCoreSupport/StorageTrackerClientEfl.h (0 => 107260)


--- trunk/Source/WebKit/efl/WebCoreSupport/StorageTrackerClientEfl.h	                        (rev 0)
+++ trunk/Source/WebKit/efl/WebCoreSupport/StorageTrackerClientEfl.h	2012-02-09 18:38:06 UTC (rev 107260)
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (C) 2012 ProFUSION Embedded Systems
+ *
+ *  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 StorageTrackerClientEfl_h
+#define StorageTrackerClientEfl_h
+
+#include "StorageTrackerClient.h"
+
+namespace WebCore {
+
+class StorageTrackerClientEfl : public StorageTrackerClient {
+public:
+    virtual void dispatchDidModifyOrigin(const String&);
+    virtual void didFinishLoadingOrigins();
+};
+
+}
+
+#endif // StorageTrackerClientEfl_h

Modified: trunk/Source/WebKit/efl/ewk/ewk_main.cpp (107259 => 107260)


--- trunk/Source/WebKit/efl/ewk/ewk_main.cpp	2012-02-09 18:27:06 UTC (rev 107259)
+++ trunk/Source/WebKit/efl/ewk/ewk_main.cpp	2012-02-09 18:38:06 UTC (rev 107260)
@@ -27,6 +27,8 @@
 #include "PageGroup.h"
 #include "ScriptController.h"
 #include "Settings.h"
+#include "StorageTracker.h"
+#include "StorageTrackerClientEfl.h"
 #include "ewk_logging.h"
 #include "ewk_network.h"
 #include "ewk_private.h"
@@ -135,6 +137,12 @@
     return 0;
 }
 
+static WebCore::StorageTrackerClientEfl* trackerClient()
+{
+    DEFINE_STATIC_LOCAL(WebCore::StorageTrackerClientEfl, trackerClient, ());
+    return &trackerClient;
+}
+
 Eina_Bool _ewk_init_body(void)
 {
 
@@ -174,6 +182,8 @@
 
     ewk_network_tls_certificate_check_set(false);
 
+    WebCore::StorageTracker::initializeTracker(webkitDirectory.utf8().data(), trackerClient());
+
     // TODO: this should move to WebCore, already reported to webkit-gtk folks:
 #if USE(SOUP)
     if (1) {

Modified: trunk/Source/WebKit/efl/ewk/ewk_settings.cpp (107259 => 107260)


--- trunk/Source/WebKit/efl/ewk/ewk_settings.cpp	2012-02-09 18:27:06 UTC (rev 107259)
+++ trunk/Source/WebKit/efl/ewk/ewk_settings.cpp	2012-02-09 18:38:06 UTC (rev 107260)
@@ -24,6 +24,7 @@
 #include "ApplicationCacheStorage.h"
 #include "CrossOriginPreflightResultCache.h"
 #include "DatabaseTracker.h"
+#include "StorageTracker.h"
 #include "FontCache.h"
 #include "FrameView.h"
 #include "IconDatabase.h"
@@ -57,6 +58,7 @@
 static const char* _ewk_icon_database_path = 0;
 
 static const char* s_webDatabasePath = 0;
+static const char* s_localStoragePath = 0;
 static uint64_t s_webDatabaseQuota = 1 * 1024 * 1024; // 1MB.
 
 static WTF::String _ewk_settings_webkit_platform_get()
@@ -111,6 +113,30 @@
 #endif
 }
 
+void ewk_settings_local_storage_path_set(const char* path)
+{
+    WebCore::StorageTracker::tracker().setDatabaseDirectoryPath(WTF::String::fromUTF8(path));
+    eina_stringshare_replace(&s_localStoragePath, path);
+}
+
+const char* ewk_settings_local_storage_path_get(void)
+{
+    return s_localStoragePath;
+}
+
+void ewk_settings_local_storage_database_clear()
+{
+    WebCore::StorageTracker::tracker().deleteAllOrigins();
+}
+
+void ewk_settings_local_storage_database_origin_clear(const char* url)
+{
+    EINA_SAFETY_ON_NULL_RETURN(url);
+
+    const WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
+    WebCore::StorageTracker::tracker().deleteOrigin(WebCore::SecurityOrigin::create(kurl).get());
+}
+
 void ewk_settings_web_database_path_set(const char* path)
 {
 #if ENABLE(SQL_DATABASE)

Modified: trunk/Source/WebKit/efl/ewk/ewk_settings.h (107259 => 107260)


--- trunk/Source/WebKit/efl/ewk/ewk_settings.h	2012-02-09 18:27:06 UTC (rev 107259)
+++ trunk/Source/WebKit/efl/ewk/ewk_settings.h	2012-02-09 18:38:06 UTC (rev 107260)
@@ -68,6 +68,53 @@
 EAPI void             ewk_settings_web_database_path_set(const char *path);
 
 /**
+ * Sets the current path to the directory where WebKit will write the
+ * HTML5 local storage indexing database (the one keeping track of
+ * individual views' local storage databases).
+ *
+ * By default, the value is @c ~/.webkit
+ *
+ * @param path the new local storage database directory path
+ *
+ * @note You may want to call
+ * ewk_view_setting_local_storage_database_path_set() on the same @p
+ * path, here, for your views.
+ */
+EAPI void ewk_settings_local_storage_path_set(const char* path);
+
+/**
+ * Returns directory's path where the HTML5 local storage indexing
+ * database is stored.
+ *
+ * This is guaranteed to be eina-stringshared, so whenever possible
+ * save yourself some cpu cycles and use eina_stringshare_ref()
+ * instead of eina_stringshare_add() or strdup().
+ *
+ * @return database path or @c NULL, on errors.
+ *
+ * @see ewk_settings_local_storage_path_set()
+ */
+EAPI const char* ewk_settings_local_storage_path_get(void);
+
+/**
+ * Removes @b all HTML 5 local storage databases.
+ */
+EAPI void ewk_settings_local_storage_database_clear();
+
+/**
+ * Clears the HTML 5 local storage database for the given URL
+ * (origin).
+ *
+ * @param url which URL to clear local storage to.
+ *
+ * After this call, the file holding the local storage database for
+ * that origin will be deleted, along with its entry on the local
+ * storage files database (a file stored under the path returned by
+ * ewk_settings_local_storage_path_get()).
+ */
+EAPI void ewk_settings_local_storage_database_origin_clear(const char *url);
+
+/**
  * Returns directory path where web database is stored.
  *
  * By default, the value is @c ~/.webkit
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to