<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[55965] trunk/WebKit</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/55965">55965</a></dd>
<dt>Author</dt> <dd>eric@webkit.org</dd>
<dt>Date</dt> <dd>2010-03-13 10:35:41 -0800 (Sat, 13 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>2010-03-13  Leandro Pereira  &lt;leandro@profusion.mobi&gt;

        Reviewed by Kenneth Rohde Christiansen.

        Add EFL port files to efl/ewk.
        http://webkit.org/b/35925

        * efl/ewk/ewk_history.cpp: Added.
        * efl/ewk/ewk_history.h: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebKitChangeLog">trunk/WebKit/ChangeLog</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkWebKiteflewkewk_historycpp">trunk/WebKit/efl/ewk/ewk_history.cpp</a></li>
<li><a href="#trunkWebKiteflewkewk_historyh">trunk/WebKit/efl/ewk/ewk_history.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/ChangeLog (55964 => 55965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/ChangeLog        2010-03-13 18:17:04 UTC (rev 55964)
+++ trunk/WebKit/ChangeLog        2010-03-13 18:35:41 UTC (rev 55965)
</span><span class="lines">@@ -3,6 +3,16 @@
</span><span class="cx">         Reviewed by Kenneth Rohde Christiansen.
</span><span class="cx"> 
</span><span class="cx">         Add EFL port files to efl/ewk.
</span><ins>+        http://webkit.org/b/35925
+
+        * efl/ewk/ewk_history.cpp: Added.
+        * efl/ewk/ewk_history.h: Added.
+
+2010-03-13  Leandro Pereira  &lt;leandro@profusion.mobi&gt;
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add EFL port files to efl/ewk.
</ins><span class="cx">         http://webkit.org/b/35928
</span><span class="cx"> 
</span><span class="cx">         * efl/ewk/ewk_main.cpp: Added.
</span></span></pre></div>
<a id="trunkWebKiteflewkewk_historycpp"></a>
<div class="addfile"><h4>Added: trunk/WebKit/efl/ewk/ewk_history.cpp (0 => 55965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/efl/ewk/ewk_history.cpp                                (rev 0)
+++ trunk/WebKit/efl/ewk/ewk_history.cpp        2010-03-13 18:35:41 UTC (rev 55965)
</span><span class="lines">@@ -0,0 +1,704 @@
</span><ins>+/*
+    Copyright (C) 2009-2010 ProFUSION embedded systems
+    Copyright (C) 2009-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 &quot;config.h&quot;
+#include &quot;ewk_history.h&quot;
+
+#include &quot;BackForwardList.h&quot;
+#include &quot;CString.h&quot;
+#include &quot;EWebKit.h&quot;
+#include &quot;HistoryItem.h&quot;
+#include &quot;Image.h&quot;
+#include &quot;ewk_private.h&quot;
+
+#include &lt;Eina.h&gt;
+#include &lt;eina_safety_checks.h&gt;
+
+struct _Ewk_History {
+    WebCore::BackForwardList *core;
+};
+
+#define EWK_HISTORY_CORE_GET_OR_RETURN(history, core_, ...)      \
+    if (!(history)) {                                            \
+        CRITICAL(&quot;history is NULL.&quot;);                            \
+        return __VA_ARGS__;                                      \
+    }                                                            \
+    if (!(history)-&gt;core) {                                      \
+        CRITICAL(&quot;history-&gt;core is NULL.&quot;);                      \
+        return __VA_ARGS__;                                      \
+    }                                                            \
+    if (!(history)-&gt;core-&gt;enabled()) {                           \
+        ERR(&quot;history-&gt;core is disabled!.&quot;);                      \
+        return __VA_ARGS__;                                      \
+    }                                                            \
+    WebCore::BackForwardList *core_ = (history)-&gt;core
+
+
+struct _Ewk_History_Item {
+    WebCore::HistoryItem *core;
+
+    const char *title;
+    const char *alternate_title;
+    const char *uri;
+    const char *original_uri;
+};
+
+#define EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core_, ...) \
+    if (!(item)) {                                            \
+        CRITICAL(&quot;item is NULL.&quot;);                            \
+        return __VA_ARGS__;                                   \
+    }                                                         \
+    if (!(item)-&gt;core) {                                      \
+        CRITICAL(&quot;item-&gt;core is NULL.&quot;);                      \
+        return __VA_ARGS__;                                   \
+    }                                                         \
+    WebCore::HistoryItem *core_ = (item)-&gt;core
+
+
+static inline Ewk_History_Item *_ewk_history_item_new(WebCore::HistoryItem *core)
+{
+    Ewk_History_Item* item;
+
+    if (!core) {
+        ERR(&quot;WebCore::HistoryItem is NULL.&quot;);
+        return 0;
+    }
+
+    item = (Ewk_History_Item *)calloc(1, sizeof(Ewk_History_Item));
+    if (!item) {
+        CRITICAL(&quot;Could not allocate item memory.&quot;);
+        return 0;
+    }
+
+    core-&gt;ref();
+    item-&gt;core = core;
+
+    return item;
+}
+
+static inline Eina_List *_ewk_history_item_list_get(const WebCore::HistoryItemVector &amp;core_items)
+{
+    Eina_List* ret = 0;
+    unsigned int i, size;
+
+    size = core_items.size();
+    for (i = 0; i &lt; size; i++) {
+        Ewk_History_Item* item = _ewk_history_item_new(core_items[i].get());
+        if (item)
+            ret = eina_list_append(ret, item);
+    }
+
+    return ret;
+}
+
+/**
+ * Go forward in history one item, if possible.
+ *
+ * @param history which history instance to modify.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure.
+ */
+Eina_Bool ewk_history_forward(Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, EINA_FALSE);
+    if (core-&gt;forwardListCount() &lt; 1)
+        return EINA_FALSE;
+    core-&gt;goForward();
+    return EINA_TRUE;
+}
+
+/**
+ * Go back in history one item, if possible.
+ *
+ * @param history which history instance to modify.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure.
+ */
+Eina_Bool ewk_history_back(Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, EINA_FALSE);
+    if (core-&gt;backListCount() &lt; 1)
+        return EINA_FALSE;
+    core-&gt;goBack();
+    return EINA_TRUE;
+}
+
+/**
+ * Adds the given item to history.
+ *
+ * Memory handling: This will not modify or even take references to
+ * given item (Ewk_History_Item), so you should still handle it with
+ * ewk_history_item_free().
+ *
+ * @param history which history instance to modify.
+ * @param item reference to add to history. Unmodified. Must @b not be @c NULL.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure.
+ */
+Eina_Bool ewk_history_history_item_add(Ewk_History* history, const Ewk_History_Item* item)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, history_core, EINA_FALSE);
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, item_core, EINA_FALSE);
+    history_core-&gt;addItem(item_core);
+    return EINA_TRUE;
+}
+
+/**
+ * Sets the given item as current in history (go to item).
+ *
+ * Memory handling: This will not modify or even take references to
+ * given item (Ewk_History_Item), so you should still handle it with
+ * ewk_history_item_free().
+ *
+ * @param history which history instance to modify.
+ * @param item reference to go to history. Unmodified. Must @b not be @c NULL.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure.
+ */
+Eina_Bool ewk_history_history_item_set(Ewk_History* history, const Ewk_History_Item* item)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, history_core, EINA_FALSE);
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, item_core, EINA_FALSE);
+    history_core-&gt;goToItem(item_core);
+    return EINA_TRUE;
+}
+
+/**
+ * Get the first item from back list, if any.
+ *
+ * @param history which history instance to query.
+ *
+ * @return the @b newly allocated item instance. This memory must be
+ *         released with ewk_history_item_free() after use.
+ */
+Ewk_History_Item* ewk_history_history_item_back_get(const Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    return _ewk_history_item_new(core-&gt;backItem());
+}
+
+/**
+ * Get the current item in history, if any.
+ *
+ * @param history which history instance to query.
+ *
+ * @return the @b newly allocated item instance. This memory must be
+ *         released with ewk_history_item_free() after use.
+ */
+Ewk_History_Item* ewk_history_history_item_current_get(const Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    return _ewk_history_item_new(core-&gt;currentItem());
+}
+
+/**
+ * Get the first item from forward list, if any.
+ *
+ * @param history which history instance to query.
+ *
+ * @return the @b newly allocated item instance. This memory must be
+ *         released with ewk_history_item_free() after use.
+ */
+Ewk_History_Item* ewk_history_history_item_forward_get(const Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    return _ewk_history_item_new(core-&gt;forwardItem());
+}
+
+/**
+ * Get item at given position, if any at that index.
+ *
+ * @param history which history instance to query.
+ * @param index position of item to get.
+ *
+ * @return the @b newly allocated item instance. This memory must be
+ *         released with ewk_history_item_free() after use.
+ */
+Ewk_History_Item* ewk_history_history_item_nth_get(const Ewk_History* history, int index)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    return _ewk_history_item_new(core-&gt;itemAtIndex(index));
+}
+
+/**
+ * Queries if given item is in history.
+ *
+ * Memory handling: This will not modify or even take references to
+ * given item (Ewk_History_Item), so you should still handle it with
+ * ewk_history_item_free().
+ *
+ * @param history which history instance to modify.
+ * @param item reference to check in history. Must @b not be @c NULL.
+ *
+ * @return @c EINA_TRUE if in history, @c EINA_FALSE if not or failure.
+ */
+Eina_Bool ewk_history_history_item_contains(const Ewk_History* history, const Ewk_History_Item* item)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, history_core, EINA_FALSE);
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, item_core, EINA_FALSE);
+    return history_core-&gt;containsItem(item_core);
+}
+
+/**
+ * Get the whole forward list.
+ *
+ * @param history which history instance to query.
+ *
+ * @return a newly allocated list of @b newly allocated item
+ *         instance. This memory of each item must be released with
+ *         ewk_history_item_free() after use. use
+ *         ewk_history_item_list_free() for convenience.
+ *
+ * @see ewk_history_item_list_free()
+ * @see ewk_history_forward_list_get_with_limit()
+ */
+Eina_List* ewk_history_forward_list_get(const Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    WebCore::HistoryItemVector items;
+    int limit = core-&gt;forwardListCount();
+    core-&gt;forwardListWithLimit(limit, items);
+    return _ewk_history_item_list_get(items);
+}
+
+/**
+ * Get the forward list within the given limit.
+ *
+ * @param history which history instance to query.
+ * @param limit the maximum number of items to return.
+ *
+ * @return a newly allocated list of @b newly allocated item
+ *         instance. This memory of each item must be released with
+ *         ewk_history_item_free() after use. use
+ *         ewk_history_item_list_free() for convenience.
+ *
+ * @see ewk_history_item_list_free()
+ * @see ewk_history_forward_list_length()
+ * @see ewk_history_forward_list_get()
+ */
+Eina_List* ewk_history_forward_list_get_with_limit(const Ewk_History* history, int limit)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    WebCore::HistoryItemVector items;
+    core-&gt;forwardListWithLimit(limit, items);
+    return _ewk_history_item_list_get(items);
+}
+
+/**
+ * Get the whole size of forward list.
+ *
+ * @param history which history instance to query.
+ *
+ * @return number of elements in whole list.
+ *
+ * @see ewk_history_forward_list_get_with_limit()
+ */
+int ewk_history_forward_list_length(const Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    return core-&gt;forwardListCount();
+}
+
+/**
+ * Get the whole back list.
+ *
+ * @param history which history instance to query.
+ *
+ * @return a newly allocated list of @b newly allocated item
+ *         instance. This memory of each item must be released with
+ *         ewk_history_item_free() after use. use
+ *         ewk_history_item_list_free() for convenience.
+ *
+ * @see ewk_history_item_list_free()
+ * @see ewk_history_back_list_get_with_limit()
+ */
+Eina_List* ewk_history_back_list_get(const Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    WebCore::HistoryItemVector items;
+    int limit = core-&gt;backListCount();
+    core-&gt;backListWithLimit(limit, items);
+    return _ewk_history_item_list_get(items);
+}
+
+/**
+ * Get the back list within the given limit.
+ *
+ * @param history which history instance to query.
+ * @param limit the maximum number of items to return.
+ *
+ * @return a newly allocated list of @b newly allocated item
+ *         instance. This memory of each item must be released with
+ *         ewk_history_item_free() after use. use
+ *         ewk_history_item_list_free() for convenience.
+ *
+ * @see ewk_history_item_list_free()
+ * @see ewk_history_back_list_length()
+ * @see ewk_history_back_list_get()
+ */
+Eina_List* ewk_history_back_list_get_with_limit(const Ewk_History* history, int limit)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    WebCore::HistoryItemVector items;
+    core-&gt;backListWithLimit(limit, items);
+    return _ewk_history_item_list_get(items);
+}
+
+/**
+ * Get the whole size of back list.
+ *
+ * @param history which history instance to query.
+ *
+ * @return number of elements in whole list.
+ *
+ * @see ewk_history_back_list_get_with_limit()
+ */
+int ewk_history_back_list_length(const Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    return core-&gt;backListCount();
+}
+
+/**
+ * Get maximum capacity of given history.
+ *
+ * @param history which history instance to query.
+ *
+ * @return maximum number of entries this history will hold.
+ */
+int ewk_history_limit_get(Ewk_History* history)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, 0);
+    return core-&gt;capacity();
+}
+
+/**
+ * Set maximum capacity of given history.
+ *
+ * @param history which history instance to modify.
+ * @param limit maximum size to allow.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ */
+Eina_Bool ewk_history_limit_set(const Ewk_History* history, int limit)
+{
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, EINA_FALSE);
+    core-&gt;setCapacity(limit);
+    return EINA_TRUE;
+}
+
+/**
+ * Create a new history item with given URI and title.
+ *
+ * @param uri where this resource is located.
+ * @param title resource title.
+ *
+ * @return newly allocated history item or @c NULL on errors. You must
+ *         free this item with ewk_history_item_free().
+ */
+Ewk_History_Item* ewk_history_item_new(const char* uri, const char* title)
+{
+    WebCore::String u = WebCore::String::fromUTF8(uri);
+    WebCore::String t = WebCore::String::fromUTF8(title);
+    WTF::RefPtr&lt;WebCore::HistoryItem&gt; core = WebCore::HistoryItem::create(u, t, 0);
+    Ewk_History_Item* item = _ewk_history_item_new(core.release().releaseRef());
+    return item;
+}
+
+static inline void _ewk_history_item_free(Ewk_History_Item* item, WebCore::HistoryItem* core)
+{
+    core-&gt;deref();
+    free(item);
+}
+
+/**
+ * Free given history item instance.
+ *
+ * @param item what to free.
+ */
+void ewk_history_item_free(Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core);
+    _ewk_history_item_free(item, core);
+}
+
+/**
+ * Free given list and associated history items instances.
+ *
+ * @param history_items list of items to free (both list nodes and
+ *        item instances).
+ */
+void ewk_history_item_list_free(Eina_List* history_items)
+{
+    void* d;
+    EINA_LIST_FREE(history_items, d) {
+        Ewk_History_Item* item = (Ewk_History_Item*)d;
+        _ewk_history_item_free(item, item-&gt;core);
+    }
+}
+
+/**
+ * Query title for given history item.
+ *
+ * @param item history item to query.
+ *
+ * @return the title pointer, that may be @c NULL. 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().
+ */
+const char* ewk_history_item_title_get(const Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
+    // hide the following optimzation from outside
+    Ewk_History_Item* i = (Ewk_History_Item*)item;
+    eina_stringshare_replace(&amp;i-&gt;title, core-&gt;title().utf8().data());
+    return i-&gt;title;
+}
+
+/**
+ * Query alternate title for given history item.
+ *
+ * @param item history item to query.
+ *
+ * @return the alternate title pointer, that may be @c NULL. 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().
+ */
+const char* ewk_history_item_title_alternate_get(const Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
+    // hide the following optimzation from outside
+    Ewk_History_Item* i = (Ewk_History_Item*)item;
+    eina_stringshare_replace(&amp;i-&gt;alternate_title,
+                             core-&gt;alternateTitle().utf8().data());
+    return i-&gt;alternate_title;
+}
+
+/**
+ * Set alternate title for given history item.
+ *
+ * @param item history item to query.
+ * @param title new alternate title to use for given item. No
+ *        references are kept after this function returns.
+ */
+void ewk_history_item_title_alternate_set(Ewk_History_Item* item, const char* title)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core);
+    if (!eina_stringshare_replace(&amp;item-&gt;alternate_title, title))
+        return;
+    core-&gt;setAlternateTitle(WebCore::String::fromUTF8(title));
+}
+
+/**
+ * Query URI for given history item.
+ *
+ * @param item history item to query.
+ *
+ * @return the URI pointer, that may be @c NULL. 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().
+ */
+const char* ewk_history_item_uri_get(const Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
+    // hide the following optimzation from outside
+    Ewk_History_Item* i = (Ewk_History_Item*)item;
+    eina_stringshare_replace(&amp;i-&gt;uri, core-&gt;urlString().utf8().data());
+    return i-&gt;uri;
+}
+
+/**
+ * Query original URI for given history item.
+ *
+ * @param item history item to query.
+ *
+ * @return the original URI pointer, that may be @c NULL. 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().
+ */
+const char* ewk_history_item_uri_original_get(const Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
+    // hide the following optimzation from outside
+    Ewk_History_Item* i = (Ewk_History_Item*)item;
+    eina_stringshare_replace(&amp;i-&gt;original_uri,
+                             core-&gt;originalURLString().utf8().data());
+    return i-&gt;original_uri;
+}
+
+/**
+ * Query last visited time for given history item.
+ *
+ * @param item history item to query.
+ *
+ * @return the time in seconds this item was visited.
+ */
+double ewk_history_item_time_last_visited_get(const Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0.0);
+    return core-&gt;lastVisitedTime();
+}
+
+/**
+ * Get the icon (aka favicon) associated with this history item.
+ *
+ * @note in order to have this working, one must open icon database
+ *       with ewk_settings_icon_database_path_set().
+ *
+ * @param item history item to query.
+ *
+ * @return the surface reference or @c NULL on errors. Note that the
+ *         reference may be to a standard fallback icon.
+ */
+cairo_surface_t* ewk_history_item_icon_surface_get(const Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
+    WebCore::Image* icon = core-&gt;icon();
+    if (!icon) {
+        ERR(&quot;icon is NULL.&quot;);
+        return 0;
+    }
+    return icon-&gt;nativeImageForCurrentFrame();
+}
+
+/**
+ * Add an Evas_Object of type 'image' to given canvas with history item icon.
+ *
+ * This is an utility function that creates an Evas_Object of type
+ * image set to have fill always match object size
+ * (evas_object_image_filled_add()), saving some code to use it from Evas.
+ *
+ * @note in order to have this working, one must open icon database
+ *       with ewk_settings_icon_database_path_set().
+ *
+ * @param item history item to query.
+ * @param canvas evas instance where to add resulting object.
+ *
+ * @return newly allocated Evas_Object instance or @c NULL on
+ *         errors. Delete the object with evas_object_del().
+ */
+Evas_Object* ewk_history_item_icon_object_add(const Ewk_History_Item* item, Evas* canvas)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
+    WebCore::Image* icon = core-&gt;icon();
+    cairo_surface_t* surface;
+
+    if (!icon) {
+        ERR(&quot;icon is NULL.&quot;);
+        return 0;
+    }
+
+    surface = icon-&gt;nativeImageForCurrentFrame();
+    return ewk_util_image_from_cairo_surface_add(canvas, surface);
+}
+
+/**
+ * Query if given item is still in page cache.
+ *
+ * @param item history item to query.
+ *
+ * @return @c EINA_TRUE if in cache, @c EINA_FALSE otherwise.
+ */
+Eina_Bool ewk_history_item_page_cache_exists(const Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, EINA_FALSE);
+    return core-&gt;isInPageCache();
+}
+
+/**
+ * Query number of times item was visited.
+ *
+ * @param item history item to query.
+ *
+ * @return number of visits.
+ */
+int ewk_history_item_visit_count(const Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
+    return core-&gt;visitCount();
+}
+
+/**
+ * Query if last visit to item was failure or not.
+ *
+ * @param item history item to query.
+ *
+ * @return @c EINA_TRUE if last visit was failure, @c EINA_FALSE if it
+ *         was fine.
+ */
+Eina_Bool ewk_history_item_visit_last_failed(const Ewk_History_Item* item)
+{
+    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, EINA_TRUE);
+    return core-&gt;lastVisitWasFailure();
+}
+
+
+/* internal methods ****************************************************/
+/**
+ * @internal
+ *
+ * Creates history for given view. Called internally by ewk_view and
+ * should never be called from outside.
+ *
+ * @param core WebCore::BackForwardList instance to use internally.
+ *
+ * @return newly allocated history instance or @c NULL on errors.
+ */
+Ewk_History* ewk_history_new(WebCore::BackForwardList* core)
+{
+    Ewk_History* history;
+    EINA_SAFETY_ON_NULL_RETURN_VAL(core, 0);
+    DBG(&quot;core=%p&quot;, core);
+
+    history = (Ewk_History*)malloc(sizeof(Ewk_History));
+    if (!history) {
+        CRITICAL(&quot;Could not allocate history memory.&quot;);
+        return 0;
+    }
+
+    core-&gt;ref();
+    history-&gt;core = core;
+
+    return history;
+}
+
+/**
+ * @internal
+ *
+ * Destroys previously allocated history instance. This is called
+ * automatically by ewk_view and should never be called from outside.
+ *
+ * @param history instance to free
+ */
+void ewk_history_free(Ewk_History* history)
+{
+    DBG(&quot;history=%p&quot;, history);
+    history-&gt;core-&gt;deref();
+    free(history);
+}
</ins></span></pre></div>
<a id="trunkWebKiteflewkewk_historyh"></a>
<div class="addfile"><h4>Added: trunk/WebKit/efl/ewk/ewk_history.h (0 => 55965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/efl/ewk/ewk_history.h                                (rev 0)
+++ trunk/WebKit/efl/ewk/ewk_history.h        2010-03-13 18:35:41 UTC (rev 55965)
</span><span class="lines">@@ -0,0 +1,96 @@
</span><ins>+/*
+    Copyright (C) 2009-2010 ProFUSION embedded systems
+    Copyright (C) 2009-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_history_h
+#define ewk_history_h
+
+#include &quot;ewk_eapi.h&quot;
+
+#include &lt;Eina.h&gt;
+#include &lt;Evas.h&gt;
+#include &lt;cairo.h&gt;
+
+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif
+
+/**
+ * The history (back-forward list) associated with a given ewk_view.
+ *
+ * Changing the history affects immediately the view, changing the
+ * current uri, for example.
+ *
+ * When ewk_view is navigated or uris are set, history automatically
+ * updates. That's why no direct access to history structure is
+ * allowed.
+ */
+typedef struct _Ewk_History         Ewk_History;
+
+/**
+ * Represents one item from Ewk_History.
+ */
+typedef struct _Ewk_History_Item    Ewk_History_Item;
+
+
+
+EAPI Eina_Bool         ewk_history_forward(Ewk_History *history);
+EAPI Eina_Bool         ewk_history_back(Ewk_History *history);
+
+EAPI Eina_Bool         ewk_history_history_item_add(Ewk_History *history, const Ewk_History_Item *item);
+EAPI Eina_Bool         ewk_history_history_item_set(Ewk_History *history,  const Ewk_History_Item *item);
+EAPI Ewk_History_Item *ewk_history_history_item_back_get(const Ewk_History *history);
+EAPI Ewk_History_Item *ewk_history_history_item_current_get(const Ewk_History *history);
+EAPI Ewk_History_Item *ewk_history_history_item_forward_get(const Ewk_History *history);
+EAPI Ewk_History_Item *ewk_history_history_item_nth_get(const Ewk_History *history, int index);
+EAPI Eina_Bool         ewk_history_history_item_contains(const Ewk_History *history, const Ewk_History_Item *item);
+
+EAPI Eina_List        *ewk_history_forward_list_get(const Ewk_History *history);
+EAPI Eina_List        *ewk_history_forward_list_get_with_limit(const Ewk_History *history, int limit);
+EAPI int               ewk_history_forward_list_length(const Ewk_History *history);
+
+EAPI Eina_List        *ewk_history_back_list_get(const Ewk_History *history);
+EAPI Eina_List        *ewk_history_back_list_get_with_limit(const Ewk_History *history, int limit);
+EAPI int               ewk_history_back_list_length(const Ewk_History *history);
+
+EAPI int               ewk_history_limit_get(Ewk_History *history);
+EAPI Eina_Bool         ewk_history_limit_set(const Ewk_History *history, int limit);
+
+EAPI Ewk_History_Item *ewk_history_item_new(const char *uri, const char *title);
+EAPI void              ewk_history_item_free(Ewk_History_Item *item);
+EAPI void              ewk_history_item_list_free(Eina_List *history_items);
+
+EAPI const char       *ewk_history_item_title_get(const Ewk_History_Item *item);
+EAPI const char       *ewk_history_item_title_alternate_get(const Ewk_History_Item *item);
+EAPI void              ewk_history_item_title_alternate_set(Ewk_History_Item *item, const char *title);
+EAPI const char       *ewk_history_item_uri_get(const Ewk_History_Item *item);
+EAPI const char       *ewk_history_item_uri_original_get(const Ewk_History_Item *item);
+EAPI double            ewk_history_item_time_last_visited_get(const Ewk_History_Item *item);
+
+EAPI cairo_surface_t  *ewk_history_item_icon_surface_get(const Ewk_History_Item *item);
+EAPI Evas_Object      *ewk_history_item_icon_object_add(const Ewk_History_Item *item, Evas *canvas);
+
+EAPI Eina_Bool         ewk_history_item_page_cache_exists(const Ewk_History_Item *item);
+EAPI int               ewk_history_item_visit_count(const Ewk_History_Item *item);
+EAPI Eina_Bool         ewk_history_item_visit_last_failed(const Ewk_History_Item *item);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // ewk_history_h
</ins></span></pre>
</div>
</div>

</body>
</html>