From 24b6a8a72a93ffaca08a25d889d0a1516402c85d Mon Sep 17 00:00:00 2001 From: "sung-su.kim" Date: Wed, 14 Aug 2013 09:10:27 +0900 Subject: [PATCH] [Release] wrt_0.8.260 Change-Id: If485ec86da43f9a52d5207fe8c48d7bbe6c4b6de --- packaging/wrt.spec | 2 +- src/domain/widget_model.cpp | 3 + src/domain/widget_model.h | 7 ++ src/view/common/view_logic_security_support.cpp | 6 +- src/view/webkit/CMakeLists.txt | 1 + src/view/webkit/ewk_context_manager.cpp | 33 +++--- .../injected_bundle_uri_handling.cpp | 7 +- src/view/webkit/view_logic.cpp | 16 +-- src/view/webkit/view_logic_user_agent_support.cpp | 123 +++++++++++++++++++++ src/view/webkit/view_logic_user_agent_support.h | 35 ++++++ src/wrt-client/splash_screen_support.cpp | 8 +- src/wrt-client/window_data.cpp | 15 ++- src/wrt-client/window_data.h | 3 + src/wrt-client/wrt-client.cpp | 14 +-- 14 files changed, 218 insertions(+), 55 deletions(-) create mode 100644 src/view/webkit/view_logic_user_agent_support.cpp create mode 100644 src/view/webkit/view_logic_user_agent_support.h diff --git a/packaging/wrt.spec b/packaging/wrt.spec index ac29efd..57bc503 100644 --- a/packaging/wrt.spec +++ b/packaging/wrt.spec @@ -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 diff --git a/src/domain/widget_model.cpp b/src/domain/widget_model.cpp index 4cdf283..4b3f3e6 100644 --- a/src/domain/widget_model.cpp +++ b/src/domain/widget_model.cpp @@ -91,6 +91,9 @@ WidgetModel::WidgetModel(const std::string &tizenId) : LicenseHref(this), //localized, so not binded Icon(this), + Version(this, + &BindToWidgetDAO::Get), SplashImg( this, &BindToWidgetDAO Icon; /** + * @brief Widget version + */ + DPL::Event::Property Version; + + /** * @brief Widget splash image src */ DPL::Event::Property(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 diff --git a/src/view/webkit/CMakeLists.txt b/src/view/webkit/CMakeLists.txt index 186a5d2..1d3b95a 100644 --- a/src/view/webkit/CMakeLists.txt +++ b/src/view/webkit/CMakeLists.txt @@ -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 diff --git a/src/view/webkit/ewk_context_manager.cpp b/src/view/webkit/ewk_context_manager.cpp index 971b60a..bf3356a 100644 --- a/src/view/webkit/ewk_context_manager.cpp +++ b/src/view/webkit/ewk_context_manager.cpp @@ -21,6 +21,7 @@ * This file handles operation regarding Ewk_Context */ +#include #include #include #include @@ -36,8 +37,14 @@ #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 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)); diff --git a/src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp b/src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp index 567f1f7..465601f 100644 --- a/src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp +++ b/src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp @@ -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(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(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) diff --git a/src/view/webkit/view_logic.cpp b/src/view/webkit/view_logic.cpp index 7ff76f2..0a9a330 100644 --- a/src/view/webkit/view_logic.cpp +++ b/src/view/webkit/view_logic.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +75,7 @@ #include #include #include + 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 index 0000000..862c801 --- /dev/null +++ b/src/view/webkit/view_logic_user_agent_support.cpp @@ -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 +#include +#include +#include +#include + +#include +#include +#include + +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 index 0000000..1bb7643 --- /dev/null +++ b/src/view/webkit/view_logic_user_agent_support.h @@ -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 + +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 diff --git a/src/wrt-client/splash_screen_support.cpp b/src/wrt-client/splash_screen_support.cpp index 865dfb2..bdfb34d 100644 --- a/src/wrt-client/splash_screen_support.cpp +++ b/src/wrt-client/splash_screen_support.cpp @@ -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); } } diff --git a/src/wrt-client/window_data.cpp b/src/wrt-client/window_data.cpp index 4ea465e..0bb137f 100644 --- a/src/wrt-client/window_data.cpp +++ b/src/wrt-client/window_data.cpp @@ -28,6 +28,7 @@ #include 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*/) diff --git a/src/wrt-client/window_data.h b/src/wrt-client/window_data.h index 9326a5f..4e0df8c 100644 --- a/src/wrt-client/window_data.h +++ b/src/wrt-client/window_data.h @@ -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); diff --git a/src/wrt-client/wrt-client.cpp b/src/wrt-client/wrt-client.cpp index b3a5883..1e9befc 100644 --- a/src/wrt-client/wrt-client.cpp +++ b/src/wrt-client/wrt-client.cpp @@ -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 -- 2.7.4