From: Kamil Nowac Date: Mon, 24 Oct 2016 10:16:45 +0000 (+0200) Subject: Fix APP_CONTROL_OPERATION_SEARCH X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b2a22d0c00c09496f9573b42d0af85da5fc30bb;p=profile%2Fcommon%2Fapps%2Fweb%2Fbrowser.git Fix APP_CONTROL_OPERATION_SEARCH [Issue] http://suprem.sec.samsung.net/jira/browse/TSAM-9176 [Problem] Open blank page [Solution] Change behaviour for operation search [Verify] As in the issue Change-Id: Ia5a62f0d05157c9523d3b79fc74d10df6d7a3bf1 --- diff --git a/core/BasicUI/AbstractMainWindow.h b/core/BasicUI/AbstractMainWindow.h index 29baf9f4..5aa0196d 100644 --- a/core/BasicUI/AbstractMainWindow.h +++ b/core/BasicUI/AbstractMainWindow.h @@ -47,7 +47,10 @@ public: : m_window() {} - virtual int exec(const std::string& url, const std::string& caller) = 0; + virtual int exec( + const std::string& url, + const std::string& caller, + const std::string& operation) = 0; std::shared_ptr getMainWindow(){return m_window;}; /** diff --git a/core/main.cpp b/core/main.cpp index a8105036..bdaf41f5 100755 --- a/core/main.cpp +++ b/core/main.cpp @@ -159,14 +159,14 @@ static void app_control(app_control_h app_control, void* app_data){ if ((operation && !strcmp(operation, APP_CONTROL_OPERATION_SEARCH )) && ((app_control_get_extra_data(app_control, "http://tizen.org/appcontrol/data/keyword", &search_keyword) == APP_CONTROL_ERROR_NONE) || - (app_control_get_extra_data(app_control, APP_CONTROL_DATA_TEXT, &search_keyword) == APP_CONTROL_ERROR_NONE))) { + (app_control_get_extra_data(app_control, APP_CONTROL_DATA_TEXT, &search_keyword) == APP_CONTROL_ERROR_NONE))) { BROWSER_LOGD("APP_CONTROL_OPERATION_SEARCH"); if (search_keyword) { uri=std::string(search_keyword); free(search_keyword); } } - + std::string oper(operation); BROWSER_LOGD("[%s] uri=%s", __func__, uri.c_str()); free(request_uri); free(request_mime_type); @@ -174,7 +174,7 @@ static void app_control(app_control_h app_control, void* app_data){ free(operation); auto bd = static_cast(app_data); - (*bd)->exec(uri, caller); + (*bd)->exec(uri, caller, oper); evas_object_show((*bd)->getMainWindow().get()); elm_win_activate((*bd)->getMainWindow().get()); diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 5912ee48..32743663 100755 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -214,13 +214,20 @@ std::string SimpleUI::preparePWA(const std::string& url) } #endif -int SimpleUI::exec(const std::string& _url, const std::string& _caller) -{ - BROWSER_LOGD("[%s] _url=%s, _caller=%s, initialised=%d", __func__, _url.c_str(), _caller.c_str(), m_initialised); +int SimpleUI::exec(const std::string& _url, const std::string& _caller, const std::string& _operation) +{ + BROWSER_LOGD( + "[%s] _url=%s, _caller=%s, _operation=%s, initialised=%d", + __func__, + _url.c_str(), + _caller.c_str(), + _operation.c_str(), + m_initialised); std::string url = _url; + std::string operation = _operation; m_caller = _caller; m_alreadyOpenedExecURL = false; - m_functionViewPrepare = [url, this]() mutable { + m_functionViewPrepare = [url, operation, this]() mutable { if (!m_initialised) { if (m_window.get()) { prepareServices(); @@ -253,7 +260,12 @@ int SimpleUI::exec(const std::string& _url, const std::string& _caller) if (!pwaUrl.empty() || (!url.empty() && !m_alreadyOpenedExecURL)) { BROWSER_LOGD("[%s]: open new tab", __func__); - auto taburl = pwaUrl.empty() ? url : pwaUrl; + std::string newUrl = url; + if (!operation.compare(APP_CONTROL_OPERATION_SEARCH)) { + newUrl = m_webPageUI->getURIEntry().rewriteURI(url); + popStackTo(m_webPageUI); + } + auto taburl = pwaUrl.empty() ? newUrl : pwaUrl; #if PWA // Allow for only one instance of PWA if (m_alreadyOpenedPWA) diff --git a/services/SimpleUI/SimpleUI.h b/services/SimpleUI/SimpleUI.h index a9a98eaf..d98e8860 100644 --- a/services/SimpleUI/SimpleUI.h +++ b/services/SimpleUI/SimpleUI.h @@ -85,8 +85,11 @@ class BROWSER_EXPORT SimpleUI : public AbstractMainWindow public: SimpleUI(/*Evas_Object *window*/); virtual ~SimpleUI(); - int exec(const std::string& _url, const std::string& _caller) final override; - std::string getName() final override; + virtual int exec( + const std::string& _url, + const std::string& _caller, + const std::string& _operation) final override; + virtual std::string getName() final override; void suspend(); void resume(); void destroyUI();