[Release] wrt_0.8.260
authorsung-su.kim <sung-su.kim@samsung.com>
Wed, 14 Aug 2013 00:10:27 +0000 (09:10 +0900)
committerHoseon LEE <hoseon46.lee@samsung.com>
Sun, 29 Sep 2013 05:37:54 +0000 (14:37 +0900)
Change-Id: If485ec86da43f9a52d5207fe8c48d7bbe6c4b6de

14 files changed:
packaging/wrt.spec
src/domain/widget_model.cpp
src/domain/widget_model.h
src/view/common/view_logic_security_support.cpp
src/view/webkit/CMakeLists.txt
src/view/webkit/ewk_context_manager.cpp
src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp
src/view/webkit/view_logic.cpp
src/view/webkit/view_logic_user_agent_support.cpp [new file with mode: 0644]
src/view/webkit/view_logic_user_agent_support.h [new file with mode: 0644]
src/wrt-client/splash_screen_support.cpp
src/wrt-client/window_data.cpp
src/wrt-client/window_data.h
src/wrt-client/wrt-client.cpp

index ac29efd..57bc503 100644 (file)
@@ -1,7 +1,7 @@
 #git:framework/web/wrt
 Name:       wrt
 Summary:    web runtime
-Version:    0.8.257
+Version:    0.8.260
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 4cdf283..4b3f3e6 100644 (file)
@@ -91,6 +91,9 @@ WidgetModel::WidgetModel(const std::string &tizenId) :
     LicenseHref(this),
     //localized, so not binded
     Icon(this),
+    Version(this,
+            &BindToWidgetDAO<DPL::OptionalString,
+            &WidgetDAOReadOnly::getVersion>::Get),
     SplashImg(
         this,
         &BindToWidgetDAO<DPL::OptionalString,
index 6c2d6c4..56e1cf0 100644 (file)
@@ -179,6 +179,13 @@ class WidgetModel : public DPL::Event::Model
     DPL::Event::Property<OptionalWidgetIcon> Icon;
 
     /**
+     * @brief Widget version
+     */
+    DPL::Event::Property<DPL::OptionalString,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> Version;
+
+    /**
      * @brief Widget splash image src
      */
     DPL::Event::Property<DPL::OptionalString,
index 3dc7cc3..4aaaf5d 100644 (file)
@@ -64,15 +64,15 @@ bool simpleAceCheck(
     }
 
     LogDebug("Making ace check with new C-API");
-    ace_bool_t result = ACE_FALSE;
-    ace_return_t ret = ace_check_access(&aceRequest, &result);
+    ace_check_result_t result = ACE_PRIVILEGE_DENIED;
+    ace_return_t ret = ace_check_access_ex(&aceRequest, &result);
 
     LogDebug("Result is: " << static_cast<int>(result));
 
     delete[] aceRequest.dev_cap_list.items[0].param_list.items;
     delete[] aceRequest.dev_cap_list.items;
 
-    return ACE_OK == ret && ACE_TRUE == result;
+    return ACE_OK == ret && ACE_ACCESS_GRANTED == result;
 }
 } //TODO copied from view_logic.cpp
 
