Set proper title to page on handling tizen scheme
authorYunchan Cho <yunchan.cho@samsung.com>
Sat, 9 Mar 2013 02:58:27 +0000 (11:58 +0900)
committerYunchan Cho <yunchan.cho@samsung.com>
Sat, 9 Mar 2013 03:13:27 +0000 (12:13 +0900)
[Issue#] DCM-712
[Problem] Application goes to background even though it don't want
[Cause] after handling tizen scheme, page's title property has been changed to abnormal value
[Solution] If wrt uses title change callback to handle tizen scheme,
           wrt set page's real title value to 'document.title' property explicitly.

Change-Id: I97df4018a754ccfe606274e24a3a5c8a34273fc0

src/view/webkit/view_logic.cpp
src/view/webkit/view_logic.h

index e568efc..f97d32a 100755 (executable)
@@ -859,7 +859,7 @@ void ViewLogic::loadFinishedCallback(
 
 void ViewLogic::titleChangedCallback(
     void* data,
-    Evas_Object* /*obj*/,
+    Evas_Object* obj,
     void* eventInfo)
 {
     LogDebug("titleChangedCallback called");
@@ -870,12 +870,24 @@ void ViewLogic::titleChangedCallback(
 
     if (0 == strlen(title)) {
         LogDebug("title data is empty");
+        This->m_currentTitle = std::string();
         return;
     }
     LogDebug("Title = [" << title << "]");
-    This->m_schemeSupport->HandleTizenScheme(title,
+    bool ret = This->m_schemeSupport->HandleTizenScheme(
+                                             title,
                                              This->m_window,
                                              This->m_currentEwkView);
+    // if result is true, this is tizen scheme
+    // and then, title is reset to page's real title
+    if (ret) {
+        std::string script = "document.title = \"";
+        script += This->m_currentTitle;
+        script +="\";";
+        ewk_view_script_execute(obj, script.c_str(), didRunJavaScriptCallback, This);
+    } else {
+        This->m_currentTitle = std::string(title);
+    }
 }
 
 void ViewLogic::loadProgressCallback(
index 3a2c289..6fb03ac 100755 (executable)
@@ -267,6 +267,7 @@ class ViewLogic : public ViewModule::IViewModule
     WidgetModel* m_model;
     std::string m_currentUri;
     std::string m_blockedUri;
+    std::string m_currentTitle;
     std::string m_theme;
     std::string m_startUrl;
     WRT::UserDelegatesPtr m_cbs;