Secure icon highlight, URL protocol hide 97/82997/5
authorMaciej Skrzypkowski <m.skrzypkows@samsung.com>
Thu, 11 Aug 2016 08:52:06 +0000 (10:52 +0200)
committerHye Kyoung Hwang <cookie@samsung.com>
Wed, 17 Aug 2016 00:40:16 +0000 (17:40 -0700)
[Issue]    http://suprem.sec.samsung.net/jira/browse/TWF-1840
[Problem]  There was no highlight of uri entry button, uri protocol
           was shown
[Solution] added blue highlight and parsing uri to cut protocol
[Verify]   Check buttons highliht, click on uri entry, check
           is protocol is shown only in edit mode

Change-Id: I3acf2298d26099e03b570c03ebb220fc6a25a3df

core/AbstractWebEngine/AbstractWebEngine.h
core/Tools/GeneralTools.h
services/SimpleUI/SimpleUI.cpp
services/WebEngineService/WebEngineService.cpp
services/WebEngineService/WebEngineService.h
services/WebPageUI/URIEntry.cpp
services/WebPageUI/URIEntry.h
services/WebPageUI/WebPageUI.cpp
services/WebPageUI/WebPageUI.h
services/WebPageUI/edc/CustomButton.edc
services/WebPageUI/edc/URIEntry.edc

index 5bce6330d75a07ea338576a351d3848032dc6fb4..b9095b6d20ccd1639d894be709e3e068e6d8e621 100644 (file)
@@ -298,8 +298,16 @@ public:
     */
     virtual void clearFormData() = 0;
 
+    /**
+     * @brief Disconnect signals from current webview.
+     */
     virtual void disconnectCurrentWebViewSignals() = 0;
 
