#include "AbstractWebEngine/AbstractWebEngine.h"
#include "AbstractWebEngine/TabThumbCache.h"
+#include "app_common.h"
#include "BrowserAssert.h"
#include "BrowserLogger.h"
#include "EflTools.h"
namespace basic_webengine {
namespace webkitengine_service {
+const std::string WebView::COOKIES_PATH = "cookies";
+
WebView::WebView(Evas_Object * obj, TabId tabId)
: m_parent(obj)
, m_tabId(tabId)
void WebView::init(bool desktopMode, Evas_Object * opener)
{
#if defined(USE_EWEBKIT)
+ M_ASSERT(m_ewkContext);
m_ewkView = ewk_view_add_with_context(evas_object_evas_get(m_parent), m_ewkContext);
evas_object_data_set(m_ewkView, "_container", this);
ewk_view_resume(m_ewkView);
#endif
- if (m_ewkView)
- {
- Ewk_Context *context = ewk_view_context_get(m_ewkView);
- if (context)
- {
- ewk_context_cache_model_set(context, EWK_CACHE_MODEL_PRIMARY_WEBBROWSER);
- }
- }
+ ewk_context_cache_model_set(m_ewkContext, EWK_CACHE_MODEL_PRIMARY_WEBBROWSER);
+ std::string path = app_get_data_path() + COOKIES_PATH;
+ ewk_cookie_manager_persistent_storage_set(ewk_context_cookie_manager_get(m_ewkContext), path.c_str(), EWK_COOKIE_PERSISTENT_STORAGE_SQLITE);
-///\note Odroid modification - not exists in WebKit API
-// ewk_cookie_manager_widget_cookie_directory_set(ewk_context_cookie_manager_get(context), webkit_path.c_str());
setupEwkSettings();
registerCallbacks();
#else
M_ASSERT(m_webEngine);
/// \todo: Choose newly created tab.
- TabId id = m_webEngine->addTab(std::string(), &self->getTabId());
- BROWSER_LOGD("Created tab: %s", id.toString().c_str());
-
- Evas_Object* tab_ewk_view = m_webEngine->getTabView(id);
- *static_cast<Evas_Object**>(out) = tab_ewk_view;
+ TabId id;
+ if (m_webEngine->currentTabId() != (id = m_webEngine->addTab(std::string(), &self->getTabId()))) {
+ BROWSER_LOGD("Created tab: %s", id.toString().c_str());
+ Evas_Object* tab_ewk_view = m_webEngine->getTabView(id);
+ *static_cast<Evas_Object**>(out) = tab_ewk_view;
+ }
}
void WebView::__closeWindowRequest(void *data, Evas_Object *, void *)
BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__);
WebView * self = reinterpret_cast<WebView *>(data);
+
self->m_isLoading = false;
self->m_loadProgress = 1;
WebView * self = reinterpret_cast<WebView *>(data);
self->m_loadProgress = *(double *)event_info;
-
self->loadProgress(self->m_loadProgress);
}
WebView * self = reinterpret_cast<WebView *>(data);
self->m_title = fromChar(ewk_view_title_get(obj));
-
self->titleChanged(self->m_title);
}
double WebView::getZoomFactor() const
{
- if(EINA_UNLIKELY(m_ewkView == nullptr)){
+ if(EINA_UNLIKELY(m_ewkView == nullptr)) {
return 1.0;
}
void WebView::setZoomFactor(double zoomFactor)
{
#if defined(USE_EWEBKIT)
- if(m_ewkView){
+ if(m_ewkView) {
//using zoomFactor = 0 sets zoom "fit to screen"
if(zoomFactor != getZoomFactor())
ewk_view_scroll_by(m_ewkView, dx, dy);
}
-const TabId& WebView::getTabId(){
+const TabId& WebView::getTabId() {
return m_tabId;
}