From 42a0048dfdab872071171f6f92e6cb1e8742e61b Mon Sep 17 00:00:00 2001 From: "sungwon2.han" Date: Tue, 16 Jun 2015 09:49:48 +0900 Subject: [PATCH 01/16] Script files to build the reference browser Change-Id: Ib50f1c53f94c92d44b4e4531d1ef997a08562df7 Signed-off-by: sungwon2.han --- .gbs.conf | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ build.sh | 2 +- 2 files changed, 165 insertions(+), 1 deletion(-) create mode 100755 .gbs.conf diff --git a/.gbs.conf b/.gbs.conf new file mode 100755 index 0000000..6313a06 --- /dev/null +++ b/.gbs.conf @@ -0,0 +1,164 @@ +############################################### +# +# Tizen v3.0 for TV (arm-x11) +# +[obs.tizen] +url = https://api.tizen.org + +[profile.tztv_v3.0] +obs = obs.tizen +repos = repo.tv_arm-x11 +buildroot = ~/GBS-ROOT-3.0-TV + +[repo.tv_arm-x11] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/arm-x11/packages/ + +############################################### +# +# Tizen v3.0 for tv (emulator32-x11) +# +[obs.tizentv] +url = https://api.tizen.org + +[profile.tztv_v3.0_emulator] +obs = obs.tizentv +repos = repo.tztv_v3.0_emul +buildroot = ~/GBS-ROOT-3.0-TV-EMUL + +[repo.tztv_v3.0_emul] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/emulator32-x11/packages/ + +############################################### +# +# Tizen v3.0 for tv (arm64-x11) +# +[obs.tizentv] +url = https://api.tizen.org + +[profile.tztv_v3.0_arm64-x11] +obs = obs.tizentv +repos = repo.tztv_v3.0_arm64-x11 +buildroot = ~/GBS-ROOT-3.0-TV-arm64-x11 + +[repo.tztv_v3.0_arm64-x11] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/arm64-x11/packages/ + +############################################### +# +# Tizen v3.0 for tv (ia32-x11) +# +[obs.tizentv] +url = https://api.tizen.org + +[profile.tztv_v3.0_ia32-x11] +obs = obs.tizentv +repos = repo.tztv_v3.0_ia32-x11 +buildroot = ~/GBS-ROOT-3.0-TV-ia32-x11 + +[repo.tztv_v3.0_ia32-x11] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/ia32-x11/packages/ + +############################################### +# +# Tizen v3.0 for tv (x86_64-x11) +# +[obs.tizentv] +url = https://api.tizen.org + +[profile.tztv_v3.0_x86_64-x11] +obs = obs.tizentv +repos = repo.tztv_v3.0_x86_64-x11 +buildroot = ~/GBS-ROOT-3.0-TV-x86_64-x11 + +[repo.tztv_v3.0_x86_64-x11] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/x86_64-x11/packages/ + +############################################### +# +# Tizen v3.0 for TV (arm-wayland) +# +[obs.tizen] +url = https://api.tizen.org + +[profile.tztv_v3.0-wayland] +obs = obs.tizen +repos = repo.tv_arm-wayland +buildroot = ~/GBS-ROOT-3.0-TV-wayland + +[repo.tv_arm-wayland] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/arm-wayland/packages/ + +############################################### +# +# Tizen v3.0 for tv (emulator32-wayland) +# +[obs.tizentv] +url = https://api.tizen.org + +[profile.tztv_v3.0_emulator-wayland] +obs = obs.tizentv +repos = repo.tztv_v3.0_emul-wayland +buildroot = ~/GBS-ROOT-3.0-TV-EMUL-wayland + +[repo.tztv_v3.0_emul-wayland] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/emulator32-wayland/packages/ + +############################################### +# +# Tizen v3.0 for tv (arm64-wayland) +# +[obs.tizentv] +url = https://api.tizen.org + +[profile.tztv_v3.0_arm64-wayland] +obs = obs.tizentv +repos = repo.tztv_v3.0_arm64-wayland +buildroot = ~/GBS-ROOT-3.0-TV-arm64-wayland + +[repo.tztv_v3.0_arm64-wayland] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/arm64-wayland/packages/ + +############################################### +# +# Tizen v3.0 for mobile (arm64-wayland) +# +[obs.tizentv] +url = https://api.tizen.org + +[profile.tzmo_v3.0_arm64-wayland] +obs = obs.tizentv +repos = repo.tzmo_v3.0_arm64-wayland +buildroot = ~/GBS-ROOT-3.0-MOBILE-arm64-wayland + +[repo.tzmo_v3.0_arm64-wayland] +url = http://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm64-wayland/packages/ + +############################################### +# +# Tizen v3.0 for tv (ia32-wayland) +# +[obs.tizentv] +url = https://api.tizen.org + +[profile.tztv_v3.0_ia32-wayland] +obs = obs.tizentv +repos = repo.tztv_v3.0_ia32-wayland +buildroot = ~/GBS-ROOT-3.0-TV-ia32-wayland + +[repo.tztv_v3.0_ia32-wayland] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/ia32-wayland/packages/ + +############################################### +# +# Tizen v3.0 for tv (x86_64-wayland) +# +[obs.tizentv] +url = https://api.tizen.org + +[profile.tztv_v3.0_x86_64-wayland] +obs = obs.tizentv +repos = repo.tztv_v3.0_x86_64-wayland +buildroot = ~/GBS-ROOT-3.0-TV-x86_64-wayland + +[repo.tztv_v3.0_x86_64-wayland] +url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/x86_64-wayland/packages/ diff --git a/build.sh b/build.sh index 4478e3a..b61fe4f 100755 --- a/build.sh +++ b/build.sh @@ -1 +1 @@ -gbs -c .gbs.conf build -P tztv_v3.0 -A armv7l --include-all $@ +gbs -c .gbs.conf build -P tztv_v3.0-wayland -A armv7l --include-all $@ -- 2.7.4 From aa8269d97a8f9eca52623023a6b982680c7860da Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Mon, 22 Jun 2015 16:45:15 +0900 Subject: [PATCH 02/16] Modifying path for db files Browser crashes due to the error below. >> Error while starting transaction >> UNHANDLED EXCEPTION attempt to write a readonly database Platform only allows following path to access db files. >> /home/{ACCOUNT}/.applications/dbspace/ This patch supports multi-user mode and fixes the crash. However, this should be reverted later once multi-user db is supported via browser-provider. Change-Id: I2a2cf7d3956dbba37653b773b203706f866e96a9 Signed-off-by: Youngsoo Choi --- CMakeLists.txt | 1 - core/Config/Config.cpp | 14 +++++++++----- core/Config/ConfigValues.h.in | 1 - packaging/org.tizen.browser.spec | 16 ++-------------- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cde5451..94aed0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 2.8) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(BINDIR "${PREFIX}/bin") SET(RESDIR "${PREFIX}/res" CACHE STRING "The path of resources") -SET(RESDBDIR "/opt${PREFIX}/res") SET(WEBKITDIR "/opt/usr/data/webkit" CACHE STRING "The path of web engine") SET(EDJE_DIR "${RESDIR}/edje/") SET(CERTS_DIR "${RESDIR}/certs/") diff --git a/core/Config/Config.cpp b/core/Config/Config.cpp index 3e274ea..2665734 100644 --- a/core/Config/Config.cpp +++ b/core/Config/Config.cpp @@ -16,6 +16,7 @@ #include "browser_config.h" #include "Config.h" +#include namespace tizen_browser { @@ -24,13 +25,16 @@ namespace config void DefaultConfig::load(const std::string &) { + const char *db_path = NULL; + db_path = tzplatform_getenv(TZ_USER_DB); + m_data["main_service_name"] = std::string("org.tizen.browser.base_UI"); //m_data["favorite_service_name"] = std::string("org.tizen.browser.service.favorite.browserProvider"); m_data["favorite_service_name"] = std::string("org.tizen.browser.favoriteservice"); - m_data["DB_BOOKMARK"] = std::string("bookmark.db"); - m_data["DB_SETTINGS"] = std::string("settings.db"); - m_data["DB_HISTORY"] = std::string("history.db"); - m_data["DB_SESSION"] = std::string("session.db"); + m_data["DB_BOOKMARK"] = std::string(".browser.bookmark.db"); + m_data["DB_SETTINGS"] = std::string(".browser.settings.db"); + m_data["DB_HISTORY"] = std::string(".browser.history.db"); + m_data["DB_SESSION"] = std::string(".browser.session.db"); m_data["TOOLTIP_DELAY"] = 0.05; // time from mouse in to tooltip show m_data["TOOLTIP_HIDE_TIMEOUT"] = 2.0; // time from tooltip show to tooltip hide @@ -39,7 +43,7 @@ void DefaultConfig::load(const std::string &) # include "ConfigValues.h" - + m_data["resourcedb/dir"] = std::string(db_path)+"/"; } void DefaultConfig::store(const std::string & ) diff --git a/core/Config/ConfigValues.h.in b/core/Config/ConfigValues.h.in index ae28002..53fce72 100644 --- a/core/Config/ConfigValues.h.in +++ b/core/Config/ConfigValues.h.in @@ -1,5 +1,4 @@ //This is template file for configuration variables. m_data["services/dir"] = std::string("@CMAKE_INSTALL_PREFIX@/services"); m_data["resource/dir"] = std::string("@RESDIR@"); -m_data["resourcedb/dir"] = std::string("@RESDBDIR@/db/"); m_data["webkit/dir"] = std::string("@WEBKITDIR@"); diff --git a/packaging/org.tizen.browser.spec b/packaging/org.tizen.browser.spec index ffbba3b..66ddef9 100644 --- a/packaging/org.tizen.browser.spec +++ b/packaging/org.tizen.browser.spec @@ -35,7 +35,8 @@ BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-network-connection) BuildRequires: pkgconfig(libpng) BuildRequires: pkgconfig(libcurl) -BuildRequires: browser-provider-devel +BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: browser-provider-devel BuildRequires: cmake BuildRequires: edje-tools @@ -56,7 +57,6 @@ BuildRequires: pkgconfig(dlog) %define _appdir /usr/apps/%{name} %define _bindir %{_appdir}/bin -%define _appdatadir /opt/usr/apps/%{name} %define COVERAGE_STATS %{?coverage_stats:ON}%{!?coverage_stats:OFF} %define _manifestdir /usr/share/packages @@ -98,23 +98,11 @@ cd %{_build_dir} %post -#Prepare files -if [ ! -f %{_appdatadir}/res/db/bookmark.db ]; -then - mkdir -p %{_appdatadir}/res/db - chsmack -a "dtv-org.tizen.browser" %{_appdatadir}/res/db - sqlite3 %{_appdatadir}/res/db/bookmark.db '' - chsmack -a "dtv-org.tizen.browser" %{_appdatadir}/res/db/bookmark.db -fi - mkdir -p /opt/usr/data/webkit/storage mkdir -p /opt/usr/data/webkit/favicon #Change ownership and privileges -chown -R 5000:5000 %{_appdatadir}/res/db chown -R 5000:5000 /opt/usr/data/webkit -chmod -R 777 %{_appdatadir}/res/db -chmod 777 %{_appdatadir}/res/db/bookmark.db chmod -R 660 /opt/usr/data/webkit %files -- 2.7.4 From c3d5d61f316279c6b1aed481337368ca588628d4 Mon Sep 17 00:00:00 2001 From: Gajendra N Date: Fri, 26 Jun 2015 14:13:58 +0530 Subject: [PATCH 03/16] fixup! Unable to delete all history items. 1) Fixes popup button not disabled on deleting last item. 2) Shows proper date and time. Change-Id: I323fdd6a6e7871f153c68f7c10d8587638a1de28 --- services/HistoryService/HistoryService.h | 1 + services/HistoryService/src/HistoryService.cpp | 66 ++++++++++++++++++++++---- services/SimpleUI/SimpleUI.cpp | 1 + 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/services/HistoryService/HistoryService.h b/services/HistoryService/HistoryService.h index e92cf5d..0e09cab 100644 --- a/services/HistoryService/HistoryService.h +++ b/services/HistoryService/HistoryService.h @@ -43,6 +43,7 @@ public: virtual ~HistoryService(); virtual std::string getName(); + int getHistoryId(const std::string & url); /** * @throws HistoryException on error */ diff --git a/services/HistoryService/src/HistoryService.cpp b/services/HistoryService/src/HistoryService.cpp index a377bf1..5aff218 100644 --- a/services/HistoryService/src/HistoryService.cpp +++ b/services/HistoryService/src/HistoryService.cpp @@ -17,12 +17,16 @@ #include #include #include +#include +#include +#include #include "ServiceManager.h" #include "HistoryService.h" #include "HistoryItem.h" #include "AbstractWebEngine.h" #include "EflTools.h" + namespace tizen_browser { namespace services @@ -60,8 +64,7 @@ void HistoryService::setStorageServiceTestMode(bool testmode) { } int HistoryService::getHistoryItemsCount(){ - return 1; - //return getStorageManager()->getHistoryItemsCount(); + return history_list.size(); } static int __get_duplicated_ids_p(int **ids, int *count, const int limit, const int offset, @@ -122,11 +125,12 @@ void HistoryService::addHistoryItem(std::shared_ptr his){ bp_history_adaptor_set_url(id, (his->getUrl()).c_str()); bp_history_adaptor_set_title(id, (his->getTitle()).c_str()); - + bp_history_adaptor_set_date_visited(id,-1); std::unique_ptr favicon_blob = tizen_browser::tools::EflTools::getBlobPNG(favicon); unsigned char * fav = std::move((unsigned char*)favicon_blob->getData()); bp_history_adaptor_set_icon(id, favicon->width, favicon->height, fav, favicon_blob->getLength()); + history_list.push_back(his); BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); } @@ -141,7 +145,28 @@ void HistoryService::insertOrRefresh(std::shared_ptr hi) { */ void HistoryService::clearAllHistory() { - getStorageManager()->deleteHistory(); + bp_history_adaptor_reset(); + history_list.clear(); +} + +int HistoryService::getHistoryId(const std::string & url) +{ + bp_history_rows_cond_fmt conds; + conds.limit = -1; + conds.offset = 0; + conds.order_offset = BP_HISTORY_O_DATE_CREATED; + conds.ordering = 0; + conds.period_offset = BP_HISTORY_O_DATE_CREATED; + conds.period_type = BP_HISTORY_DATE_ALL; + int *ids = 0; + int ids_count = 0; + int ret = bp_history_adaptor_get_cond_ids_p(&ids ,&ids_count, &conds, BP_HISTORY_O_URL, url.c_str(), 0); + if (ids_count!=0){ + int i = *ids; + free(ids); + return i; + } + return 0; } /** @@ -149,9 +174,12 @@ void HistoryService::clearAllHistory() */ void HistoryService::clearURLHistory(const std::string & url) { - getStorageManager()->deleteHistory(url); - if(0 == getHistoryItemsCount()){ - historyEmpty(true); + int id = getHistoryId(url); + if (id != 0) + bp_history_adaptor_delete(id); + if (0 == (getHistoryItemsCount() - 1)) { + historyEmpty(true); + history_list.clear(); } } @@ -182,13 +210,35 @@ HistoryItemVector& HistoryService::getHistoryItems(int historyDepthInDays, int m BROWSER_LOGD("Error! Could not get ids!"); } - bp_history_offset offset = (BP_HISTORY_O_URL | BP_HISTORY_O_TITLE | BP_HISTORY_O_FAVICON); + bp_history_offset offset = (BP_HISTORY_O_URL | BP_HISTORY_O_TITLE | BP_HISTORY_O_FAVICON | BP_HISTORY_O_DATE_CREATED); for(int i = 0; i< (*count1); i++){ bp_history_info_fmt history_info; bp_history_adaptor_get_info(ids[i],offset,&history_info); + int date; + bp_history_adaptor_get_date_created(ids[i], &date); + + struct tm *item_time_info; + time_t item_time = (time_t)date; + item_time_info = localtime(&item_time); + + int m_year = item_time_info->tm_year; + int m_month = item_time_info->tm_mon + 1; + int m_day = item_time_info->tm_yday; + int m_month_day = item_time_info->tm_mday; + int m_date = date; + int min = item_time_info->tm_min; + int hour= item_time_info->tm_hour; + int sec = item_time_info->tm_sec; + m_year = 2000 + m_year % 100; + std::shared_ptr history = std::make_shared(std::string(history_info.url)); + boost::gregorian::date d(m_year,m_month,m_month_day); + boost::posix_time::ptime t(d,boost::posix_time::time_duration(hour,min,sec)); + history->setLastVisit(t); + history->setUrl(std::string(history_info.url ? history_info.url : "")); + history->setTitle(std::string(history_info.title ? history_info.title : "")); history_list.push_back(history); } ids = NULL; diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 3b6ee0d..a25ef5d 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -978,6 +978,7 @@ void SimpleUI::disableHistoryButton(bool flag) { BROWSER_LOGD("[%s:%d] flag:%d ", __PRETTY_FUNCTION__, __LINE__, flag); m_history->setEnabled(!flag); + m_settingDeleteHistory->setEnabled(m_historyService->getHistoryItemsCount()); hidePopup(); } -- 2.7.4 From d1cea92b3c285b651f1ea525acc8c62317f5a449 Mon Sep 17 00:00:00 2001 From: Jung Ick Guack Date: Tue, 30 Jun 2015 21:37:15 +0900 Subject: [PATCH 04/16] 1) Fixed a crash of adding bookmark. (Added null checking) 2) Added privilege for using browser-provider Change-Id: I2c9c8b4208e9d1ff7b951419fad15ed404a170bb Signed-off-by: Jung Ick Guack --- manifest.xml.in | 4 ++++ services/BookmarkService/BookmarkService.cpp | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/manifest.xml.in b/manifest.xml.in index b8756da..8c4c7f1 100644 --- a/manifest.xml.in +++ b/manifest.xml.in @@ -73,4 +73,8 @@ + + http://tizen.org/privilege/bookmark.admin + http://tizen.org/privilege/history.admin + diff --git a/services/BookmarkService/BookmarkService.cpp b/services/BookmarkService/BookmarkService.cpp index 2fd0bf7..99b14e2 100644 --- a/services/BookmarkService/BookmarkService.cpp +++ b/services/BookmarkService/BookmarkService.cpp @@ -97,14 +97,16 @@ std::shared_ptr BookmarkService::addToBookmarks( bp_bookmark_adaptor_set_url(bookmark_id, address.c_str()); bp_bookmark_adaptor_set_title(bookmark_id, tittle.c_str()); - - std::unique_ptr thumb_blob = tizen_browser::tools::EflTools::getBlobPNG(thumbnail); - unsigned char * thumb = std::move((unsigned char*)thumb_blob->getData()); - bp_bookmark_adaptor_set_snapshot(bookmark_id, thumbnail->width, thumbnail->height, thumb, thumb_blob->getLength()); - - std::unique_ptr favicon_blob = tizen_browser::tools::EflTools::getBlobPNG(favicon); - unsigned char * fav = std::move((unsigned char*)favicon_blob->getData()); - bp_bookmark_adaptor_set_icon(bookmark_id, favicon->width, favicon->height, fav, favicon_blob->getLength()); + if (thumbnail) { + std::unique_ptr thumb_blob = tizen_browser::tools::EflTools::getBlobPNG(thumbnail); + unsigned char * thumb = std::move((unsigned char*)thumb_blob->getData()); + bp_bookmark_adaptor_set_snapshot(bookmark_id, thumbnail->width, thumbnail->height, thumb, thumb_blob->getLength()); + } + if (favicon) { + std::unique_ptr favicon_blob = tizen_browser::tools::EflTools::getBlobPNG(favicon); + unsigned char * fav = std::move((unsigned char*)favicon_blob->getData()); + bp_bookmark_adaptor_set_icon(bookmark_id, favicon->width, favicon->height, fav, favicon_blob->getLength()); + } m_bookmarks.push_back(bookmark); BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); -- 2.7.4 From 8d99569cc11767afa8c7fd7cda7289bb5c32d3cc Mon Sep 17 00:00:00 2001 From: Jung Ick Guack Date: Thu, 2 Jul 2015 09:43:32 +0900 Subject: [PATCH 05/16] Changed "opengl" to "3d" on elm_config_accel_preference_set Change-Id: I227e313d22ffaf5b5294da53bbf232d1943cd4f7 Signed-off-by: Jung Ick Guack --- core/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 core/main.cpp diff --git a/core/main.cpp b/core/main.cpp old mode 100644 new mode 100755 index f435d7e..9342b05 --- a/core/main.cpp +++ b/core/main.cpp @@ -38,7 +38,8 @@ const std::string DEFAULT_URL = ""; static bool app_create(void * /*app_data*/) { - elm_config_accel_preference_set("opengl"); +// elm_config_accel_preference_set("opengl"); + elm_config_accel_preference_set("3d"); elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK); // Enabling focus -- 2.7.4 From c55051a1a252e538fd50bdc07fcf17713464a3a1 Mon Sep 17 00:00:00 2001 From: Jung Ick Guack Date: Thu, 2 Jul 2015 09:44:48 +0900 Subject: [PATCH 06/16] Fixed app service is not working during runtime. Change-Id: Ie0ed329ba8449debae7e5d81372097b15c62957e Signed-off-by: Jung Ick Guack --- services/SimpleUI/SimpleUI.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index a25ef5d..f2567ba 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -294,26 +294,27 @@ int SimpleUI::exec(const std::string& _url) } m_initialised = true; - // only when first run - if (url.empty()) { - BROWSER_LOGD("[%s]: changing to homeUrl", __func__); - switchViewToHomePage(); - filterURL(HomePageURL); - if(lastSession.items().size() >= 1){ - for(auto iter=lastSession.items().begin(), - end=lastSession.items().end(); - iter != end; - iter++ - ){ - openNewTab(iter->second); - } - m_sessionService->getStorage()->deleteSession(lastSession); - } - } - else - openNewTab(url); } + // only when first run + if (url.empty()) { + BROWSER_LOGD("[%s]: changing to homeUrl", __func__); + switchViewToHomePage(); + filterURL(HomePageURL); + if(lastSession.items().size() >= 1){ + for(auto iter=lastSession.items().begin(), + end=lastSession.items().end(); + iter != end; + iter++ + ){ + openNewTab(iter->second); + } + m_sessionService->getStorage()->deleteSession(lastSession); + } + } + else + openNewTab(url); + BROWSER_LOGD("[%s]:%d url=%s", __func__, __LINE__, url.c_str()); m_simpleURI->setFocus(); -- 2.7.4 From bf8072a5a99133eea135c87d65559ed750dfde72 Mon Sep 17 00:00:00 2001 From: Jung Ick Guack Date: Thu, 2 Jul 2015 22:08:01 +0900 Subject: [PATCH 07/16] 1) Getting favicon by proper API. 2) Enabling create new tab by tag target attribute. - Removed smart class, Using smart callback 3) Changed toast text when delete data from setting 4) Not set user agent by full string, just set applicatino name for UA 5) Disabled function of private browsing Change-Id: I712044d64b791f28cd9608e876ba9472e8a08300 Signed-off-by: Jung Ick Guack --- services/SimpleUI/SimpleUI.cpp | 4 +-- services/WebKitEngineService/WebView.cpp | 58 ++++++++++++++++++++++++++------ services/WebKitEngineService/WebView.h | 1 + 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index f2567ba..7e514cc 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -422,7 +422,7 @@ void SimpleUI::connectActions() m_showSettingsPopup->triggered.connect(boost::bind(&SimpleUI::showSettingsMenu, this)); // m_settingPointerMode->toggled.connect(boost::bind(&tizen_browser::services::PlatformInputManager::setPointerModeEnabled, m_platformInputManager.get(), _1)); - m_settingPrivateBrowsing->toggled.connect(boost::bind(&SimpleUI::settingsPrivateModeSwitch, this, _1)); +// m_settingPrivateBrowsing->toggled.connect(boost::bind(&SimpleUI::settingsPrivateModeSwitch, this, _1)); m_settingDeleteHistory->triggered.connect(boost::bind(&SimpleUI::settingsDeleteHistory, this)); m_settingDeleteData->triggered.connect(boost::bind(&SimpleUI::settingsDeleteData, this));; m_settingDeleteFavorite->triggered.connect(boost::bind(&SimpleUI::settingsDeleteFavorite, this));; @@ -1061,7 +1061,7 @@ void SimpleUI::onDeleteDataButton(PopupButtons button, std::shared_ptr< PopupDat BROWSER_LOGD("[%s]: OK", __func__); m_webEngine->clearPrivateData(); webTitleBar->removeFavIcon(); - webTitleBar->show("Data deleted"); + webTitleBar->show("All cookies and cache are deleted"); hidePopup(); } } diff --git a/services/WebKitEngineService/WebView.cpp b/services/WebKitEngineService/WebView.cpp index 963e192..75ea343 100644 --- a/services/WebKitEngineService/WebView.cpp +++ b/services/WebKitEngineService/WebView.cpp @@ -46,6 +46,7 @@ #include "ServiceManager.h" #define certificate_crt_path CERTS_DIR +#define APPLICATION_NAME_FOR_USER_AGENT "SamsungBrowser/1.0" using namespace tizen_browser::tools; @@ -75,6 +76,8 @@ WebView::~WebView() void WebView::init(Evas_Object * opener) { #if defined(USE_EWEBKIT) + +#if 0 //not using smart class static Ewk_View_Smart_Class *clasz = NULL; Ewk_Context *context = ewk_context_default_get(); if (!clasz) { @@ -84,13 +87,11 @@ void WebView::init(Evas_Object * opener) // clasz->run_javascript_alert = onJavascriptAlert; // clasz->run_javascript_confirm = onJavascriptConfirm; // clasz->run_javascript_prompt = onJavascriptPrompt; -// clasz->window_create = onWindowCreate; -// clasz->window_close = onWindowClose; - + clasz->window_create = onWindowCreate; + clasz->window_close = onWindowClose; ewk_context_cache_model_set(context, EWK_CACHE_MODEL_PRIMARY_WEBBROWSER); ewk_context_certificate_file_set(context, certificate_crt_path); - } Evas_Smart *smart = evas_smart_class_new(&clasz->sc); @@ -98,8 +99,12 @@ void WebView::init(Evas_Object * opener) /// \todo: Consider process model. Now, One UIProcess / One WebProcess. // if (opener) // m_ewkView = ewk_view_smart_add(evas_object_evas_get(m_parent), smart, context, ewk_view_page_group_get(opener)); -// else + else m_ewkView = ewk_view_smart_add(evas_object_evas_get(m_parent), smart, context, ewk_page_group_create(NULL)); +#else + m_ewkView = ewk_view_add(evas_object_evas_get(m_parent)); +// Ewk_Context *context = ewk_view_context_get(m_ewkView); +#endif evas_object_data_set(m_ewkView, "_container", this); BROWSER_LOGD("%s:%d %s self=%p", __FILE__, __LINE__, __func__, this); @@ -107,14 +112,14 @@ void WebView::init(Evas_Object * opener) evas_object_color_set(m_ewkView, 255, 255, 255, 255); evas_object_size_hint_weight_set(m_ewkView, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(m_ewkView, EVAS_HINT_FILL, EVAS_HINT_FILL); - ewk_view_user_agent_set(m_ewkView, "Mozilla/5.0 (X11; SMART-TV; Linux) AppleWebkit/538.1 (KHTML, like Gecko) Safari/538.1"); + ewk_view_application_name_for_user_agent_set(m_ewkView, APPLICATION_NAME_FOR_USER_AGENT); //\todo: when value is other than 1.0, scroller is located improperly // ewk_view_device_pixel_ratio_set(m_ewkView, 1.0f); #if PLATFORM(TIZEN) ewk_view_resume(m_ewkView); #endif - +#if 0 // set local storage, favion, cookies std::string webkit_path = boost::any_cast (config.get("webkit/dir")); // ewk_context_web_storage_path_set(context, (webkit_path + std::string("/storage")).c_str()); @@ -127,7 +132,7 @@ void WebView::init(Evas_Object * opener) // ewk_cookie_manager_widget_cookie_directory_set(ewk_context_cookie_manager_get(context), webkit_path.c_str()); ewk_favicon_database_icon_change_callback_add(ewk_context_favicon_database_get(context), __faviconChanged, this); - +#endif setupEwkSettings(); registerCallbacks(); #else @@ -149,6 +154,8 @@ void WebView::registerCallbacks() evas_object_smart_callback_add(m_ewkView, "back,forward,list,changed", __backForwardListChanged, this); + evas_object_smart_callback_add(m_ewkView, "create,window", __OnNewWindowRequest, this); + evas_object_smart_callback_add(m_ewkView, "geolocation,permission,request", __geolocationPermissionRequest, this); evas_object_smart_callback_add(m_ewkView, "usermedia,permission,request", __usermediaPermissionRequest, this); evas_object_smart_callback_add(m_ewkView, "notification,permission,request", __notificationPermissionRequest, this); @@ -177,6 +184,8 @@ void WebView::unregisterCallbacks() evas_object_smart_callback_del_full(m_ewkView, "back,forward,list,changed", __backForwardListChanged, this); + evas_object_smart_callback_del_full(m_ewkView, "create,window", __OnNewWindowRequest, this); + evas_object_smart_callback_del_full(m_ewkView, "geolocation,permission,request", __geolocationPermissionRequest, this); evas_object_smart_callback_del_full(m_ewkView, "usermedia,permission,request", __usermediaPermissionRequest, this); evas_object_smart_callback_del_full(m_ewkView, "notification,permission,request", __notificationPermissionRequest, this); @@ -712,6 +721,30 @@ void WebView::__backForwardListChanged(void * data, Evas_Object * /* obj */, voi self->forwardEnableChanged(self->isForwardEnabled()); } +void WebView::__OnNewWindowRequest(void *data, Evas_Object*, void* out) +{ + BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); + + WebView * self = reinterpret_cast(data); + BROWSER_LOGD("Window creating in tab: %s", self->getTabId().toString().c_str()); + + std::shared_ptr> m_webEngine; + m_webEngine = std::dynamic_pointer_cast + < + basic_webengine::AbstractWebEngine,tizen_browser::core::AbstractService + > + (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.webkitengineservice")); + 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(out) = tab_ewk_view; +} + + #if PLATFORM(TIZEN) void WebView::__faviconChanged(const char * uri, void * data) #else @@ -965,12 +998,15 @@ std::shared_ptr WebView::getFavicon() { #if defined(USE_EWEBKIT) if (faviconImage.get() == NULL) { -//#if PLATFORM(TIZEN) + +#if PLATFORM(TIZEN) // Evas_Object * favicon = ewk_view_favicon_get(m_ewkView); -//#else + Evas_Object * favicon = ewk_context_icon_database_icon_object_add(ewk_view_context_get(m_ewkView), ewk_view_url_get(m_ewkView),evas_object_evas_get(m_ewkView)); +#else Ewk_Favicon_Database * database = ewk_context_favicon_database_get(ewk_view_context_get(m_ewkView)); Evas_Object * favicon = ewk_favicon_database_icon_get(database, ewk_view_url_get(m_ewkView), evas_object_evas_get(m_ewkView)); -//#endif +#endif + #ifndef NDEBUG int w = 0, h = 0; evas_object_image_size_get(favicon, &w, &h); diff --git a/services/WebKitEngineService/WebView.h b/services/WebKitEngineService/WebView.h index 0b6b504..ce6233d 100644 --- a/services/WebKitEngineService/WebView.h +++ b/services/WebKitEngineService/WebView.h @@ -165,6 +165,7 @@ private: static void __urlChanged(void * data, Evas_Object * obj, void * event_info); static void __backForwardListChanged(void * data, Evas_Object * obj, void * event_info); + static void __OnNewWindowRequest(void *data, Evas_Object*, void* out); // Favicon - from database #if defined(USE_EWEBKIT) -- 2.7.4 From a16dfb0bd899bd791f1aff1eebc501b2a3153a45 Mon Sep 17 00:00:00 2001 From: Jung Ick Guack Date: Thu, 2 Jul 2015 22:23:14 +0900 Subject: [PATCH 08/16] Release 0.0.9 Change-Id: I8d0ec64259ef4e777885a88cbb589a810d0a52c4 Signed-off-by: Jung Ick Guack --- packaging/org.tizen.browser.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/org.tizen.browser.spec b/packaging/org.tizen.browser.spec index 66ddef9..44c7454 100644 --- a/packaging/org.tizen.browser.spec +++ b/packaging/org.tizen.browser.spec @@ -1,6 +1,6 @@ Name: org.tizen.browser Summary: Tizen TV Open Browser -Version: 0.0.8 +Version: 0.0.9 Release: 0 Group: Applications/Web License: Apache-2.0 -- 2.7.4 From efd182a79d7c101a9a673a27c02f1d4331fdd373 Mon Sep 17 00:00:00 2001 From: "sungwon2.han" Date: Mon, 6 Jul 2015 15:37:14 +0900 Subject: [PATCH 09/16] Change to use wayland functions instead of x functions ecore_x_window_size_get --> ecore_wl_screen_size_get Change-Id: Ib72381ba8e5e515126afe3db2c83d964c0ccd563 Signed-off-by: sungwon2.han --- services/SimpleUI/SimpleUI.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 7e514cc..25e1648 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include "Config.h" @@ -115,11 +116,12 @@ int SimpleUI::exec(const std::string& _url) elm_win_alpha_set(m_window.get(), EINA_FALSE); // creatin main window - //int width = 1920; - //int height = 1080; + int width = 0; + int height = 0; //ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height); - //evas_object_move(m_window.get(), 0, 0); - //evas_object_resize(m_window.get(), width, height); + ecore_wl_screen_size_get(&width, &height); + evas_object_move(m_window.get(), 0, 0); + evas_object_resize(m_window.get(), width, height); // create main layout m_mainLayout = elm_layout_add(m_window.get()); -- 2.7.4 From fcd845fabd9482713d888d0303b221a7428a0ee0 Mon Sep 17 00:00:00 2001 From: "sungwon2.han" Date: Mon, 6 Jul 2015 17:59:07 +0900 Subject: [PATCH 10/16] Temporarily comment out "Back key" process routine Change-Id: I29a9b4ba24a02d78e33c7fc88447187eed59e89c Signed-off-by: sungwon2.han --- services/PlatformInputManager/PlatformInputManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/PlatformInputManager/PlatformInputManager.cpp b/services/PlatformInputManager/PlatformInputManager.cpp index b4c6925..e7cc333 100644 --- a/services/PlatformInputManager/PlatformInputManager.cpp +++ b/services/PlatformInputManager/PlatformInputManager.cpp @@ -170,8 +170,8 @@ Eina_Bool PlatformInputManager::__filter(void *data, void */*loop_data*/, int ty self->rightPressed(); else if(!keyName.compare("KEY_ENTER")) self->enterPressed(); - else if(!keyName.compare("BackSpace")) - self->backPressed(); +// else if(!keyName.compare("BackSpace")) +// self->backPressed(); } else if(type == ECORE_EVENT_KEY_UP) { M_ASSERT(event); Ecore_Event_Key *ev = static_cast(event); -- 2.7.4 From 9dff14d6598e027d47bc2d8de39eccbd88d90c89 Mon Sep 17 00:00:00 2001 From: "sungwon2.han" Date: Tue, 7 Jul 2015 13:50:54 +0900 Subject: [PATCH 11/16] Delete "Private Browsing" menu item from "Settings" Change-Id: Ifb7a23d1bbc618469f055054188e5bc51f0bcc59 Signed-off-by: sungwon2.han --- services/SimpleUI/SimpleUI.cpp | 4 +++- services/SimpleUI/SimpleUI.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 25e1648..11dd807 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -388,11 +388,13 @@ void SimpleUI::createActions() m_settingPointerMode->setChecked(m_platformInputManager->getPointerModeEnabled()); m_settingPointerMode->setEnabled(true); */ +/* m_settingPrivateBrowsing = sharedAction(new Action("Private browsing")); m_settingPrivateBrowsing->setToolTip("On exit from private mode all cookies, history, and stored data will be deleted"); m_settingPrivateBrowsing->setCheckable(true); m_settingPrivateBrowsing->setChecked(m_webEngine->isPrivateMode()); m_settingPrivateBrowsing->setEnabled(true); +*/ m_settingDeleteHistory = sharedAction(new Action("Delete history")); m_settingDeleteHistory->setToolTip("Delete History"); @@ -943,7 +945,7 @@ void SimpleUI::showSettingsMenu() m_settings = std::make_shared(m_window, rightButtonBar->getButton("setting_button")); //m_settings->addAction( m_settingPointerMode); - m_settings->addAction( m_settingPrivateBrowsing); + //m_settings->addAction( m_settingPrivateBrowsing); m_settings->addAction( m_settingDeleteHistory); m_settings->addAction( m_settingDeleteData); m_settings->addAction( m_settingDeleteFavorite); diff --git a/services/SimpleUI/SimpleUI.h b/services/SimpleUI/SimpleUI.h index 793f87e..5c5f736 100644 --- a/services/SimpleUI/SimpleUI.h +++ b/services/SimpleUI/SimpleUI.h @@ -146,7 +146,7 @@ private: sharedAction m_zoom_in; sharedAction m_showSettingsPopup; sharedAction m_settingPointerMode; - sharedAction m_settingPrivateBrowsing; +// sharedAction m_settingPrivateBrowsing; sharedAction m_settingDeleteHistory; sharedAction m_settingDeleteData; sharedAction m_settingDeleteFavorite; -- 2.7.4 From 62504c62a996bff27364d3647ced0a2ea022ac15 Mon Sep 17 00:00:00 2001 From: "sungwon2.han" Date: Tue, 7 Jul 2015 14:23:30 +0900 Subject: [PATCH 12/16] Change text wrap type of popup object from CHAR to WORD Change-Id: Ib47aa1c143aca49c0fe079383efc77e0aaaacf68 Signed-off-by: sungwon2.han --- services/SimpleUI/SimplePopup.cpp | 2 +- services/SimpleUI/SimpleUI.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/SimpleUI/SimplePopup.cpp b/services/SimpleUI/SimplePopup.cpp index f732b78..363e905 100644 --- a/services/SimpleUI/SimplePopup.cpp +++ b/services/SimpleUI/SimplePopup.cpp @@ -48,7 +48,7 @@ namespace base_ui else elm_object_text_set(popup, message.c_str()); - elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR); + elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_WORD); elm_object_part_text_set(popup, "title,text", title.c_str()); int buttonsCounter = 1; diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 11dd807..ef0d403 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -1054,7 +1054,7 @@ void SimpleUI::onDeleteHistoryButton(PopupButtons button, std::shared_ptr< Popup m_historyService->clearAllHistory(); m_history->setEnabled(false); webTitleBar->removeFavIcon(); - webTitleBar->show("History deleted"); + webTitleBar->show("All histories are deleted"); hidePopup(); } } -- 2.7.4 From 5a46456b251233e8cb1e9bbbe2582ec93ecd7150 Mon Sep 17 00:00:00 2001 From: Jung Ick Guack Date: Thu, 9 Jul 2015 10:18:46 +0900 Subject: [PATCH 13/16] Fixed privilege for web-history.admin Change-Id: I3c3c35421d7bb229af00e283e4686eafde7268a4 Signed-off-by: Jung Ick Guack --- manifest.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.xml.in b/manifest.xml.in index 8c4c7f1..830ea63 100644 --- a/manifest.xml.in +++ b/manifest.xml.in @@ -75,6 +75,6 @@ http://tizen.org/privilege/bookmark.admin - http://tizen.org/privilege/history.admin + http://tizen.org/privilege/web-history.admin -- 2.7.4 From 9cb571cfab95739c8ae6413e32b62558d499ad00 Mon Sep 17 00:00:00 2001 From: "t.dakowicz" Date: Thu, 30 Jul 2015 11:24:24 +0200 Subject: [PATCH 14/16] Bug TT-81 Changed URL validation regex [Issue#] https://bugs.tizen.org/jira/browse/TT-81 [Problem] Browser tries to navigate to malformed URLs instead of putting them into search engine query [Solution] Corrected the regex [Verify] Check if URLs with spaces are put into Google's search query Change-Id: Ic49cfa498194cf878bab70007a7dae8ada53708e --- services/SimpleURI/SimpleURI.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/services/SimpleURI/SimpleURI.cpp b/services/SimpleURI/SimpleURI.cpp index 104cfc2..d92c64e 100644 --- a/services/SimpleURI/SimpleURI.cpp +++ b/services/SimpleURI/SimpleURI.cpp @@ -254,25 +254,21 @@ void SimpleURI::editingCompleted() std::string SimpleURI::rewriteURI(const std::string& url) { - BROWSER_LOGD("%s: %s", __PRETTY_FUNCTION__, url.c_str()); - - //regx form site http://code.tutsplus.com/tutorials/8-regular-expressions-you-should-know--net-6149 - //it matches urls with https? sufix or without it - boost::regex urlRegex(R"(^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$)"); - boost::regex protocolRegex(R"(^https?:\/\/)"); - + boost::regex urlRegex(R"(^(https?|ftp)://[^\s/$.?#].[^\s]*$)"); if(!url.empty()) { - if(url != "about:blank" && url != "about:home" && !boost::regex_search(url, protocolRegex)) { - if(!boost::regex_match(url, urlRegex)) { - std::string searchString("https://www.google.pl/search?q="); /* this seems to work better than https://www.google.pl/#q= on current WebKit engine */ + if(url != "about:blank" && url != "about:home") { + if(boost::regex_match(url, urlRegex)) { + return url; + } else if(boost::regex_match( std::string("http://") + url, urlRegex) && url.find(".") != std::string::npos) { + return std::string("http://") + url; + } else { + std::string searchString("http://www.google.com/#q="); searchString += url; std::replace( searchString.begin(), searchString.end(), ' ', '+'); - BROWSER_LOGD("[%s:%d] Rewrited search string: %s", __PRETTY_FUNCTION__, __LINE__, searchString.c_str()); - return searchString; - } else { - return std::string("http://") + url; + BROWSER_LOGD("[%s:%d] Search string: %s", __PRETTY_FUNCTION__, __LINE__, searchString.c_str()); + return searchString; } } } -- 2.7.4 From 3f1f55aa1e8878bb334b3d5b5cd27f8ad5a33ce3 Mon Sep 17 00:00:00 2001 From: "t.dakowicz" Date: Fri, 31 Jul 2015 10:35:44 +0200 Subject: [PATCH 15/16] Bug TT-87 History button is disabled after opening a browser [Issue#] https://bugs.tizen.org/jira/browse/TT-87 [Problem] History is not loaded on a first run, it is done after invoking SimpleUI::showHistory() [Solution] Loaded the history at the beginning [Verify] Check if the history can be shown after opening a browser Change-Id: I875e2813ec641cf861d4eaff6c7a393e92e74e11 --- services/SimpleUI/SimpleUI.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index ef0d403..f40754a 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -369,6 +369,7 @@ void SimpleUI::createActions() m_history = sharedAction(new Action("History")); m_history->setToolTip("History"); m_history->setIcon("browser/toolbar_history"); + m_historyService->getHistoryItems(); if(m_historyService->getHistoryItemsCount() == 0){ m_history->setEnabled(false); } -- 2.7.4 From 81362faefc61e3672a9505a7c35e06ade4a46a8c Mon Sep 17 00:00:00 2001 From: "t.dakowicz" Date: Wed, 5 Aug 2015 13:47:59 +0200 Subject: [PATCH 16/16] Bug TT-88 Fixed asynchronous favicon loading [Issue] https://bugs.tizen.org/jira/browse/TT-88 [Problem] Favicon wasn't loaded if an image was send asynchronously [Solution] Used "icon,received" callback instead of "favicon,change" which is not implemented [Verify] Check if favicon is always loaded Change-Id: If56b9b4d80bc4a94abd52b0830aac42dfa88216f --- services/SimpleURI/SimpleURI.cpp | 52 +++++++++++++----------------- services/WebKitEngineService/WebView.cpp | 54 ++++++++------------------------ services/WebKitEngineService/WebView.h | 11 +------ 3 files changed, 36 insertions(+), 81 deletions(-) diff --git a/services/SimpleURI/SimpleURI.cpp b/services/SimpleURI/SimpleURI.cpp index d92c64e..cc07c13 100644 --- a/services/SimpleURI/SimpleURI.cpp +++ b/services/SimpleURI/SimpleURI.cpp @@ -16,7 +16,6 @@ #include #include - #include "SimpleURI.h" #include "ServiceManager.h" #include "BrowserLogger.h" @@ -29,7 +28,6 @@ namespace base_ui{ EXPORT_SERVICE(SimpleURI, "org.tizen.browser.simpleuri") - const std::string keynameSelect = "Select"; const std::string keynameClear = "Clear"; const std::string keynameKP_Enter = "KP_Enter"; @@ -47,11 +45,11 @@ SimpleURI::SimpleURI() elm_theme_extension_add(NULL, edjFilePath.c_str()); } -SimpleURI::~SimpleURI() { +SimpleURI::~SimpleURI() +{} -} - -Evas_Object * SimpleURI::getContent(Evas_Object *main_layout) { +Evas_Object * SimpleURI::getContent(Evas_Object *main_layout) +{ if(!m_entry_layout) { m_entry_layout = elm_layout_add(main_layout); std::string edjFilePath = EDJE_DIR; @@ -87,7 +85,6 @@ Evas_Object * SimpleURI::getContent(Evas_Object *main_layout) { m_entryBtn = elm_button_add(m_entry_layout); evas_object_event_callback_add(m_entryBtn, EVAS_CALLBACK_MOUSE_IN, __cb_mouse_in, this); - //evas_object_event_callback_add(m_entryBtn, EVAS_CALLBACK_MOUSE_OUT, __cb_mouse_out, this); evas_object_smart_callback_add(m_entryBtn, "focused", SimpleURI::focusedBtn, this); evas_object_smart_callback_add(m_entryBtn, "unfocused", SimpleURI::unfocusedBtn, this); @@ -118,6 +115,7 @@ void SimpleURI::setFavIcon(std::shared_ptr< tizen_browser::tools::BrowserImage > setDocIcon(); } } + void SimpleURI::setCurrentFavIcon() { m_currentIconType = IconTypeFav; @@ -129,6 +127,7 @@ void SimpleURI::setSearchIcon() m_currentIconType = IconTypeSearch; elm_object_signal_emit(m_entry_layout, "set_search_icon", "model"); } + void SimpleURI::setDocIcon() { m_currentIconType = IconTypeDoc; @@ -177,10 +176,12 @@ void SimpleURI::aborted(void *data, Evas_Object * /* obj */, void */*event_info* SimpleURI *self = reinterpret_cast(data); self->editingCanceled(); } + void SimpleURI::preeditChange(void * /* data */, Evas_Object * /* obj */, void */*event_info*/) { BROWSER_LOGD("%s", __func__); } + void SimpleURI::changedUser(void *data, Evas_Object * /* obj */, void */*event_info*/) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); @@ -215,8 +216,6 @@ void SimpleURI::fixed_entry_key_down_handler(void* data, Evas* /*e*/, Evas_Objec { BROWSER_LOGD("%s", __func__); Evas_Event_Key_Down *ev = static_cast(event_info); - //BROWSER_LOGD("[%s:%d]: keyname: \"%s\"", __PRETTY_FUNCTION__, __LINE__, ev->keyname); - if (!data || !ev || !ev->keyname) return; SimpleURI * self = static_cast(data); @@ -225,14 +224,12 @@ void SimpleURI::fixed_entry_key_down_handler(void* data, Evas* /*e*/, Evas_Objec elm_entry_entry_set(self->m_entry, ""); return; } - if ( keynameSelect == ev->keyname || keynameReturn == ev->keyname || keynameKP_Enter == ev->keyname) { self->editingCompleted(); return; } - if( keynameEsc == ev->keyname){ self->editingCanceled(); elm_object_focus_set(self->m_entryBtn, EINA_TRUE); @@ -257,22 +254,20 @@ std::string SimpleURI::rewriteURI(const std::string& url) BROWSER_LOGD("%s: %s", __PRETTY_FUNCTION__, url.c_str()); boost::regex urlRegex(R"(^(https?|ftp)://[^\s/$.?#].[^\s]*$)"); - if(!url.empty()) { - if(url != "about:blank" && url != "about:home") { - if(boost::regex_match(url, urlRegex)) { - return url; - } else if(boost::regex_match( std::string("http://") + url, urlRegex) && url.find(".") != std::string::npos) { - return std::string("http://") + url; - } else { - std::string searchString("http://www.google.com/#q="); - searchString += url; - std::replace( searchString.begin(), searchString.end(), ' ', '+'); - BROWSER_LOGD("[%s:%d] Search string: %s", __PRETTY_FUNCTION__, __LINE__, searchString.c_str()); - return searchString; - } + if(!url.empty() && url != "about:blank" && url != "about:home") + if(boost::regex_match(url, urlRegex)) + return url; + else if(boost::regex_match( std::string("http://") + url, urlRegex) && url.find(".") != std::string::npos) + return std::string("http://") + url; + else + { + std::string searchString("http://www.google.com/search?q="); + searchString += url; + std::replace( searchString.begin(), searchString.end(), ' ', '+'); + BROWSER_LOGD("[%s:%d] Search string: %s", __PRETTY_FUNCTION__, __LINE__, searchString.c_str()); + return searchString; } - } - BROWSER_LOGD("%s", __PRETTY_FUNCTION__); + return url; } @@ -288,9 +283,6 @@ void SimpleURI::editingCanceled() setCurrentFavIcon(); } - - - void SimpleURI::AddAction(sharedAction action) { m_actions.push_back(action); @@ -347,4 +339,4 @@ void SimpleURI::setDisabled(bool disabled) } } -} +} \ No newline at end of file diff --git a/services/WebKitEngineService/WebView.cpp b/services/WebKitEngineService/WebView.cpp index 75ea343..eede78c 100644 --- a/services/WebKitEngineService/WebView.cpp +++ b/services/WebKitEngineService/WebView.cpp @@ -130,8 +130,6 @@ void WebView::init(Evas_Object * opener) ///\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()); - - ewk_favicon_database_icon_change_callback_add(ewk_context_favicon_database_get(context), __faviconChanged, this); #endif setupEwkSettings(); registerCallbacks(); @@ -163,7 +161,7 @@ void WebView::registerCallbacks() evas_object_smart_callback_add(m_ewkView, "request,certificate,confirm", __requestCertificationConfirm, this); evas_object_event_callback_add(m_ewkView, EVAS_CALLBACK_MOUSE_DOWN, __setFocusToEwkView, this); - evas_object_smart_callback_add(m_ewkView, "favicon,changed", onFaviconChaged, this); + evas_object_smart_callback_add(m_ewkView, "icon,received", __faviconChanged, this); evas_object_smart_callback_add(m_ewkView, "editorclient,ime,closed", __IMEClosed, this); evas_object_smart_callback_add(m_ewkView, "editorclient,ime,opened", __IMEOpened, this); @@ -193,7 +191,7 @@ void WebView::unregisterCallbacks() evas_object_smart_callback_del_full(m_ewkView, "request,certificate,confirm", __requestCertificationConfirm, this); evas_object_event_callback_del(m_ewkView, EVAS_CALLBACK_MOUSE_DOWN, __setFocusToEwkView); - evas_object_smart_callback_del_full(m_ewkView, "favicon,changed", onFaviconChaged, this); + evas_object_smart_callback_del_full(m_ewkView, "icon,received", __faviconChanged, this); evas_object_smart_callback_del_full(m_ewkView, "editorclient,ime,closed", __IMEClosed, this); evas_object_smart_callback_del_full(m_ewkView, "editorclient,ime,opened", __IMEOpened, this); @@ -744,44 +742,18 @@ void WebView::__OnNewWindowRequest(void *data, Evas_Object*, void* out) *static_cast(out) = tab_ewk_view; } - -#if PLATFORM(TIZEN) -void WebView::__faviconChanged(const char * uri, void * data) -#else -void WebView::__faviconChanged(Ewk_Favicon_Database * database, const char * uri, void * data) -#endif -{ - WebView * self = reinterpret_cast(data); - BROWSER_LOGD("[%s:%d] \n\turi:%s", __PRETTY_FUNCTION__, __LINE__, uri); - -#if PLATFORM(TIZEN) - Ewk_Favicon_Database * database = ewk_context_favicon_database_get(ewk_view_context_get(self->m_ewkView)); -#endif - - Evas_Object *favicon = ewk_favicon_database_icon_get(database, uri, evas_object_evas_get(self->m_parent)); - BROWSER_LOGD("Favicon: %p",favicon); - if (favicon) { - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - self->faviconImage = tizen_browser::tools::EflTools::getBrowserImage(favicon); - evas_object_unref(favicon); - BROWSER_LOGD("[%s:%d] Favicon loaded, emiting favIconChanged(...)", __PRETTY_FUNCTION__, __LINE__); - self->favIconChanged(self->faviconImage); - } -} - -void WebView::onFaviconChaged(void* data, Evas_Object*, void*) +void WebView::__faviconChanged(void* data, Evas_Object*, void*) { - WebView* self = reinterpret_cast(data); -//#if PLATFORM(TIZEN) -// Evas_Object * favicon = ewk_view_favicon_get(self->m_ewkView); -//#else - Ewk_Favicon_Database * database = ewk_context_favicon_database_get(ewk_view_context_get(self->m_ewkView)); - Evas_Object * favicon = ewk_favicon_database_icon_get(database, ewk_view_url_get(self->m_ewkView), evas_object_evas_get(self->m_parent)); -//#endif - BROWSER_LOGD("[%s:%d] &favicon: %x ", __PRETTY_FUNCTION__, __LINE__, favicon); - if (favicon) { - self->favIconChanged(tizen_browser::tools::EflTools::getBrowserImage(favicon)); - evas_object_unref(favicon); + if(data) + { + WebView * self = static_cast(data); + Evas_Object * favicon = ewk_context_icon_database_icon_object_add(ewk_view_context_get(self->m_ewkView), ewk_view_url_get(self->m_ewkView),evas_object_evas_get(self->m_ewkView)); + if (favicon) { + BROWSER_LOGD("[%s:%d] Favicon received", __PRETTY_FUNCTION__, __LINE__); + self->faviconImage = tizen_browser::tools::EflTools::getBrowserImage(favicon); + evas_object_unref(favicon); + self->favIconChanged(self->faviconImage); + } } } diff --git a/services/WebKitEngineService/WebView.h b/services/WebKitEngineService/WebView.h index ce6233d..13257a4 100644 --- a/services/WebKitEngineService/WebView.h +++ b/services/WebKitEngineService/WebView.h @@ -168,16 +168,7 @@ private: static void __OnNewWindowRequest(void *data, Evas_Object*, void* out); // Favicon - from database -#if defined(USE_EWEBKIT) -#if PLATFORM(TIZEN) - static void __faviconChanged(/* Ewk_Favicon_Database * database, */ const char * uri, void * data); -#else - static void __faviconChanged(Ewk_Favicon_Database * database, const char * uri, void * data); -#endif -#endif - - //from webkit ewk_view - static void onFaviconChaged(void * data, Evas_Object *obj, void *event_info); + static void __faviconChanged(void* data, Evas_Object*, void*); static void __IMEClosed(void * data, Evas_Object *obj, void *event_info); static void __IMEOpened(void * data, Evas_Object *obj, void *event_info); -- 2.7.4