Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[EFL] Add API for Web Database handling
https://bugs.webkit.org/show_bug.cgi?id=85178 Patch by Thiago Marcos P. Santos <thiago.santos@intel.com> on 2012-05-17 Reviewed by Antonio Gomes. Source/WebKit: Added the new Web Database API to the buildsystem. * PlatformEfl.cmake: Source/WebKit/efl: Add API for Web Database. This API will allow a browser to query information about size, name, filename and remove databases based on the origin. It will be also possible to list all databases for a given origin. * ewk/EWebKit.h: * ewk/ewk_security_origin.cpp: (ewk_security_origin_web_database_get_all): * ewk/ewk_security_origin.h: * ewk/ewk_settings.cpp: * ewk/ewk_settings.h: * ewk/ewk_web_database.cpp: Added. (_Ewk_Web_Database): (ewk_web_database_display_name_get): (ewk_web_database_expected_size_get): (ewk_web_database_filename_get): (ewk_web_database_name_get): (ewk_web_database_security_origin_get): (ewk_web_database_size_get): (ewk_web_database_remove): (ewk_web_database_remove_all): (ewk_web_database_free): (ewk_web_database_list_free): (ewk_web_database_new): * ewk/ewk_web_database.h: Added. * ewk/ewk_web_database_private.h: Copied from Source/WebKit/efl/ewk/EWebKit.h. (WebCore): Tools: Use the newly introduced Web Database API in EFL's DRT. * DumpRenderTree/efl/DumpRenderTreeChrome.cpp: (DumpRenderTreeChrome::resetDefaultsToConsistentValues): * DumpRenderTree/efl/LayoutTestControllerEfl.cpp: (LayoutTestController::clearAllDatabases): Canonical link: https://commits.webkit.org/104371@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@117464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
455 additions
and 14 deletions.
- +11 −0 Source/WebKit/ChangeLog
- +2 −0 Source/WebKit/PlatformEfl.cmake
- +35 −0 Source/WebKit/efl/ChangeLog
- +1 −0 Source/WebKit/efl/ewk/EWebKit.h
- +23 −0 Source/WebKit/efl/ewk/ewk_security_origin.cpp
- +18 −0 Source/WebKit/efl/ewk/ewk_security_origin.h
- +0 −7 Source/WebKit/efl/ewk/ewk_settings.cpp
- +0 −5 Source/WebKit/efl/ewk/ewk_settings.h
- +182 −0 Source/WebKit/efl/ewk/ewk_web_database.cpp
- +136 −0 Source/WebKit/efl/ewk/ewk_web_database.h
- +31 −0 Source/WebKit/efl/ewk/ewk_web_database_private.h
- +14 −0 Tools/ChangeLog
- +1 −1 Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp
- +1 −1 Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -41,6 +41,7 @@ | ||
#include "ewk_security_policy.h" | ||
#include "ewk_settings.h" | ||
#include "ewk_view.h" | ||
#include "ewk_web_database.h" | ||
#include "ewk_window_features.h" | ||
|
||
#include <Evas.h> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,182 @@ | ||
/* | ||
Copyright (C) 2012 Intel Corporation | ||
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_database.h" | ||
|
||
#include "DatabaseTracker.h" | ||
#include "SecurityOrigin.h" | ||
#include "ewk_security_origin.h" | ||
#include "ewk_security_origin_private.h" | ||
#include "ewk_web_database_private.h" | ||
#include <Eina.h> | ||
#include <wtf/RefPtr.h> | ||
#include <wtf/UnusedParam.h> | ||
#include <wtf/text/WTFString.h> | ||
|
||
struct _Ewk_Web_Database { | ||
WTF::RefPtr<WebCore::SecurityOrigin> securityOrigin; | ||
WTF::String coreName; | ||
const char* displayName; | ||
const char* filename; | ||
const char* name; | ||
}; | ||
|
||
const char* ewk_web_database_display_name_get(Ewk_Web_Database* database) | ||
{ | ||
#if ENABLE(SQL_DATABASE) | ||
if (database->displayName) | ||
return database->displayName; | ||
|
||
WebCore::SecurityOrigin* origin = database->securityOrigin.get(); | ||
WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(database->name, origin); | ||
database->displayName = eina_stringshare_add(details.displayName().utf8().data()); | ||
|
||
return database->displayName; | ||
#else | ||
UNUSED_PARAM(database); | ||
return 0; | ||
#endif | ||
} | ||
|
||
uint64_t ewk_web_database_expected_size_get(const Ewk_Web_Database* database) | ||
{ | ||
#if ENABLE(SQL_DATABASE) | ||
WebCore::SecurityOrigin* origin = database->securityOrigin.get(); | ||
WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(database->name, origin); | ||
return details.expectedUsage(); | ||
#else | ||
UNUSED_PARAM(database); | ||
return 0; | ||
#endif | ||
} | ||
|
||
const char* ewk_web_database_filename_get(Ewk_Web_Database* database) | ||
{ | ||
#if ENABLE(SQL_DATABASE) | ||
if (database->filename) | ||
return database->filename; | ||
|
||
WebCore::SecurityOrigin* origin = database->securityOrigin.get(); | ||
WTF::String path = WebCore::DatabaseTracker::tracker().fullPathForDatabase(origin, database->coreName); | ||
database->filename = eina_stringshare_add(path.utf8().data()); | ||
|
||
return database->filename; | ||
#else | ||
UNUSED_PARAM(database); | ||
return 0; | ||
#endif | ||
} | ||
|
||
const char* ewk_web_database_name_get(Ewk_Web_Database* database) | ||
{ | ||
#if ENABLE(SQL_DATABASE) | ||
if (database->name) | ||
return database->name; | ||
|
||
database->name = eina_stringshare_add(database->coreName.utf8().data()); | ||
|
||
return database->name; | ||
#else | ||
UNUSED_PARAM(database); | ||
return 0; | ||
#endif | ||
} | ||
|
||
Ewk_Security_Origin* ewk_web_database_security_origin_get(const Ewk_Web_Database* database) | ||
{ | ||
return ewk_security_origin_new(database->securityOrigin.get()); | ||
} | ||
|
||
uint64_t ewk_web_database_size_get(const Ewk_Web_Database* database) | ||
{ | ||
#if ENABLE(SQL_DATABASE) | ||
WebCore::SecurityOrigin* origin = database->securityOrigin.get(); | ||
WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(database->name, origin); | ||
return details.currentUsage(); | ||
#else | ||
UNUSED_PARAM(database); | ||
return 0; | ||
#endif | ||
} | ||
|
||
void ewk_web_database_remove(Ewk_Web_Database* database) | ||
{ | ||
#if ENABLE(SQL_DATABASE) | ||
WebCore::DatabaseTracker::tracker().deleteDatabase(database->securityOrigin.get(), database->coreName); | ||
#else | ||
UNUSED_PARAM(database); | ||
#endif | ||
} | ||
|
||
void ewk_web_database_remove_all(void) | ||
{ | ||
#if ENABLE(SQL_DATABASE) | ||
WebCore::DatabaseTracker::tracker().deleteAllDatabases(); | ||
#endif | ||
} | ||
|
||
void ewk_web_database_free(Ewk_Web_Database* database) | ||
{ | ||
#if ENABLE(SQL_DATABASE) | ||
eina_stringshare_del(database->displayName); | ||
eina_stringshare_del(database->filename); | ||
eina_stringshare_del(database->name); | ||
|
||
delete database; | ||
#else | ||
UNUSED_PARAM(database); | ||
#endif | ||
} | ||
|
||
void ewk_web_database_list_free(Eina_List* databaseList) | ||
{ | ||
void* database; | ||
EINA_LIST_FREE(databaseList, database) | ||
ewk_web_database_free(static_cast<Ewk_Web_Database*>(database)); | ||
} | ||
|
||
/** | ||
* @internal | ||
* Creates a wrapper representing a Web Database. | ||
* | ||
* @param coreOrigin WebCore Security Origin object | ||
* @param coreName Web Database name | ||
* | ||
* @return a wrapper for manipulating a Web Database. It should be freed | ||
* by ewk_web_database_free(). | ||
*/ | ||
Ewk_Web_Database* ewk_web_database_new(WebCore::SecurityOrigin* coreOrigin, const WTF::String& coreName) | ||
{ | ||
#if ENABLE(SQL_DATABASE) | ||
Ewk_Web_Database* database = new Ewk_Web_Database; | ||
|
||
database->securityOrigin = coreOrigin; | ||
database->coreName = coreName; | ||
database->displayName = 0; | ||
database->filename = 0; | ||
database->name = 0; | ||
|
||
return database; | ||
#else | ||
UNUSED_PARAM(coreOrigin); | ||
UNUSED_PARAM(coreName); | ||
return 0; | ||
#endif | ||
} |
Oops, something went wrong.