2 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
3 * Copyright (C) 2011 ProFUSION Embedded Systems
4 * Copyright (C) 2011 Samsung Electronics
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #include "WorkQueueItem.h"
25 #include "DumpRenderTree.h"
28 #include <JavaScriptCore/JSStringRef.h>
29 #include <JavaScriptCore/OpaqueJSString.h>
30 #include <JavaScriptCore/runtime/UString.h>
31 #include <JavaScriptCore/wtf/text/CString.h>
33 bool LoadItem::invoke() const
35 Evas_Object* targetFrame;
37 if (!m_target->length())
38 targetFrame = mainFrame;
40 targetFrame = ewk_frame_child_find(mainFrame, m_target->ustring().utf8().data());
42 ewk_frame_uri_set(targetFrame, m_url->ustring().utf8().data());
47 bool LoadHTMLStringItem::invoke() const
49 if (!m_unreachableURL->length())
50 ewk_frame_contents_set(mainFrame, m_content->ustring().utf8().data(), 0, 0, 0, m_baseURL->ustring().utf8().data());
52 ewk_frame_contents_alternate_set(mainFrame, m_content->ustring().utf8().data(), 0, 0, 0, m_baseURL->ustring().utf8().data(), m_unreachableURL->ustring().utf8().data());
57 bool ReloadItem::invoke() const
59 ewk_view_reload(browser);
63 bool ScriptItem::invoke() const
65 return ewk_frame_script_execute(mainFrame, m_script->ustring().utf8().data());
68 bool BackForwardItem::invoke() const
70 Ewk_History* history = ewk_view_history_get(browser);
73 ewk_history_forward(history);
74 else if (m_howFar == -1)
75 ewk_history_back(history);
77 const Ewk_History_Item* item = ewk_history_history_item_nth_get(history, m_howFar);
78 ewk_history_history_item_set(history, item);