+    /**
+     * @brief Connect signals to current web view.
+     */
+    virtual void connectCurrentWebViewSignals() = 0;
+
     /**
      * @brief Search string on searchOnWebsite
      *
index 8d2fe18ab5145bf55d45b4933b4b8c74702239ac..65e5832332bbaa8ad0c699472e57d879da4e622a 100644 (file)
@@ -27,7 +27,7 @@ namespace tizen_browser
 {
 namespace tools
 {
-    static const int SUFIX_CHAR_DEL = 1;
+    static const int SUFFIX_CHAR_DEL = 1;
     static const char * PROTCOL_BEGIN = "://";
     static const char END_SLASH = '/';
     // which protocol, when only domain is available?
@@ -41,9 +41,12 @@ namespace tools
     static std::string fromChar(const char* c) { return c ? std::string(c) : std::string(); }
 
     static std::string clearURL(const std::string & url) {
+        int suffix = 0;
+        if (url.back() == END_SLASH)
+            suffix = SUFFIX_CHAR_DEL;
         size_t beg = url.find(PROTCOL_BEGIN);
         beg += strlen(PROTCOL_BEGIN);
-        return url.substr(beg, url.size() - beg - SUFIX_CHAR_DEL);
+        return url.substr(beg, url.size() - beg - suffix);
     }
 
     static std::string extractDomain(const std::string & url) {
index dcd1c62ddd9752cafcba929ac7f09f5dff88e986..07bfa09f5dbe9344f95a07e70b64b4366d8305b1 100755 (executable)
@@ -628,7 +628,8 @@ void SimpleUI::switchViewToWebPage()
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     if(m_webEngine->isSuspended())
         m_webEngine->resume();
-    m_webPageUI->switchViewToWebPage(m_webEngine->getLayout(), m_webEngine->getURI());
+    m_webEngine->connectCurrentWebViewSignals();
+    m_webPageUI->switchViewToWebPage(m_webEngine->getLayout(), m_webEngine->getURI(), m_webEngine->isLoading());
     m_webPageUI->toIncognito(m_webEngine->isPrivateMode(m_webEngine->currentTabId()));
 }
 
@@ -738,7 +739,7 @@ void SimpleUI::onOpenURL(const std::string& url, const std::string& title, bool
         if (tabsCount() == 0 || m_webPageUI->stateEquals(WPUState::QUICK_ACCESS))
             openNewTab(url, title, boost::none, desktopMode, false, basic_webengine::TabOrigin::QUICKACCESS);
         else {
-            m_webPageUI->switchViewToWebPage(m_webEngine->getLayout(), title);
+            m_webPageUI->switchViewToWebPage(m_webEngine->getLayout(), url, false);
             m_webEngine->setURI(url);
             m_webPageUI->getURIEntry().clearFocus();
         }
@@ -793,8 +794,8 @@ void SimpleUI::onBookmarkClicked(std::shared_ptr<tizen_browser::services::Bookma
             openNewTab(bookmarkAddress);
         else {
             std::string bookmarkTitle = bookmarkItem->getTitle();
-            m_webPageUI->switchViewToWebPage(m_webEngine->getLayout(), bookmarkAddress);
             m_webEngine->setURI(bookmarkAddress);
+            m_webPageUI->switchViewToWebPage(m_webEngine->getLayout(), bookmarkAddress, m_webEngine->isLoading());
             m_webPageUI->getURIEntry().clearFocus();
             closeBookmarkManagerUI();
         }
index 27a91025c4a7de951175cc226fd447ba5da86867..7295dc0bb5ea1baa2532c83028d96aa2448e074d 100755 (executable)
@@ -172,6 +172,14 @@ void WebEngineService::disconnectCurrentWebViewSignals()
         disconnectSignals(m_currentWebView);
 }
 
+void WebEngineService::connectCurrentWebViewSignals()
+{
+    if (m_currentWebView)
+        connectSignals(m_currentWebView);
+    else
+        BROWSER_LOGD("[%s:%d:%s] ", __PRETTY_FUNCTION__, __LINE__,"m_currentWebView is null");
+}
+
 int WebEngineService::createTabId()
 {
     m_tabIdCreated = -1;
index 7ccd46bb625c0e4e0bbc6e36e4285d8f8be08646..b772643fb02608dc585ed40d78307b3b8bc31c05 100644 (file)
@@ -253,6 +253,7 @@ private:
     void disconnectSignals(WebViewPtr);
 
     void disconnectCurrentWebViewSignals();
+    void connectCurrentWebViewSignals();
 
     /**
      * connect signals of specified WebView
index ea0f1afd8c308489091d4a5834aca2392762444c..39b71cef104a1e135c40ff4331368b5e0a2855e3 100644 (file)
@@ -27,6 +27,7 @@
 #include "SettingsPrettySignalConnector.h"
 #include "Tools/URIschemes.h"
 #include "Tools/SettingsEnums.h"
+#include "GeneralTools.h"
 
 namespace tizen_browser {
 namespace base_ui {
@@ -54,6 +55,7 @@ URIEntry::URIEntry(WPUStatesManagerPtrConst statesMgr)
     , m_statesMgr(statesMgr)
     , m_rightIconType(RightIconType::NONE)
     , m_rightIcon(nullptr)
+    , m_leftIcon(nullptr)
 {}
 
 URIEntry::~URIEntry()
@@ -82,7 +84,6 @@ Evas_Object* URIEntry::getContent()
         elm_entry_single_line_set(m_entry, EINA_TRUE);
         elm_entry_scrollable_set(m_entry, EINA_TRUE);
         elm_entry_input_panel_layout_set(m_entry, ELM_INPUT_PANEL_LAYOUT_URL);
-        elm_object_signal_callback_add(m_entry_layout,  "left,icon,clicked", "ui", _uri_left_icon_clicked, this);
 
         m_rightIcon = elm_button_add(m_entry_layout);
         elm_object_style_set(m_rightIcon, "custom");
@@ -91,6 +92,13 @@ Evas_Object* URIEntry::getContent()
         evas_object_show(m_rightIcon);
         elm_object_part_content_set(m_entry_layout, "right_icon", m_rightIcon);
 
+        m_leftIcon = elm_button_add(m_entry_layout);
+        elm_object_style_set(m_leftIcon, "custom");
+        elm_object_focus_allow_set(m_leftIcon, EINA_FALSE);
+        evas_object_smart_callback_add(m_leftIcon, "clicked", _uri_left_icon_clicked, this);
+        evas_object_show(m_leftIcon);
+        elm_object_part_content_set(m_entry_layout, "left_icon", m_leftIcon);
+
         setUrlGuideText(GUIDE_TEXT_UNFOCUSED);
 
         evas_object_smart_callback_add(m_entry, "activated", URIEntry::activated, this);
@@ -121,8 +129,11 @@ void URIEntry::changeUri(const std::string& newUri)
     m_URI = newUri;
     if (elm_object_focus_get(m_entry) == EINA_FALSE) {
         if (!m_URI.empty()) {
-            elm_entry_entry_set(m_entry, elm_entry_utf8_to_markup(m_URI.c_str()));
-            m_rightIconType = RightIconType::NONE;
+            elm_entry_entry_set(m_entry, elm_entry_utf8_to_markup(tools::clearURL(m_URI).c_str()));
+            if (!m_isPageLoading)
+                showReloadIcon();
+            else
+                showStopIcon();
         } else {
             elm_entry_entry_set(m_entry, elm_entry_utf8_to_markup(""));
             hideRightIcon();
@@ -225,21 +236,11 @@ void URIEntry::unfocused(void* data, Evas_Object*, void*)
     if (!self->m_entryContextMenuOpen) {
         self->m_entrySelectionState = SelectionState::SELECTION_NONE;
         self->mobileEntryUnfocused();
-        if (!self->m_statesMgr->equals(WPUState::QUICK_ACCESS) && !self->m_statesMgr->equals(WPUState::MAIN_INCOGNITO_PAGE)) {
-            if (self->m_isPageLoading)
-                self->showStopIcon();
-            else
-                self->showReloadIcon();
-        } else {
-            self->hideRightIcon();
-        }
     }
     self->m_first_click = true;
     elm_entry_select_none(self->m_entry);
 
-    self->showSecureIcon(self->m_showSecureIcon, self->m_securePageIcon);
-
-    elm_entry_entry_set(self->m_entry, elm_entry_utf8_to_markup(self->m_URI.c_str()));
+    self->changeUri(self->m_URI);
 }
 
 void URIEntry::focused(void* data, Evas_Object* /* obj */, void* /* event_info */)