index 186a5d2..1d3b95a 100644 (file)
@@ -56,6 +56,7 @@ SET(VIEW_MODULE_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_message_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_orientation_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_scheme_support.cpp
+    ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_user_agent_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_usermedia_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_web_notification_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_web_storage_support.cpp
index 971b60a..bf3356a 100644 (file)
@@ -21,6 +21,7 @@
  *          This file handles operation regarding Ewk_Context
  */
 
+#include <map>
 #include <string>
 #include <cert-service.h>
 #include <vconf.h>
 #include "ewk_context_manager.h"
 
 namespace ViewModule {
-
-static const std::string bundlePath("/usr/lib/libwrt-injected-bundle.so");
+namespace {
+const std::string bundlePath("/usr/lib/libwrt-injected-bundle.so");
+std::map<Ewk_Extensible_API, Eina_Bool> defaultExtensibleAPI = {
+    { EWK_EXTENSIBLE_API_MEDIA_STREAM_RECORD,       EINA_TRUE  },
+    { EWK_EXTENSIBLE_API_ROTATE_CAMERA_VIEW,        EINA_FALSE },
+    { EWK_EXTENSIBLE_API_MEDIA_VOLUME_CONTROL,      EINA_TRUE  },
+};
+} // anonymous namespace
 
 EwkContextManager::EwkContextManager(
         const std::string& tizenAppId,
@@ -79,8 +86,8 @@ bool EwkContextManager::initialize()
 
     // cache model setting
     ewk_context_cache_model_set(
-            m_ewkContext,
-            EWK_CACHE_MODEL_DOCUMENT_BROWSER);
+        m_ewkContext,
+        EWK_CACHE_MODEL_DOCUMENT_BROWSER);
     ADD_PROFILING_POINT("WebProcess fork", "start");
     // To fork a Webprocess as soon as possible,
     // the following ewk_api is called explicitly.
@@ -100,19 +107,11 @@ bool EwkContextManager::initialize()
         LogError("cert path is null");
     }
 
-    ewk_context_tizen_extensible_api_set(
-        m_ewkContext,
-        EWK_EXTENSIBLE_API_MEDIA_STREAM_RECORD,
-        EINA_TRUE);
-    ewk_context_tizen_extensible_api_set(
-       m_ewkContext,
-       EWK_EXTENSIBLE_API_ROTATE_CAMERA_VIEW,
-       EINA_FALSE);
-    ewk_context_tizen_extensible_api_set(
-       m_ewkContext,
-       EWK_EXTENSIBLE_API_MEDIA_VOLUME_CONTROL,
-       EINA_TRUE);
-
+    FOREACH(it, defaultExtensibleAPI) {
+        ewk_context_tizen_extensible_api_set(m_ewkContext,
+                                             it->first,
+                                             it->second);
+    }
 
     // web application dependent settings
     WrtDB::WidgetDAOReadOnly dao(DPL::FromUTF8String(m_appId));
index 567f1f7..465601f 100644 (file)
@@ -228,16 +228,15 @@ bool checkACE(const char* url, bool xhr, const DPL::String& tizenId)
     aceRequest.dev_cap_list.items[0].param_list.items[0].value =
         const_cast<ace_string_t>(url);
 
-    ace_bool_t result = ACE_FALSE;
-
-    ace_return_t ret = ace_check_access(&aceRequest, &result);
+    ace_check_result_t result = ACE_PRIVILEGE_DENIED;
+    ace_return_t ret = ace_check_access_ex(&aceRequest, &result);
 
     _D("Result is: %d", static_cast<int>(result));
 
     delete[] aceRequest.dev_cap_list.items[0].param_list.items;
     delete[] aceRequest.dev_cap_list.items;
 
-    return ACE_OK == ret && ACE_TRUE == result;
+    return ACE_OK == ret && ACE_ACCESS_GRANTED == result;
 }
 } // namespace (anonymous)
 
index 7ff76f2..0a9a330 100644 (file)
@@ -59,6 +59,7 @@
 #include <view_logic_message_support.h>
 #include <view_logic_orientation_support.h>
 #include <view_logic_scheme_support.h>
+#include <view_logic_user_agent_support.h>
 #include <view_logic_usermedia_support.h>
 #include <view_logic_web_notification_support.h>
 #include <view_logic_web_storage_support.h>
@@ -74,6 +75,7 @@
 #include <popup-runner/PopupInvoker.h>
 #include <plugins-ipc-message/ipc_message_support.h>
 #include <appsvc.h>
