Diff
Modified: trunk/Source/WebKit2/ChangeLog (124874 => 124875)
--- trunk/Source/WebKit2/ChangeLog 2012-08-07 10:26:55 UTC (rev 124874)
+++ trunk/Source/WebKit2/ChangeLog 2012-08-07 10:46:14 UTC (rev 124875)
@@ -1,5 +1,54 @@
2012-08-07 Mikhail Pozdnyakov <[email protected]>
+ [EFL][WK2] Add back forward list API
+ https://bugs.webkit.org/show_bug.cgi?id=92345
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Added new Back Forward list API to EFL WK2. Ewk_Back_Forward_List and
+ Ewk_Back_Forward_List_Item structures were added. The new API is
+ mostly the same as one from UIProcess/API/C/{ WKBackForwardList.h, WKBackForwardListItem.h }.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/ewk_back_forward_list.cpp: Added.
+ (_Ewk_Back_Forward_List):
+ (_Ewk_Back_Forward_List::_Ewk_Back_Forward_List):
+ (getOrCreateItem):
+ (webkit_back_forward_list_current_item_get):
+ (webkit_back_forward_list_back_item_get):
+ (webkit_back_forward_list_forward_item_get):
+ (webkit_back_forward_list_item_at_index_get):
+ (webkit_back_forward_list_length_get):
+ (ewk_back_forward_list_changed):
+ (ewk_back_forward_list_new):
+ (ewk_back_forward_list_free):
+ * UIProcess/API/efl/ewk_back_forward_list.h: Added.
+ * UIProcess/API/efl/ewk_back_forward_list_item.cpp: Added.
+ (getItemProperty):
+ (_Ewk_Back_Forward_List_Item):
+ (_Ewk_Back_Forward_List_Item::_Ewk_Back_Forward_List_Item):
+ (_Ewk_Back_Forward_List_Item::~_Ewk_Back_Forward_List_Item):
+ (ewk_back_forward_list_item_ref):
+ (ewk_back_forward_list_item_unref):
+ (ewk_back_forward_list_item_uri_get):
+ (ewk_back_forward_list_item_title_get):
+ (ewk_back_forward_list_item_original_uri_get):
+ (ewk_back_forward_list_item_new):
+ * UIProcess/API/efl/ewk_back_forward_list_item.h: Added.
+ * UIProcess/API/efl/ewk_back_forward_list_item_private.h: Added.
+ * UIProcess/API/efl/ewk_back_forward_list_private.h: Added.
+ * UIProcess/API/efl/ewk_view.cpp:
+ (_Ewk_View_Private_Data):
+ (_Ewk_View_Private_Data::_Ewk_View_Private_Data):
+ (_Ewk_View_Private_Data::~_Ewk_View_Private_Data):
+ (ewk_view_back_forward_list_get): New function to get back-forward list.
+ * UIProcess/API/efl/ewk_view.h:
+ * UIProcess/API/efl/ewk_view_loader_client.cpp:
+ (didChangeBackForwardList): The callback added to update back-forward list items cache.
+ (ewk_view_loader_client_attach):
+
+2012-08-07 Mikhail Pozdnyakov <[email protected]>
+
CUSTOM_SCHEME_HANDLER flag should depend on REGISTER_PROTOCOL_HANDLER
https://bugs.webkit.org/show_bug.cgi?id=93081
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (124874 => 124875)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-08-07 10:26:55 UTC (rev 124874)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-08-07 10:46:14 UTC (rev 124875)
@@ -41,6 +41,8 @@
UIProcess/API/efl/NetworkInfoProvider.cpp
UIProcess/API/efl/PageClientImpl.cpp
UIProcess/API/efl/VibrationProvider.cpp
+ UIProcess/API/efl/ewk_back_forward_list.cpp
+ UIProcess/API/efl/ewk_back_forward_list_item.cpp
UIProcess/API/efl/ewk_context.cpp
UIProcess/API/efl/ewk_context_download_client.cpp
UIProcess/API/efl/ewk_context_request_manager_client.cpp
@@ -188,6 +190,8 @@
CONFIGURE_FILE(efl/ewebkit2.pc.in ${CMAKE_BINARY_DIR}/WebKit2/efl/ewebkit2.pc @ONLY)
SET (EWebKit2_HEADERS
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/EWebKit2.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_back_forward_list.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_back_forward_list_item.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_context.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_cookie_manager.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_download_job.h"
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h (124874 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-08-07 10:26:55 UTC (rev 124874)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-08-07 10:46:14 UTC (rev 124875)
@@ -28,6 +28,8 @@
#ifndef EWebKit2_h
#define EWebKit2_h
+#include "ewk_back_forward_list.h"
+#include "ewk_back_forward_list_item.h"
#include "ewk_context.h"
#include "ewk_cookie_manager.h"
#include "ewk_download_job.h"
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp (0 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp 2012-08-07 10:46:14 UTC (rev 124875)
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ewk_back_forward_list.h"
+
+#include "WKAPICast.h"
+#include "WKArray.h"
+#include "WKBackForwardList.h"
+#include "WKRetainPtr.h"
+#include "ewk_back_forward_list_item_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+typedef HashMap<WKBackForwardListItemRef, Ewk_Back_Forward_List_Item*> ItemsMap;
+
+/**
+ * \struct _Ewk_Back_Forward_List
+ * @brief Contains the Back Forward List data.
+ */
+struct _Ewk_Back_Forward_List {
+ WKRetainPtr<WKBackForwardListRef> wkList;
+ mutable ItemsMap wrapperCache;
+
+ _Ewk_Back_Forward_List(WKBackForwardListRef listRef)
+ : wkList(listRef)
+ { }
+
+ ~_Ewk_Back_Forward_List()
+ {
+ ItemsMap::iterator it = wrapperCache.begin();
+ ItemsMap::iterator end = wrapperCache.end();
+ for (; it != end; ++it)
+ ewk_back_forward_list_item_unref(it->second);
+ }
+};
+
+#define EWK_BACK_FORWARD_LIST_WK_GET_OR_RETURN(list, wkList_, ...) \
+ if (!(list)) { \
+ EINA_LOG_CRIT("list is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ if (!(list)->wkList) { \
+ EINA_LOG_CRIT("list->wkList is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ WKBackForwardListRef wkList_ = (list)->wkList.get()
+
+
+static inline Ewk_Back_Forward_List_Item* addItemToWrapperCache(const Ewk_Back_Forward_List* list, WKBackForwardListItemRef wkItem)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(list, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(wkItem, 0);
+
+ Ewk_Back_Forward_List_Item* item = list->wrapperCache.get(wkItem);
+ if (!item) {
+ item = ewk_back_forward_list_item_new(wkItem);
+ list->wrapperCache.set(wkItem, item);
+ }
+
+ return item;
+}
+
+Ewk_Back_Forward_List_Item* ewk_back_forward_list_current_item_get(const Ewk_Back_Forward_List* list)
+{
+ EWK_BACK_FORWARD_LIST_WK_GET_OR_RETURN(list, wkList, 0);
+
+ return addItemToWrapperCache(list, WKBackForwardListGetCurrentItem(wkList));
+}
+
+Ewk_Back_Forward_List_Item* ewk_back_forward_list_previous_item_get(const Ewk_Back_Forward_List* list)
+{
+ EWK_BACK_FORWARD_LIST_WK_GET_OR_RETURN(list, wkList, 0);
+
+ return addItemToWrapperCache(list, WKBackForwardListGetBackItem(wkList));
+}
+
+Ewk_Back_Forward_List_Item* ewk_back_forward_list_next_item_get(const Ewk_Back_Forward_List* list)
+{
+ EWK_BACK_FORWARD_LIST_WK_GET_OR_RETURN(list, wkList, 0);
+
+ return addItemToWrapperCache(list, WKBackForwardListGetForwardItem(wkList));
+}
+
+Ewk_Back_Forward_List_Item* ewk_back_forward_list_item_at_index_get(const Ewk_Back_Forward_List* list, int index)
+{
+ EWK_BACK_FORWARD_LIST_WK_GET_OR_RETURN(list, wkList, 0);
+
+ return addItemToWrapperCache(list, WKBackForwardListGetItemAtIndex(wkList, index));
+}
+
+unsigned ewk_back_forward_list_count(Ewk_Back_Forward_List* list)
+{
+ EWK_BACK_FORWARD_LIST_WK_GET_OR_RETURN(list, wkList, 0);
+
+ const unsigned currentItem = ewk_back_forward_list_current_item_get(list) ? 1 : 0;
+
+ return WKBackForwardListGetBackListCount(wkList) + WKBackForwardListGetForwardListCount(wkList) + currentItem;
+}
+
+
+/**
+ * @internal
+ * Updates items cache.
+ */
+void ewk_back_forward_list_changed(Ewk_Back_Forward_List* list, WKBackForwardListItemRef wkAddedItem, WKArrayRef wkRemovedItems)
+{
+ addItemToWrapperCache(list, wkAddedItem); // Puts new item to the cache.
+
+ const size_t removedItemsSize = wkRemovedItems ? WKArrayGetSize(wkRemovedItems) : 0;
+ for (size_t i = 0; i < removedItemsSize; ++i) {
+ WKBackForwardListItemRef wkItem = static_cast<WKBackForwardListItemRef>(WKArrayGetItemAtIndex(wkRemovedItems, i));
+ if (Ewk_Back_Forward_List_Item* item = list->wrapperCache.take(wkItem))
+ ewk_back_forward_list_item_unref(item);
+ }
+}
+
+/**
+ * @internal
+ * Constructs a Ewk_Back_Forward_List from a WKBackForwardListRef.
+ */
+Ewk_Back_Forward_List* ewk_back_forward_list_new(WKBackForwardListRef wkBackForwardListRef)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(wkBackForwardListRef, 0);
+
+ return new Ewk_Back_Forward_List(wkBackForwardListRef);
+}
+
+/**
+ * @internal
+ * Frees a Ewk_Back_Forward_List object.
+ */
+void ewk_back_forward_list_free(Ewk_Back_Forward_List* list)
+{
+ EINA_SAFETY_ON_NULL_RETURN(list);
+
+ delete list;
+}
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h (0 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h 2012-08-07 10:46:14 UTC (rev 124875)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file ewk_back_forward_list.h
+ * @brief Describes the Ewk Back Forward List API.
+ */
+
+#ifndef ewk_back_forward_list_h
+#define ewk_back_forward_list_h
+
+#include "ewk_back_forward_list_item.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Back_Forward_List */
+typedef struct _Ewk_Back_Forward_List Ewk_Back_Forward_List;
+
+/**
+ * Returns the current item in the @a list.
+ *
+ * @param list the back-forward list instance
+ *
+ * @return the current item in the @a list or @c NULL in case of error
+ */
+EAPI Ewk_Back_Forward_List_Item *ewk_back_forward_list_current_item_get(const Ewk_Back_Forward_List *list);
+
+/**
+ * Returns the item that precedes the current item in the @a list.
+ *
+ * @param list the back-forward list instance
+ *
+ * @return the item that precedes the current item the @a list or @c NULL in case of error
+ */
+EAPI Ewk_Back_Forward_List_Item *ewk_back_forward_list_previous_item_get(const Ewk_Back_Forward_List *list);
+
+/**
+ * Returns the item that follows the current item in the @a list.
+ *
+ * @param list the back-forward list instance
+ *
+ * @return the item that follows the current item in the @a list or @c NULL in case of error
+ */
+EAPI Ewk_Back_Forward_List_Item *ewk_back_forward_list_next_item_get(const Ewk_Back_Forward_List *list);
+
+/**
+ * Returns the item at a given @a index relative to the current item.
+ *
+ * @param list the back-forward list instance
+ * @param index the index of the item
+ *
+ * @return the item at a given @a index relative to the current item or @c NULL in case of error
+ */
+EAPI Ewk_Back_Forward_List_Item *ewk_back_forward_list_item_at_index_get(const Ewk_Back_Forward_List *list, int index);
+
+/**
+ * Returns the length of the back-forward list including current item.
+ *
+ * @param list the back-forward list instance
+ *
+ * @return the length of the back-forward list including current item or @c 0 in case of error
+ */
+EAPI unsigned ewk_back_forward_list_count(Ewk_Back_Forward_List *list);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // ewk_back_forward_list_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp (0 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp 2012-08-07 10:46:14 UTC (rev 124875)
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this item of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this item of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ewk_back_forward_list_item.h"
+
+#include "WKAPICast.h"
+#include "WKBackForwardListItem.h"
+#include "WKRetainPtr.h"
+#include "WKString.h"
+#include "WKURL.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+class WKEinaSharedString {
+public:
+ template <typename WKRefType>
+ WKEinaSharedString(WKAdoptTag, WKRefType strRef)
+ : m_string(0)
+ {
+ if (strRef) {
+ m_string = eina_stringshare_add(toImpl(strRef)->string().utf8().data());
+ ASSERT(m_string);
+ WKRelease(strRef); // Have stored a copy into eina_stringshare, do not need adopted strRef.
+ }
+ }
+
+ template <typename WKRefType>
+ WKEinaSharedString(WKRefType strRef)
+ : m_string(0)
+ {
+ if (strRef) {
+ m_string = eina_stringshare_add(toImpl(strRef)->string().utf8().data());
+ ASSERT(m_string);
+ }
+ }
+
+ ~WKEinaSharedString() { eina_stringshare_del(m_string); }
+ inline operator const char* () const { return m_string; }
+
+private:
+ const char* m_string;
+};
+
+/**
+ * \struct _Ewk_Back_Forward_List
+ * @brief Contains the Back Forward List data.
+ */
+struct _Ewk_Back_Forward_List_Item {
+ unsigned int __ref; /**< the reference count of the object */
+ WKRetainPtr<WKBackForwardListItemRef> wkItem;
+ WKEinaSharedString uri;
+ WKEinaSharedString title;
+ WKEinaSharedString originalUri;
+
+ _Ewk_Back_Forward_List_Item(WKBackForwardListItemRef itemRef)
+ : __ref(1)
+ , wkItem(itemRef)
+ , uri(AdoptWK, WKBackForwardListItemCopyURL(itemRef))
+ , title(AdoptWK, WKBackForwardListItemCopyTitle(itemRef))
+ , originalUri(AdoptWK, WKBackForwardListItemCopyOriginalURL(itemRef))
+ { }
+
+ ~_Ewk_Back_Forward_List_Item()
+ {
+ ASSERT(!__ref);
+ }
+};
+
+void ewk_back_forward_list_item_ref(Ewk_Back_Forward_List_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN(item);
+ ++item->__ref;
+}
+
+void ewk_back_forward_list_item_unref(Ewk_Back_Forward_List_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN(item);
+
+ if (--item->__ref)
+ return;
+
+ delete item;
+}
+
+const char* ewk_back_forward_list_item_uri_get(const Ewk_Back_Forward_List_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+
+ return item->uri;
+}
+
+const char* ewk_back_forward_list_item_title_get(const Ewk_Back_Forward_List_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+
+ return item->title;
+}
+
+const char* ewk_back_forward_list_item_original_uri_get(const Ewk_Back_Forward_List_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+
+ return item->originalUri;
+}
+
+Ewk_Back_Forward_List_Item* ewk_back_forward_list_item_new(WKBackForwardListItemRef backForwardListItemData)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(backForwardListItemData, 0);
+
+ return new Ewk_Back_Forward_List_Item(backForwardListItemData);
+}
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h (0 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h 2012-08-07 10:46:14 UTC (rev 124875)
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file ewk_back_forward_list_item.h
+ * @brief Describes the Ewk Back Forward List Item API.
+ */
+
+#ifndef ewk_back_forward_list_item_h
+#define ewk_back_forward_list_item_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Back_Forward_List_Item */
+typedef struct _Ewk_Back_Forward_List_Item Ewk_Back_Forward_List_Item;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param item the back-forward list item instance to increase the reference count
+ */
+EAPI void ewk_back_forward_list_item_ref(Ewk_Back_Forward_List_Item *item);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count reaches 0, the item is freed.
+ *
+ * @param item the back-forward list item instance to decrease the reference count
+ */
+EAPI void ewk_back_forward_list_item_unref(Ewk_Back_Forward_List_Item *item);
+
+/**
+ * Returns URI of the item.
+ *
+ * The returned URI may differ from the original URI (For example if the page was redirected).
+ *
+ * @see ewk_back_forward_list_item_original_uri_get()
+ *
+ * @param item the back-forward list item instance
+ *
+ * @return the URI of the @a item or @c NULL in case of error. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup()
+ */
+EAPI const char *ewk_back_forward_list_item_uri_get(const Ewk_Back_Forward_List_Item *item);
+
+/**
+ * Returns title of the item.
+ *
+ * @param item the back-forward list item instance
+ *
+ * @return the title of the @a item or @c NULL in case of error. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup()
+ */
+EAPI const char *ewk_back_forward_list_item_title_get(const Ewk_Back_Forward_List_Item *item);
+
+/**
+ * Returns original URI of the item.
+ *
+ * @see ewk_back_forward_list_item_uri_get()
+ *
+ * @param item the back-forward list item instance
+ *
+ * @return the original URI of the @a item or @c NULL in case of error. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup()
+ */
+EAPI const char *ewk_back_forward_list_item_original_uri_get(const Ewk_Back_Forward_List_Item *item);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // ewk_back_forward_list_item_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h (0 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h 2012-08-07 10:46:14 UTC (rev 124875)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this item of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this item of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_back_forward_list_item_private_h
+#define ewk_back_forward_list_item_private_h
+
+#include <WebKit2/WKBase.h>
+
+typedef struct _Ewk_Back_Forward_List_Item Ewk_Back_Forward_List_Item;
+
+Ewk_Back_Forward_List_Item* ewk_back_forward_list_item_new(WKBackForwardListItemRef wkBackForwardListItemRef);
+
+#endif // ewk_back_forward_list_private_h
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h (0 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h 2012-08-07 10:46:14 UTC (rev 124875)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_back_forward_list_private_h
+#define ewk_back_forward_list_private_h
+
+#include <WebKit2/WKBase.h>
+
+typedef struct _Ewk_Back_Forward_List Ewk_Back_Forward_List;
+
+void ewk_back_forward_list_changed(Ewk_Back_Forward_List*, WKBackForwardListItemRef wkAddedItem, WKArrayRef wkRemovedItems);
+Ewk_Back_Forward_List* ewk_back_forward_list_new(WKBackForwardListRef wkBackForwardListRef);
+void ewk_back_forward_list_free(Ewk_Back_Forward_List* list);
+
+#endif // ewk_back_forward_list_private_h
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (124874 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-08-07 10:26:55 UTC (rev 124874)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-08-07 10:46:14 UTC (rev 124875)
@@ -30,6 +30,7 @@
#include "WKRetainPtr.h"
#include "WKString.h"
#include "WKURL.h"
+#include "ewk_back_forward_list_private.h"
#include "ewk_context.h"
#include "ewk_context_private.h"
#include "ewk_intent_private.h"
@@ -71,6 +72,7 @@
const char* cursorGroup;
Evas_Object* cursorObject;
LoadingResourcesMap loadingResourcesMap;
+ Ewk_Back_Forward_List* backForwardList;
#ifdef HAVE_ECORE_X
bool isUsingEcoreX;
@@ -89,6 +91,7 @@
, customEncoding(0)
, cursorGroup(0)
, cursorObject(0)
+ , backForwardList(0)
#ifdef HAVE_ECORE_X
, isUsingEcoreX(false)
#endif
@@ -109,6 +112,8 @@
if (cursorObject)
evas_object_del(cursorObject);
+
+ ewk_back_forward_list_free(backForwardList);
}
};
@@ -665,6 +670,7 @@
}
priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView);
+ priv->backForwardList = ewk_back_forward_list_new(toAPI(priv->pageClient->page()->backForwardList()));
WKPageRef wkPage = toAPI(priv->pageClient->page());
ewk_view_find_client_attach(wkPage, ewkView);
@@ -1145,6 +1151,14 @@
return priv->pageClient->page()->canGoForward();
}
+Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+
+ return priv->backForwardList;
+}
+
void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const IntSize& size)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (124874 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-08-07 10:26:55 UTC (rev 124874)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-08-07 10:46:14 UTC (rev 124875)
@@ -69,6 +69,7 @@
#ifndef ewk_view_h
#define ewk_view_h
+#include "ewk_back_forward_list.h"
#include "ewk_context.h"
#include "ewk_download_job.h"
#include "ewk_intent.h"
@@ -357,6 +358,21 @@
EAPI Eina_Bool ewk_view_forward_possible(Evas_Object *o);
/**
+ * Gets the back-forward list associated with this view.
+ *
+ * The returned instance is unique for this view and thus multiple calls
+ * to this function with the same view as parameter returns the same
+ * handle. This handle is alive while view is alive, thus one
+ * might want to listen for EVAS_CALLBACK_DEL on given view
+ * (@a o) to know when to stop using returned handle.
+ *
+ * @param o view object to get navigation back-forward list
+ *
+ * @return the back-forward list instance handle associated with this view
+ */
+EAPI Ewk_Back_Forward_List *ewk_view_back_forward_list_get(const Evas_Object *o);
+
+/**
* Gets the current title of the main frame.
*
* It returns an internal string and should not
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp (124874 => 124875)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp 2012-08-07 10:26:55 UTC (rev 124874)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp 2012-08-07 10:46:14 UTC (rev 124875)
@@ -24,8 +24,10 @@
*/
#include "config.h"
+#include "ewk_view.h"
#include "WKFrame.h"
+#include "ewk_back_forward_list_private.h"
#include "ewk_intent.h"
#include "ewk_intent_private.h"
#include "ewk_intent_service.h"
@@ -123,6 +125,14 @@
ewk_web_error_free(ewkError);
}
+static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo)
+{
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ ASSERT(ewkView);
+
+ ewk_back_forward_list_changed(ewk_view_back_forward_list_get(ewkView), addedItem, removedItems);
+}
+
void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
{
WKPageLoaderClient loadClient;
@@ -144,5 +154,6 @@
loadClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
loadClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame;
loadClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame;
+ loadClient.didChangeBackForwardList = didChangeBackForwardList;
WKPageSetPageLoaderClient(pageRef, &loadClient);
}