@@ -252,6 +253,7 @@ void URIEntry::focused(void* data, Evas_Object* /* obj */, void* /* event_info *
         self->m_entryContextMenuOpen = false;
     }
     if(self->m_first_click) {
+        elm_entry_entry_set(self->m_entry, elm_entry_utf8_to_markup(self->m_URI.c_str()));
         elm_entry_select_all(self->m_entry);
         self->m_first_click = false;
         self->m_entrySelectionState = SelectionState::SELECTION_NONE;
@@ -395,7 +397,7 @@ void URIEntry::_uri_entry_longpressed(void* data, Evas_Object* /*obj*/, void* /*
 
 }
 
-void URIEntry::_uri_left_icon_clicked(void* data, Evas_Object*, const char*, const char*)
+void URIEntry::_uri_left_icon_clicked(void* data, Evas_Object*, void*)
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     auto self = static_cast<URIEntry*>(data);
@@ -488,13 +490,14 @@ void URIEntry::showSecureIcon(bool show, bool secure)
 {
     BROWSER_LOGD("[%s:%d] [ show : %d, secure : %d] ", __PRETTY_FUNCTION__, __LINE__, show, secure);
 
-    m_securePageIcon = secure;
-    m_showSecureIcon = show;
     if (show) {
+        auto ic = elm_icon_add(m_leftIcon);
         if (secure)
-            elm_object_signal_emit(m_entry_layout, "show,secure,icon", "");
+            elm_image_file_set(ic, m_customEdjPath.c_str(), "toolbar_input_ic_security.png");
         else
-            elm_object_signal_emit(m_entry_layout, "show,unsecure,icon", "");
+            elm_image_file_set(ic, m_customEdjPath.c_str(), "toolbar_input_ic_security_off.png");
+        elm_object_part_content_set(m_leftIcon, "elm.swallow.content", ic);
+        elm_object_signal_emit(m_entry_layout, "show,left,icon", "ui");
     } else {
         hideLeftIcon();
     }
index 90e94d86fafbbffb9d91dad38abae7d518f8dbe7..e7d55a365fb8ff49f49664895493fa2f142c5e91 100644 (file)
@@ -68,6 +68,8 @@ public:
     void setCurrentFavIcon();
     void setSearchIcon();
     void setDocIcon();
+    void setPageLoading(bool isLoading) { m_isPageLoading = isLoading; }
+
     /**
      * \brief Adds Action to URI bar.
      *
@@ -124,7 +126,7 @@ private:
         STOP_LOADING
     };
 
-    static void _uri_left_icon_clicked(void* data, Evas_Object*, const char*, const char*);
+    static void _uri_left_icon_clicked(void* data, Evas_Object* obj, void* event_info);
     static void _uri_right_icon_clicked(void* data, Evas_Object* obj, void* event_info);
     void showRightIcon(const std::string& fileName);
     void showCancelIcon();
@@ -151,8 +153,7 @@ private:
     WPUStatesManagerPtrConst m_statesMgr;
     RightIconType m_rightIconType;
     Evas_Object* m_rightIcon;
-    bool m_securePageIcon;
-    bool m_showSecureIcon;
+    Evas_Object* m_leftIcon;
 };
 
 
index dae4562247d66442d7aeb860c1c9926a38520063..5ed6583f14d77a2f8d0cc0c3087feb270271ba64 100755 (executable)
@@ -119,7 +119,7 @@ void WebPageUI::hideUI()
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     M_ASSERT(m_mainLayout);
-    elm_object_focus_custom_chain_unset(m_mainLayout);
+    m_URIEntry->loadFinished();
     evas_object_hide(m_mainLayout);
 
     if(m_statesMgr->equals(WPUState::QUICK_ACCESS))
@@ -229,7 +229,7 @@ void WebPageUI::switchViewToIncognitoPage()
     m_URIEntry->changeUri("");
 }
 
-void WebPageUI::switchViewToWebPage(Evas_Object* content, const std::string uri)
+void WebPageUI::switchViewToWebPage(Evas_Object* content, const std::string uri, bool loading)
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     if(m_statesMgr->equals(WPUState::QUICK_ACCESS))
@@ -239,7 +239,7 @@ void WebPageUI::switchViewToWebPage(Evas_Object* content, const std::string uri)
     }
     setMainContent(content);
     elm_object_signal_emit(m_mainLayout, "shiftright_uri", "ui");
-    updateURIBar(uri);
+    updateURIBar(uri, loading);
 }
 
 void WebPageUI::switchViewToQuickAccess(Evas_Object* content)
@@ -742,9 +742,10 @@ void WebPageUI::setPrivateButtons()
     m_forward->setEnabled(false);
 }
 
-void WebPageUI::updateURIBar(const std::string& uri)
+void WebPageUI::updateURIBar(const std::string& uri, bool loading)
 {
     BROWSER_LOGD("[%s:%d] URI:%s", __PRETTY_FUNCTION__, __LINE__, uri.c_str());
+    m_URIEntry->setPageLoading(loading);
     m_URIEntry->changeUri(uri);
     hideProgressBar();
 }
index 45fce5f454a48d2b61cba7db92714776b61b058a..9af467ed1b0efbe99d8d47f82f23c408de0843e9 100644 (file)
@@ -101,7 +101,7 @@ public:
     bool isWebPageUIvisible() { return m_WebPageUIvisible; }
     void toIncognito(bool);
     void switchViewToErrorPage();
-    void switchViewToWebPage(Evas_Object* content, const std::string uri);
+    void switchViewToWebPage(Evas_Object* content, const std::string uri, bool loading);
     void switchViewToIncognitoPage();
     void switchViewToQuickAccess(Evas_Object* content);
     URIEntry& getURIEntry() const { return *m_URIEntry.get(); }
@@ -175,7 +175,7 @@ private:
     void setErrorButtons();
     void setPrivateButtons();
     void setMainContent(Evas_Object* content);
-    void updateURIBar(const std::string& uri);
+    void updateURIBar(const std::string& uri, bool loading);
     std::string edjePath(const std::string& file);
 #if GESTURE
     void gestureUp();
index 5415c81606ce930d34aacc61704fe9df92d0762a..b1d3894d98291cd3f2be6390e815b024ec376feb 100644 (file)
@@ -16,6 +16,8 @@ collections { base_scale: 2.6;
 
 IMAGE_BUTTON("toolbar_input_ic_cancel.png", BUTTON_ICON_DEFAULT_HEIGHT_INC, BUTTON_ICON_DEFAULT_WIDTH_INC, "toolbar_input_ic_cancel.png")
 IMAGE_BUTTON("toolbar_input_ic_refresh.png", BUTTON_ICON_DEFAULT_HEIGHT_INC, BUTTON_ICON_DEFAULT_WIDTH_INC, "toolbar_input_ic_refresh.png")
+IMAGE_BUTTON("toolbar_input_ic_security.png", BUTTON_ICON_DEFAULT_HEIGHT_INC, BUTTON_ICON_DEFAULT_WIDTH_INC, "toolbar_input_ic_security.png")
+IMAGE_BUTTON("toolbar_input_ic_security_off.png", BUTTON_ICON_DEFAULT_HEIGHT_INC, BUTTON_ICON_DEFAULT_WIDTH_INC, "toolbar_input_ic_security_off.png")
 
    group { name: "elm/button/base/custom";
       data.item: "vector_ux" "default";
index 4e3c5689abf0d620d69de23047034c4c06cb6e71..dcf26df85eaf03010f2ce5fdbd5bef7c259f1515 100755 (executable)
@@ -6,27 +6,7 @@
 #define URI_INPUTBOX_HEIGHT 80
 #define BORDER_WIDTH 5
 
-#define RESOURCE_IMAGE_LOSSY( FILE_NAME ) \
-   group { \
-      name: FILE_NAME; \
-      images.image: FILE_NAME LOSSY 100; \
-      parts { \
-         part { name: "image"; \
-            description { \
-               state: "default" 0.0; \
-               image.normal: FILE_NAME; \
-               aspect: 1 1; \
-               aspect_preference: BOTH; \
-               color: 105 105 105 255;  \
-            } \
-         } \
-      } \
-   }
-
 collections { base_scale: 2.6;
-RESOURCE_IMAGE_LOSSY("toolbar_input_ic_security.png")
-RESOURCE_IMAGE_LOSSY("toolbar_input_ic_security_off.png")
-
     group {
         name: "elm/entry/selection/browser_entry";
         parts {
@@ -328,7 +308,7 @@ RESOURCE_IMAGE_LOSSY("toolbar_input_ic_security_off.png")
             }
             part {
                 name: "left_icon";
-                type: IMAGE;
+                type: SWALLOW;
                 scale: 1;
                 description {
                     state: "default" 0.0;
@@ -349,34 +329,10 @@ RESOURCE_IMAGE_LOSSY("toolbar_input_ic_security_off.png")
                 description {
                     state: "visible" 0.0;
                     inherit: "default" 0.0;
-                    min: 50 50;
-                    max: 50 50;
+                    min: 80 80;
+                    max: 80 80;
                     visible: 1;
                 }
-                description {
-                    state: "secure" 0.0;
-                    inherit: "visible" 0.0;
-                    image.normal: "toolbar_input_ic_security.png";
-                }
-                description {
-                    state: "unsecure" 0.0;
-                    inherit: "visible" 0.0;
-                    image.normal: "toolbar_input_ic_security_off.png";
-                }
-            }
-            rect {
-                name: "left_icon_over";
-                scale: 1;
-                mouse_events: 1;
-                description {
-                    state: "default" 0.0;
-                    rel1.to: "left_icon_bg";
-                    rel1.relative: 0.0 0.0;
-                    rel2.to: "left_icon_bg";
-                    rel2.relative: 1.0 1.0;
-                    align: 0 0;
-                    color: 0 0 0 0;
-                }
             }
             part {
                 name: "over";
@@ -482,27 +438,13 @@ RESOURCE_IMAGE_LOSSY("toolbar_input_ic_security_off.png")
         }
         programs {
             program {
-                name: "show_secure_icon";
-                signal: "show,secure,icon";
-                source: "";
-                action: STATE_SET "secure" 0.0;
-                target: "left_icon";
-                after: "show_left_icon_bg";
-            }
-            program {
-                name: "show_unsecure_icon";
-                signal: "show,unsecure,icon";
-                source: "";
-                action: STATE_SET "unsecure" 0.0;
+                name: "show_left_icon";
+                source: "ui";
+                signal: "show,left,icon";
+                action: STATE_SET "visible" 0.0;
                 target: "left_icon";
                 after: "show_left_icon_bg";
             }
-            program {
-                name: "mouse_clicked_left_icon";
-                signal: "mouse,clicked,*";
-                source: "left_icon_over";
-                action: SIGNAL_EMIT "left,icon,clicked" "ui";
-            }
             program {
                 name: "hide_left_icon";
                 source: "ui";