+
 namespace {
 // IME State value
 const char * const IME_STATE_ON = "on";
@@ -741,19 +743,9 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView)
 {
     LogDebug("prepareEwkView called");
     Assert(wkView);
-    Ewk_Settings* settings = ewk_view_settings_get(wkView);
+    ViewModule::UserAgentSupport::setUserAgent(m_model, wkView);
 
-    // set user agent
-    std::string customUserAgent = m_model->SettingList.Get().getUserAgent();
-    if (customUserAgent.empty()) {
-        LogDebug("Setting user agent as: default");
-        ewk_view_user_agent_set(wkView, NULL);
-        std::string defaultUA = ewk_view_user_agent_get(wkView);
-        LogDebug("webkit's UA: " << defaultUA);
-    } else {
-        LogDebug("Setting  custom user agent as: " << customUserAgent);
-        ewk_view_user_agent_set(wkView, customUserAgent.c_str());
-    }
+    Ewk_Settings* settings = ewk_view_settings_get(wkView);
 
     // set custom header : language
     using namespace ViewModule::CustomHeaderSupport;
diff --git a/src/view/webkit/view_logic_user_agent_support.cpp b/src/view/webkit/view_logic_user_agent_support.cpp
new file mode 100644 (file)
index 0000000..862c801
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/*
+ * @file       view_logic_user_agent_support.cpp
+ * @author     Jihoon Chung (jihoon.chung@samsung.com)
+ * @version    1.0
+ */
+
+#include "view_logic_user_agent_support.h"
+
+#include <string>
+#include <cstring>
+#include <dpl/log/secure_log.h>
+#include <dpl/string.h>
+#include <widget_model.h>
+
+#include <app.h>
+#include <Elementary.h>
+#include <EWebKit2.h>
+
+namespace ViewModule {
+namespace {
+void setCustomUA(std::string customUA);
+bool setAppInfo(WidgetModel* model, Evas_Object* wkView);
+void printUA(Evas_Object* wkView);
+
+bool setCustomUA(WidgetModel* model, Evas_Object* wkView)
+{
+    std::string customUserAgent = model->SettingList.Get().getUserAgent();
+    if (customUserAgent.empty()) {
+        return false;
+    } else {
+        ewk_view_user_agent_set(wkView, customUserAgent.c_str());
+        return true;
+    }
+    return false;
+}
+
+bool setAppInfo(WidgetModel* model, Evas_Object* wkView)
+{
+    std::string appInfo; // appname/appversion
+    char* name = NULL;
+    if (app_get_name(&name) == APP_ERROR_NONE) {
+        appInfo = name;
+        free(name);
+    } else {
+        _W("Fail to get app name");
+        if (name) {
+            free(name);
+        }
+        return false;
+    }
+
+    DPL::OptionalString version = model->Version.Get();
+    if (!version.IsNull()) {
+        std::string versionStr = DPL::ToUTF8String(*version);
+        if (versionStr.empty()) {
+            // version is empty
+            // skip to set version field
+        } else {
+            appInfo += "/";
+            appInfo += versionStr;
+        }
+    }
+    if (ewk_view_application_name_for_user_agent_set(wkView, appInfo.c_str())
+        == EINA_TRUE)
+    {
+        // verify
+        const char* info =
+            ewk_view_application_name_for_user_agent_get(wkView);
+        if (!info || !strlen(info) || appInfo != info) {
+            _W("Fail to verify app info in the UA");
+            return false;
+        }
+        return true;
+    } else {
+        _W("Fail to set app info to UA");
+        return false;
+    }
+}
+
+void printUA(Evas_Object* wkView)
+{
+    const char* ua = ewk_view_user_agent_get(wkView);
+    _D("%s", ua);
+}
+} // anonymous namespace
+
+void UserAgentSupport::setUserAgent(WidgetModel* model, Evas_Object* wkView)
+{
+    Assert(model);
+    Assert(wkView);
+
+    // set custom UA
+    if (setCustomUA(model, wkView)) {
+        printUA(wkView);
+        return;
+    }
+
+    // In case of default UA, add appname/appversion
+    if (setAppInfo(model, wkView)) {
+        printUA(wkView);
+    } else {
+        // default UA
+        printUA(wkView);
+    }
+    return;
+}
+
+} // ViewModule
diff --git a/src/view/webkit/view_logic_user_agent_support.h b/src/view/webkit/view_logic_user_agent_support.h
new file mode 100644 (file)
index 0000000..1bb7643
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/*
+ * @file       view_logic_user_agent_support.h
+ * @author     Jihoon Chung (jihoon.chung@samsung.com)
+ * @version    1.0
+ */
+
+#ifndef VIEW_LOGIC_USER_AGENT_SUPPORT_H_
+#define VIEW_LOGIC_USER_AGENT_SUPPORT_H_
+
+#include <Elementary.h>
+
+class WidgetModel;
+
+namespace ViewModule {
+namespace UserAgentSupport {
+void setUserAgent(WidgetModel* model, Evas_Object* wkView);
+} // namespace UserAgentSupport
+} // namespace ViewModule
+
+#endif // VIEW_LOGIC_USER_AGENT_SUPPORT_H_
\ No newline at end of file
index 865dfb2..bdfb34d 100644 (file)
@@ -123,7 +123,7 @@ SplashScreenSupport::SplashScreenSupport(Evas_Object* parent, const char* image_
 
         Evas_Object* imageObject = elm_image_object_get(m_splashScreen);
 
-        if (ratio_image < ratio_win)
+        if (ratio_image <= ratio_win)
         {
             evas_object_image_fill_set(imageObject, 0, 0-((scaled_image_h-h)/2), scaled_image_w, scaled_image_h);
             evas_object_reposition(imageObject, x, y, w, h);
@@ -131,7 +131,7 @@ SplashScreenSupport::SplashScreenSupport(Evas_Object* parent, const char* image_
         else
         {
             evas_object_image_fill_set(imageObject, 0, 0, scaled_image_w, scaled_image_h);
-            evas_object_reposition(imageObject, 0, (h-scaled_image_h)/2, scaled_image_w, scaled_image_h);
+            evas_object_reposition(imageObject, 0, y+(h-scaled_image_h)/2, scaled_image_w, scaled_image_h);
         }
 
         m_initialized = true;
@@ -286,7 +286,7 @@ void SplashScreenSupport::resizeSplashScreen()
 
         Evas_Object* imageObject = elm_image_object_get(m_splashScreen);
 
-        if (ratio_image < ratio_win)
+        if (ratio_image <= ratio_win)
         {
             evas_object_image_fill_set(imageObject, 0, 0-((scaled_image_h-h)/2), scaled_image_w, scaled_image_h);
             evas_object_reposition(imageObject, x, y, w, h);
@@ -294,7 +294,7 @@ void SplashScreenSupport::resizeSplashScreen()
         else
         {
             evas_object_image_fill_set(imageObject, 0, 0, scaled_image_w, scaled_image_h);
-            evas_object_reposition(imageObject, 0, (h-scaled_image_h)/2, scaled_image_w, scaled_image_h);
+            evas_object_reposition(imageObject, 0, y+(h-scaled_image_h)/2, scaled_image_w, scaled_image_h);
         }
 
     }
index 4ea465e..0bb137f 100644 (file)
@@ -28,6 +28,7 @@
 #include <efl_assist_screen_reader.h>
 
 namespace {
+const char* const DELETE_REQUEST = "delete,request";
 const char* const PROFILE_CHANGED = "profile,changed";
 const char* const DESKTOP_ICON_PATH =
     "/opt/share/icons/default/small/tizenScmgz.png";
@@ -216,7 +217,11 @@ Evas_Object* WindowData::createWindow(unsigned long pid)
     int w, h;
     ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
     evas_object_resize(window, w, h);
-
+    elm_win_autodel_set(window, EINA_TRUE);
+    evas_object_smart_callback_add(window,
+                                   DELETE_REQUEST,
+                                   winDeleteRequestCallback,
+                                   this);
     evas_object_smart_callback_add(window,
                                    PROFILE_CHANGED,
                                    winProfileChangedCallback,
@@ -390,6 +395,14 @@ void WindowData::ctxpopupDismissedCallback(void* data,
     This->m_ctxpopup = NULL;
 }
 
+void WindowData::winDeleteRequestCallback(void* data,
+                                          Evas_Object* /*obj*/,
+                                          void* /*eventInfo*/)
+{
+    LogDebug("call");
+    elm_exit();
+}
+
 void WindowData::winProfileChangedCallback(void *data,
                                            Evas_Object* /*obj*/,
                                            void* /*eventInfo*/)
index 9326a5f..4e0df8c 100644 (file)
@@ -121,6 +121,9 @@ class WindowData : private DPL::Noncopyable
     static void ctxpopupDismissedCallback(void* data,
                                           Evas_Object* obj,
                                           void* eventInfo);
+    static void winDeleteRequestCallback(void* data,
+                                         Evas_Object* obj,
+                                         void* eventInfo);
     static void winProfileChangedCallback(void* data,
                                           Evas_Object* obj,
                                           void* eventInfo);
index b3a5883..1e9befc 100644 (file)
@@ -955,19 +955,7 @@ static void vconf_changed_handler(keynode_t* /*key*/, void* /*data*/)
 
 void set_env()
 {
-    // set evas backend type
-    if (!getenv("ELM_ENGINE"))
-    {
-        if (!setenv("ELM_ENGINE", "gl", 1))
-        {
-            LogDebug("Enable backend");
-        }
-    }
-    else
-    {
-        LogDebug("ELM_ENGINE : " << getenv("ELM_ENGINE"));
-    }
-
+    elm_config_preferred_engine_set("opengl_x11");
 #ifndef TIZEN_PUBLIC
     setenv("COREGL_FASTPATH", "1", 1);
 #endif