[Release] wrt_0.8.213
authorJihoon Chung <jihoon.chung@samsung.com>
Thu, 6 Jun 2013 11:16:47 +0000 (20:16 +0900)
committerHoseon LEE <hoseon46.lee@samsung.com>
Sun, 29 Sep 2013 05:33:43 +0000 (14:33 +0900)
Change-Id: Ia9819d419d389f7f22cb30570790948a8507fd10

52 files changed:
accesses.d/wrt_launchpad_daemon.rule
data/Daemon.edc
packaging/wrt.spec
src/api_new/core_module.cpp
src/api_new/core_module.h
src/api_new/ewk_context_manager.cpp
src/api_new/runnable_widget_object.cpp
src/api_new/user_delegates.h
src/domain/prepare_external_storage.cpp
src/domain/prepare_external_storage.h
src/domain/widget_data_types.cpp
src/domain/widget_data_types.h
src/domain/widget_deserialize_model.cpp
src/domain/widget_model.cpp
src/domain/widget_model.h
src/view/common/CMakeLists.txt
src/view/common/application_launcher.cpp
src/view/common/application_launcher.h
src/view/common/message_support.h [new file with mode: 0644]
src/view/common/scheme.cpp
src/view/common/scheme.h
src/view/common/scheme_action_map.cpp
src/view/common/scheme_action_map_data.h
src/view/common/view_logic_apps_support.cpp
src/view/common/view_logic_apps_support.h
src/view/common/view_logic_certificate_support.cpp [changed mode: 0755->0644]
src/view/common/view_logic_security_origin_support.cpp [changed mode: 0755->0644]
src/view/common/view_logic_security_origin_support.h [changed mode: 0755->0644]
src/view/common/view_logic_storage_support.cpp
src/view/common/view_logic_user_agent_support.cpp [deleted file]
src/view/webkit/CMakeLists.txt
src/view/webkit/injected-bundle/CMakeLists.txt
src/view/webkit/injected-bundle/injected_bundle_decryption_support.cpp [new file with mode: 0644]
src/view/webkit/injected-bundle/injected_bundle_decryption_support.h [new file with mode: 0644]
src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp
src/view/webkit/injected-bundle/injected_bundle_uri_handling.h
src/view/webkit/injected-bundle/messages_names.h [deleted file]
src/view/webkit/injected-bundle/wrt-injected-bundle.cpp
src/view/webkit/injected-bundle/wrt-injected-bundle.h
src/view/webkit/view_logic.cpp
src/view/webkit/view_logic.h
src/view/webkit/view_logic_message_support.cpp [moved from src/view/webkit/injected-bundle/plugin_module_support.cpp with 75% similarity]
src/view/webkit/view_logic_message_support.h [moved from src/view/webkit/injected-bundle/plugin_module_support.h with 77% similarity]
src/view/webkit/view_logic_orientation_support.cpp [new file with mode: 0644]
src/view/webkit/view_logic_orientation_support.h [moved from src/view/common/view_logic_user_agent_support.h with 51% similarity]
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
src/wrt-client/wrt-client.h
wrt_env.sh
wrt_launchpad_daemon.rule

index df88620..bee6041 100644 (file)
@@ -1,5 +1,6 @@
 wrt_launchpad_daemon system::share rwx--
 wrt_launchpad_daemon system::homedir rwx--
 wrt_launchpad_daemon device::app_logging -w---
-wrt_launchpad_daemon xorg -w---
+wrt_launchpad_daemon xorg rw---
 wrt_launchpad_daemon webkit2-efl rwxa-
+wrt_launchpad_daemon sys-assert::core rwxat
index 21ea853..4a2ac70 100644 (file)
@@ -27,6 +27,24 @@ collections {
                 }
             }
             part {
+                name: "elm.swallow.progress";
+                scale: 1;
+                type: SWALLOW;
+                description {
+                    state: "default" 0.0;
+                    visible: 0;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 0.0; }
+                    rel2 { relative: 1.0 0.0; }
+                    align: 0.5 0.0;
+                }
+                description {
+                    state: "visible" 0.0;
+                    inherit: "default" 0.0;
+                    visible: 1;
+                }
+            }
+            part {
                 name: "elm.swallow.backward";
                 type: SWALLOW;
                 mouse_events: 1;
@@ -136,6 +154,16 @@ collections {
                 transition: DECELERATE 0.5;
                 target: "elm.swallow.comboboxPicker";
             }
+            program { name: "show,progress";
+                signal: "show,progress,signal";
+                action: STATE_SET "visible" 0.0;
+                target: "elm.swallow.progress";
+            }
+            program { name: "hide,progress";
+                signal: "hide,progress,signal";
+                action: STATE_SET "default" 0.0;
+                target: "elm.swallow.progress";
+            }
         }//end of programs
     }//end of group
 
index 0222ed9..1fcbece 100644 (file)
@@ -1,7 +1,7 @@
-#git:framework/web/wrt wrt_0.8.198.3
+#git:framework/web/wrt
 Name:       wrt
 Summary:    web runtime
-Version:    0.8.198.3
+Version:    0.8.213
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
@@ -41,15 +41,13 @@ BuildRequires:  pkgconfig(haptic)
 BuildRequires:  pkgconfig(capi-web-url-download)
 BuildRequires:  pkgconfig(wrt-plugin-loading)
 BuildRequires:  pkgconfig(wrt-plugin-js-overlay)
-BuildRequires:  pkgconfig(dpl-encryption)
 BuildRequires:  pkgconfig(wrt-popup-wrt-runner)
 BuildRequires:  pkgconfig(wrt-popup-ace-runner)
 BuildRequires:  pkgconfig(sysman)
-BuildRequires:  pkgconfig(osp-appfw)
 BuildRequires:  pkgconfig(app2sd)
 BuildRequires:  pkgconfig(capi-system-system-settings)
-BuildRequires:  osp-appfw-internal-devel
-Requires: osp-appfw
+BuildRequires:  libss-client-devel
+Requires: libss-client
 
 ## wrt-launchpad-daemon #######################################################
 BuildRequires:  pkgconfig(app-checker)
index f088377..c9f99e2 100644 (file)
@@ -36,7 +36,6 @@
 #include <widget_deserialize_model.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <dpl/wrt-dao-ro/global_dao_read_only.h>
-#include "webkit/injected-bundle/plugin_module_support.h"
 
 #include <EWebKit2.h>
 
index 1d5aa86..0477d75 100644 (file)
@@ -91,4 +91,4 @@ class CoreModule
 
 typedef DPL::Singleton<CoreModule> CoreModuleSingleton;
 } /* namespace WRT */
-#endif /* CORE_MODULE_H_ */
+#endif /* CORE_MODULE_H_ */
\ No newline at end of file
index d3b3c58..d3f973a 100644 (file)
@@ -30,7 +30,6 @@
 #include <i_view_module.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <dpl/wrt-dao-ro/widget_dao_types.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/utils/wrt_global_settings.h>
 #include "ewk_context_manager.h"
 
@@ -119,15 +118,10 @@ bool EwkContextManager::initialize()
             dao.getPrivateLocalStoragePath().c_str());
 
     // memory saving mode
-    int result;
-    vconf_get_int(
-            WrtDB::VconfConfig::GetVconfKeyMemorySavingMode(
-                DPL::FromUTF8String(m_appId)).c_str(), &result);
-
-    ewk_context_memory_saving_mode_set(
-            m_ewkContext,
-            static_cast<WrtDB::SettingsType>(result) ==
-            WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
+    //ewk_context_memory_saving_mode_set(
+    //       m_ewkContext,
+    //       static_cast<WrtDB::SettingsType>(result) ==
+    //        WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
 
     ewk_context_tizen_extensible_api_set(
         m_ewkContext,
index d7444fb..23141e2 100644 (file)
@@ -28,7 +28,6 @@
 #include <appcore-common.h>
 #include <profiling_util.h>
 #include <signal.h>
-#include "webkit/injected-bundle/plugin_module_support.h"
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <runnable_widget_object_state.h>
 #include <wrt_ocsp_api.h>
@@ -41,6 +40,8 @@ const std::string ALREADY_RUNNING = _("IDS_BR_POP_ALREADY_RUNNING");
 const std::string INVALID_LOCALE = _("IDS_IM_POP_INVALID_WIDGET_LOCALE");
 const std::string STILL_AUTHORIZING = _("IDS_IM_POP_AUTHORIZING_ING_ATNT");
 const unsigned int UID_ROOT = 0;
+const char* const MESSAGE_NAME_INITIALIZE = "ToInjectedBundle::INIT";
+const char* const MESSAGE_NAME_SHUTDOWN = "ToInjectedBundle::SHUTDOWN";
 } // namespace anonymous
 
 namespace WRT {
@@ -137,7 +138,10 @@ bool RunnableWidgetObject::PrepareView(const std::string &startUrl,
     Ewk_Context* context = m_ewkContextManager->getEwkContext();
 
     // plugin init
-    PluginModuleSupport::init(context, DPL::ToUTF8String(m_widgetModel->TizenId));
+    ewk_context_message_post_to_injected_bundle(
+                    context,
+                    MESSAGE_NAME_INITIALIZE,
+                    DPL::ToUTF8String(m_widgetModel->TizenId).c_str());
 
     // view init
     if(!m_view->createWebView(context, window)) {
@@ -257,7 +261,10 @@ RunnableWidgetObject::~RunnableWidgetObject()
     LogDebug("");
     if(m_ewkContextManager)
     {
-        PluginModuleSupport::shutdown(m_ewkContextManager->getEwkContext());
+        ewk_context_message_post_to_injected_bundle(
+            m_ewkContextManager->getEwkContext(),
+            MESSAGE_NAME_SHUTDOWN,
+            DPL::ToUTF8String(m_widgetModel->TizenId).c_str());
     }
     else
     {
index e81237a..5d2dc0c 100644 (file)
@@ -28,6 +28,7 @@
 #include <Evas.h>
 
 namespace WRT {
+typedef DPL::FastDelegate0<void> ProgressStartedCB;
 typedef DPL::FastDelegate2<Evas_Object*, double, void> ProgressCB;
 typedef DPL::FastDelegate0<void> ProgressFinishCB;
 typedef DPL::FastDelegate1<Evas_Object*, void> LoadStartCB;
@@ -44,8 +45,10 @@ typedef DPL::FastDelegate1<bool, void> ResetCB;
 typedef DPL::FastDelegate1<Evas_Object*, void> BufferUnsetCB;
 typedef DPL::FastDelegate1<Evas_Object*, void> BufferSetCB;
 typedef DPL::FastDelegate1<bool, void> ToggleFullscreenCB;
+typedef DPL::FastDelegate1<bool, void> EditorclientImeCB;
 
 struct UserDelegates {
+    ProgressStartedCB progressStarted;
     ProgressCB progress;
     ProgressFinishCB progressFinish;
     LoadStartCB loadStart;
@@ -62,6 +65,7 @@ struct UserDelegates {
     BufferUnsetCB bufferUnset;
     BufferSetCB bufferSet;
     ToggleFullscreenCB toggleFullscreen;
+    EditorclientImeCB editorClientIme;
 };
 
 typedef std::shared_ptr<UserDelegates> UserDelegatesPtr;
index 149548b..53f901c 100644 (file)
@@ -26,7 +26,9 @@
 
 IMPLEMENT_SINGLETON(PrepareExternalStorage)
 
-PrepareExternalStorage::PrepareExternalStorage() : m_handle(NULL) {
+PrepareExternalStorage::PrepareExternalStorage() :
+    m_handle(NULL),
+    m_pkdIdStr("") {
 }
 
 PrepareExternalStorage::~PrepareExternalStorage()
@@ -34,30 +36,23 @@ PrepareExternalStorage::~PrepareExternalStorage()
     Deinitialize();
 }
 
-void PrepareExternalStorage::Initialize(DPL::String pkgId)
+void PrepareExternalStorage::Initialize(const DPL::String &pkgId)
 {
-    if (NULL == m_pkgId) {
-        std::string pkdIdStr = DPL::ToUTF8String(pkgId);
-        const char* id = pkdIdStr.c_str();
+    m_pkdIdStr = DPL::ToUTF8String(pkgId);
+    const char* id = m_pkdIdStr.c_str();
 
-        m_pkgId = (char*)calloc(1, strlen(id) + 1);
-        snprintf(m_pkgId, strlen(id), "%s", id);
-
-        if (APP2EXT_SD_CARD == app2ext_get_app_location(
-                    pkdIdStr.c_str())
-                && (NULL == m_handle))
-        {
-            m_handle = app2ext_init(APP2EXT_SD_CARD);
-            if (m_handle) {
-                int ret = m_handle->interface.enable(m_pkgId);
-                if ( 0 < ret) {
-                    LogError("app2ext enable failed : " << ret);
-                } else {
-                    LogDebug("app2ext enable success");
-                }
+    if (APP2EXT_SD_CARD == app2ext_get_app_location(id) && (NULL == m_handle))
+    {
+        m_handle = app2ext_init(APP2EXT_SD_CARD);
+        if (m_handle) {
+            int ret = m_handle->interface.enable(id);
+            if (0 < ret) {
+                LogError("app2ext enable failed : " << ret);
             } else {
-                LogError("app2ext init failed");
+                LogDebug("app2ext enable success");
             }
+        } else {
+            LogError("app2ext init failed");
         }
     }
 }
@@ -65,10 +60,9 @@ void PrepareExternalStorage::Initialize(DPL::String pkgId)
 void PrepareExternalStorage::Deinitialize()
 {
     if (NULL != m_handle) {
-        if ( 0 < m_handle->interface.disable(m_pkgId)) {
+        if (0 < m_handle->interface.disable(m_pkdIdStr.c_str())) {
             LogError("app2ext disable failed");
         }
-        free(m_pkgId);
         m_handle = NULL;
     }
 }
index ec02a77..b17aeb4 100644 (file)
@@ -28,7 +28,7 @@
 
 class PrepareExternalStorage {
   public:
-    void Initialize(DPL::String pkgId);
+    void Initialize(const DPL::String &pkgId);
     void Deinitialize();
 
   private:
@@ -38,7 +38,7 @@ class PrepareExternalStorage {
     virtual ~PrepareExternalStorage();
 
     app2ext_handle* m_handle;
-    char* m_pkgId;
+    std::string m_pkdIdStr;
 };
 
 typedef DPL::Singleton<PrepareExternalStorage> PrepareExternalStorageSingleton;
index 06e87ca..3517792 100644 (file)
@@ -98,7 +98,8 @@ WidgetSettingList::WidgetSettingList() :
     m_BackButtonPresence(BackButton_Disable),
     m_ContextMenu(ContextMenu_Enable),
     m_Encryption(Encryption_Disable),
-    m_BackgroundSupport(BackgroundSupport_Disable)
+    m_BackgroundSupport(BackgroundSupport_Disable),
+    m_ProgressbarPresence(ProgressBar_Disable)
 {}
 
 WidgetSettingList::WidgetSettingList(WrtDB::WidgetSettings &widgetSettings)
@@ -109,6 +110,7 @@ WidgetSettingList::WidgetSettingList(WrtDB::WidgetSettings &widgetSettings)
     m_ContextMenu = ContextMenu_Enable;
     m_Encryption = Encryption_Disable;
     m_BackgroundSupport = BackgroundSupport_Disable;
+    m_ProgressbarPresence = ProgressBar_Disable;
 
     FOREACH(it, widgetSettings)
     {
@@ -191,51 +193,70 @@ WidgetSettingList::WidgetSettingList(WrtDB::WidgetSettings &widgetSettings)
             if (!userAgent.IsNull()) {
                 m_UserAgent = DPL::ToUTF8String(*userAgent);
             }
+        } else if (name == SETTING_NAME_PROGRESSBAR_PRESENCE) {
+            if (value == SETTING_VALUE_PROGRESSBAR_PRESENCE_ENABLE) {
+                m_ProgressbarPresence = ProgressBar_Enable;
+            } else if (value == SETTING_VALUE_PROGRESSBAR_PRESENCE_DISABLE) {
+                m_ProgressbarPresence = ProgressBar_Disable;
+            } else {
+                LogError("Invalid progressbar-presence value!! [" <<
+                         value << "]");
+                m_ProgressbarPresence = ProgressBar_Disable;
+            }
         } else {
             LogError("Invalid setting name!! [" << name << "]");
         }
     }
-    LogDebug("m_RotationLock: " << m_RotationLock);
-    LogDebug("m_IndicatorPresence: " << m_IndicatorPresence);
-    LogDebug("m_BackButtonPresence: " << m_BackButtonPresence);
-    LogDebug("m_ContextMenu: " << m_ContextMenu);
-    LogDebug("m_Encryption: " << m_Encryption);
-    LogDebug("m_BackgroundSupport: " << m_BackgroundSupport);
+
 }
 
 WidgetSettingScreenLock WidgetSettingList::getRotationValue() const
 {
+    LogDebug("m_RotationLock: " << m_RotationLock);
+
     return m_RotationLock;
 }
 
 WidgetSettingIndicatorPresence WidgetSettingList::getIndicatorPresence() const
 {
+    LogDebug("m_IndicatorPresence: " << m_IndicatorPresence);
+
     return m_IndicatorPresence;
 }
 
 WidgetSettingBackButtonPresence WidgetSettingList::getBackButtonPresence()
 const
 {
+    LogDebug("m_BackButtonPresence: " << m_BackButtonPresence);
+
     return m_BackButtonPresence;
 }
 
 WidgetSettingContextMenu WidgetSettingList::getContextMenu() const
 {
+    LogDebug("m_ContextMenu: " << m_ContextMenu);
+
     return m_ContextMenu;
 }
 
 WidgetSettingEncryption WidgetSettingList::getEncryption() const
 {
+    LogDebug("m_Encryption: " << m_Encryption);
+
     return m_Encryption;
 }
 
 WidgetSettingBackgroundSupport WidgetSettingList::getBackgroundSupport() const
 {
+    LogDebug("m_BackgroundSupport: " << m_BackgroundSupport);
+
     return m_BackgroundSupport;
 }
 
 bool WidgetSettingList::isEncrypted() const
 {
+    LogDebug("m_Encryption: " << m_Encryption);
+
     if (m_Encryption == Encryption_Enable) {
         return true;
     }
@@ -244,9 +265,18 @@ bool WidgetSettingList::isEncrypted() const
 
 std::string WidgetSettingList::getUserAgent() const
 {
+    LogDebug("m_UserAgent: " << m_UserAgent);
+
     return m_UserAgent;
 }
 
+WidgetSettingProgressBarPresence WidgetSettingList::getProgressBarPresence() const
+{
+    LogDebug("m_ProgressbarPresence: " << m_ProgressbarPresence);
+
+    return m_ProgressbarPresence;
+}
+
 bool WidgetSettingList::operator ==(const WidgetSettingList& other) const
 {
     return m_RotationLock == other.m_RotationLock &&
@@ -255,5 +285,6 @@ bool WidgetSettingList::operator ==(const WidgetSettingList& other) const
            m_ContextMenu == other.m_ContextMenu &&
            m_Encryption == other.m_Encryption &&
            m_BackgroundSupport == other.m_BackgroundSupport &&
-           m_UserAgent == other.m_UserAgent;
+           m_UserAgent == other.m_UserAgent &&
+           m_ProgressbarPresence == other.m_ProgressbarPresence;
 }
index 5be7c13..ca90140 100644 (file)
@@ -29,6 +29,7 @@
 #define WRT_SRC_DOMAIN_WIDGET_DATA_TYPES_H_
 
 #include <list>
+#include <memory>
 
 #include <dpl/utils/warp_iri.h>
 #include <dpl/utils/widget_version.h>
@@ -107,6 +108,8 @@ static const DPL::String SETTING_NAME_BACKGROUND_SUPPORT =
     L"background-support";
 static const DPL::String SETTING_NAME_USER_AGENT =
     L"user-agent";
+static const DPL::String SETTING_NAME_PROGRESSBAR_PRESENCE =
+    L"progressbar-presence";
 static const DPL::String SETTING_VALUE_ENABLE =
     L"enable";
 static const DPL::String SETTING_VALUE_DISABLE =
@@ -131,6 +134,10 @@ static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE =
     L"enable";
 static const DPL::String SETTING_VALUE_ENCRYPTION_DISABLE =
     L"disable";
+static const DPL::String SETTING_VALUE_PROGRESSBAR_PRESENCE_ENABLE =
+    L"enable";
+static const DPL::String SETTING_VALUE_PROGRESSBAR_PRESENCE_DISABLE =
+    L"disable";
 
 enum WidgetSettingScreenLock
 {
@@ -169,6 +176,12 @@ enum WidgetSettingBackgroundSupport
     BackgroundSupport_Disable    /* Default */
 };
 
+enum WidgetSettingProgressBarPresence
+{
+    ProgressBar_Enable,
+    ProgressBar_Disable    /* Default */
+};
+
 class WidgetSettingList
 {
   public:
@@ -192,6 +205,8 @@ class WidgetSettingList
 
     std::string getUserAgent() const;
 
+    WidgetSettingProgressBarPresence  getProgressBarPresence() const;
+
     bool operator ==(const WidgetSettingList& other) const;
 
   private:
@@ -201,8 +216,10 @@ class WidgetSettingList
     WidgetSettingContextMenu m_ContextMenu;
     WidgetSettingEncryption m_Encryption;
     WidgetSettingBackgroundSupport m_BackgroundSupport;
+    WidgetSettingProgressBarPresence m_ProgressbarPresence;
     std::string m_UserAgent;
 };
+typedef std::shared_ptr<WidgetSettingList> WidgetSettingListPtr;
 
 namespace OrientationAngle {
 namespace W3C {
@@ -224,6 +241,7 @@ namespace Landscape {
 const int PRIMARY  = 270;
 const int SECONDARY = 90;
 } // namespace Landscape
+const int UNLOCK = -1;
 } // namespace Window
 } // namespace OrientationAngle
 
index 5cf31a2..b125cfb 100644 (file)
 #include "widget_model.h"
 
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/wrt-dao-ro/widget_config.h>
 #include <dpl/log/log.h>
 #include <dpl/optional_typedefs.h>
 // to apply widget default locales instead of calling localizeWidgetModel()
 #include <dpl/localization/LanguageTagsProvider.h>
 
 namespace Domain {
+std::string getTimestamp()
+{
+    struct timeval tv;
+    char buff[128];
+
+    gettimeofday(&tv, NULL);
+    sprintf(buff, "%lf", (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f);
+    LogInfo("timestamp: " << buff);
+    return std::string(buff);
+}
+
 std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId,
                                                     DPL::OptionalUInt appControlIndex)
 {
@@ -37,9 +49,18 @@ std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId,
     if (WrtDB::WidgetDAOReadOnly::isWidgetInstalled(dplTizenId)) {
         LogDebug("Widget installed - creating model");
         model.reset(new WidgetModel(tizenId));
-        model->AppControlIndex.Set(appControlIndex);
 
         WrtDB::WidgetDAOReadOnly dao(dplTizenId);
+        DPL::String pkgId = dao.getTizenPkgId();
+        model->PersistentStoragePath.Set(
+            DPL::FromUTF8String(
+                WrtDB::WidgetConfig::GetWidgetPersistentStoragePath(pkgId)));
+        model->TemporaryStoragePath.Set(
+            DPL::FromUTF8String(
+                WrtDB::WidgetConfig::GetWidgetTemporaryStoragePath(pkgId)));
+
+        model->AppControlIndex.Set(appControlIndex);
+
         DPL::Optional<DPL::String> defloc = model->defaultlocale.Get();
         if (!defloc.IsNull()) {
             LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(
index 30cac08..4cdf283 100644 (file)
@@ -22,8 +22,6 @@
 #include <widget_model.h>
 #include <dpl/sstream.h>
 #include <dpl/event/model_bind_to_dao.h>
-#include <dpl/wrt-dao-ro/global_config.h>
-#include <dpl/wrt-dao-ro/widget_config.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 
 #include <dpl/utils/folder_size.h>
@@ -76,17 +74,8 @@ WidgetModel::WidgetModel(const std::string &tizenId) :
     InstallPath(
         this,
         &BindToWidgetDAO<DPL::String, &WidgetDAOReadOnly::getFullPath>::Get),
-    PersistentStoragePath(this,
-                          DPL::FromUTF8String(
-                              WidgetConfig::GetWidgetPersistentStoragePath(
-                                  this->TizenId))
-                          ),
-    // use of multiple widget model
-    TemporaryStoragePath(this,
-                         DPL::FromUTF8String(
-                             WidgetConfig::GetWidgetTemporaryStoragePath(
-                                 this->TizenId + getTimestamp()))
-                         ),
+    PersistentStoragePath(this),
+    TemporaryStoragePath(this),
     defaultlocale(
         this,
         &BindToWidgetDAO<DPL::OptionalString,
@@ -126,24 +115,14 @@ WidgetModel::WidgetModel(const std::string &tizenId) :
     SettingList(this),
     AppControlList(this),
     AppControlIndex(this),
-    SecurityModelVersion(this,
-                         &BindToWidgetDAO<WidgetSecurityModelVersion,
-                          &WidgetDAOReadOnly::getSecurityModelVersion>::Get)
+    SecurityModelVersion(this, &BindToWidgetDAO<WidgetSecurityModelVersion, &WidgetDAOReadOnly::getSecurityModelVersion>::Get),
+    SecurePopupUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getSecurityPopupUsage>::Get),
+    GeolocationUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getGeolocationUsage>::Get),
+    WebNotificationUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getWebNotificationUsage>::Get),
+    WebStorageUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getWebDatabaseUsage>::Get)
 {}
 
 DPL::String WidgetModel::getTizenId() const
 {
     return TizenId;
 }
-
-DPL::String WidgetModel::getTimestamp()
-{
-    struct timeval tv;
-    char buff[128];
-
-    gettimeofday(&tv, NULL);
-    sprintf(buff, "%lf", (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f);
-    LogInfo("timestamp: " << buff);
-    DPL::String timeString = DPL::FromUTF8String(std::string(buff));
-    return timeString;
-}
index 06146c2..6c2d6c4 100644 (file)
@@ -131,16 +131,14 @@ class WidgetModel : public DPL::Event::Model
      *
      * Gets path in which widget may store its persistent private data.
      */
-    DPL::Event::Property<DPL::String,
-                         DPL::Event::PropertyReadOnly> PersistentStoragePath;
+    DPL::Event::Property<DPL::String> PersistentStoragePath;
 
     /**
      * @brief Path to widget's temporary storage.
      *
      * Gets path in which widget may store its temporary private data.
      */
-    DPL::Event::Property<DPL::String,
-                         DPL::Event::PropertyReadOnly> TemporaryStoragePath;
+    DPL::Event::Property<DPL::String> TemporaryStoragePath;
 
     /**
      * @brief Widget defaultlocale
@@ -230,12 +228,22 @@ class WidgetModel : public DPL::Event::Model
                          DPL::Event::PropertyReadOnly,
                          DPL::Event::PropertyStorageDynamicCached> SecurityModelVersion;
 
+    DPL::Event::Property<WrtDB::SettingsType,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> SecurePopupUsage;
+    DPL::Event::Property<WrtDB::SettingsType,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> GeolocationUsage;
+    DPL::Event::Property<WrtDB::SettingsType,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> WebNotificationUsage;
+    DPL::Event::Property<WrtDB::SettingsType,
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> WebStorageUsage;
+
     WidgetModel(const std::string &tizenId);
 
   private:
-    // Custom read write delegates
-    static DPL::String           getTimestamp();
-
     DPL::String getTizenId() const;
 };
 
index 4f22676..8ddee2b 100644 (file)
@@ -57,7 +57,6 @@ SET(VIEW_COMMON_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/common/evas_object.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/scheme.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/scheme_action_map.cpp
-    ${PROJECT_SOURCE_DIR}/src/view/common/youtubehd.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_apps_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_custom_header_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_support.cpp
@@ -65,7 +64,6 @@ SET(VIEW_COMMON_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_origin_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_storage_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_uri_support.cpp
-    ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_user_agent_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_vibration_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_certificate_support.cpp
 )
index 0212c81..8dbb473 100644 (file)
@@ -24,7 +24,6 @@
 #include <app.h>
 #include <app_manager.h>
 #include <download.h>
-#include <youtubehd.h>
 #include <dpl/singleton_impl.h>
 #include <appsvc.h>
 
@@ -36,13 +35,14 @@ namespace {
 const char * const SERVICE_EXTRA_DATA_KEY_PATH = "path";
 const char * const SERVICE_EXTRA_DATA_KEY_COOKIE = "cookie";
 
-const char * const SCHEME_TYPE_YOUTUBE = "vnd.youtube";
 const char * const SCHEME_TYPE_RTSP = "rtsp";
 const char * const SCHEME_TYPE_HTML5_VIDEO = "html5video";
 }
 
-ApplicationLauncher::ApplicationLauncher()
-{}
+ApplicationLauncher::ApplicationLauncher() :
+    m_windowHandle(0)
+{
+}
 
 ApplicationLauncher::~ApplicationLauncher()
 {}
@@ -51,14 +51,19 @@ void ApplicationLauncher::OnEventReceived(
     const ApplicationLauncherEvents::LaunchApplicationByAppService &event)
 {
     int result;
-    bundle *args = event.GetArg0();
-    appsvc_res_fn responseCallback = event.GetArg1();
+    service_h serviceHandle = event.GetArg0();
+    service_reply_cb responseCallback = event.GetArg1();
     void *userData = event.GetArg2();
-    result = appsvc_run_service(args, 0, responseCallback, userData);
 
-    if (result < 0) {
+    if (m_windowHandle) {
+        service_set_window(serviceHandle, m_windowHandle);
+    }
+
+    result = service_send_launch_request(serviceHandle, responseCallback, userData);
+    if (result != SERVICE_ERROR_NONE) {
         LogError("Failed to run AppService : " << result);
     }
+    service_destroy(serviceHandle);
 }
 
 void ApplicationLauncher::OnEventReceived(
@@ -117,6 +122,10 @@ void ApplicationLauncher::OnEventReceived(
             }
         }
 
+        if (m_windowHandle) {
+            service_set_window(serviceHandle, m_windowHandle);
+        }
+
         //launch service
         ret = service_send_launch_request(serviceHandle, NULL, NULL);
         if (SERVICE_ERROR_NONE != ret) {
@@ -156,12 +165,8 @@ void ApplicationLauncher::OnEventReceived(
         }
 
         LogDebug("scheme: " << scheme);
-        if (SCHEME_TYPE_YOUTUBE == scheme) {
-            YouTubeHD *youtube = new YouTubeHD(m_tizenId);
-            url = youtube->getYouTubeHD(uri.c_str());
-            delete youtube;
-        } else if (SCHEME_TYPE_RTSP == scheme ||
-                   (SCHEME_TYPE_HTML5_VIDEO == scheme))
+        if (SCHEME_TYPE_RTSP == scheme ||
+            SCHEME_TYPE_HTML5_VIDEO == scheme)
         {
             url = uri.c_str();
         } else {
@@ -216,6 +221,11 @@ void ApplicationLauncher::OnEventReceived(
             return;
         }
 
+        // set window handle when available
+        if (m_windowHandle) {
+            service_set_window(serviceHandle, m_windowHandle);
+        }
+
         //launch service
         ret = service_send_launch_request(serviceHandle, NULL, NULL);
         if (SERVICE_ERROR_NONE != ret) {
@@ -235,3 +245,8 @@ void ApplicationLauncher::setWidgetTizenId(const std::string& tizenId)
     LogDebug("tizen id: " << tizenId);
     m_tizenId = tizenId;
 }
+
+void ApplicationLauncher::setWindowHandle(unsigned windowHandle)
+{
+    m_windowHandle = windowHandle;
+}
index d1eb925..eaf58c1 100644 (file)
 #include <dpl/singleton.h>
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
 
-#include <appsvc.h>
-#include <bundle.h>
+#include <appfw/app_service.h>
 
 namespace ApplicationLauncherEvents {
 DECLARE_GENERIC_EVENT_3(LaunchApplicationByAppService,
-                        bundle *,
-                        appsvc_res_fn,
+                        service_h,
+                        service_reply_cb,
                         void*)
 DECLARE_GENERIC_EVENT_4(LaunchApplicationByPkgname,
                         std::string,
@@ -64,6 +63,7 @@ class ApplicationLauncher :
     ApplicationLauncher();
     virtual ~ApplicationLauncher();
     void setWidgetTizenId(const std::string& tizenId);
+    void setWindowHandle(unsigned windowHandle);
 
   protected:
     virtual void OnEventReceived(
@@ -75,6 +75,7 @@ class ApplicationLauncher :
 
   private:
     std::string m_tizenId;
+    unsigned m_windowHandle;
 };
 
 typedef DPL::Singleton<ApplicationLauncher> ApplicationLauncherSingleton;
diff --git a/src/view/common/message_support.h b/src/view/common/message_support.h
new file mode 100644 (file)
index 0000000..f657f0a
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2011 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    message_support.h
+ * @author  Lukasz Wrzosek (l.wrzosek@samsung.com)
+ * @author  Yunchan Cho (yunchan.cho@samsung.com)
+ * @brief   definition of messages between UI Process and Injected bundle
+ */
+#ifndef WRT_SRC_VIEW_COMMON_MESSAGE_SUPPORT_H_
+#define WRT_SRC_VIEW_COMMON_MESSAGE_SUPPORT_H_
+
+namespace Message {
+
+namespace ToInjectedBundle {
+const char * const INIT = "ToInjectedBundle::INIT";
+const char * const START = "ToInjectedBundle::START";
+const char * const SHUTDOWN = "ToInjectedBundle::SHUTDOWN";
+const char * const SET_CUSTOM_PROPERTIES =
+    "ToInjectedBundle::SET_CUSTOM_PROPERTIES";
+const char * const DISPATCH_JS_EVENT = "ToInjectedBundle::DISPATCH_JS_EVENT";
+const char * const SET_XWINDOW_HANDLE =
+    "ToInjectedBundle::SET_XWINDOW_HANDLE";
+} // namespace ToInectedBundle
+
+namespace ToUIProcess {
+const char * const BLOCKED_URL = "ToUIProcess::BLOCKED_URL";
+#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
+const char * const SEND_WEBPROCESS_PID = "ToUIProcess::SEND_WEBPROCESS_PID";
+#endif
+} // namespace ToUIProcess
+
+namespace TizenScheme {
+const char * const GET_WINDOW_HANDLE = "tizen://getWindowHandle";
+} // namespace ToUIProcess
+
+} //namespace BundleMessages
+
+#endif // WRT_SRC_VIEW_COMMON_MESSAGE_SUPPORT_H_
index 618875f..a974414 100644 (file)
@@ -28,6 +28,7 @@ namespace {
 const char * const type2name[Scheme::COUNT] = {
     "file",
     "sms",
+    "smsto",
     "mmsto",
     "mailto",
     "data",
@@ -38,7 +39,6 @@ const char * const type2name[Scheme::COUNT] = {
 #ifdef APP_SCHEME_ENABLED
     "app",
 #endif
-    "vnd.youtube",
     "rtsp"
 };
 
index e55bcd8..a0296ad 100644 (file)
@@ -32,6 +32,7 @@ class Scheme
         INVALID = -1,
         FILE = 0,
         SMS,
+        SMSTO,
         MMSTO,
         MAILTO,
         DATA,
@@ -42,7 +43,6 @@ class Scheme
 #ifdef APP_SCHEME_ENABLED
         APP,
 #endif
-        YOUTUBE,
         RTSP,
 
         COUNT
index a86b728..fa661b7 100644 (file)
@@ -105,33 +105,34 @@ struct AppSvcConversion {
  * Struct defining an appsvc operation and a list of scheme conversions used to
  * fill in additional appsvc data.
  */
-struct AppSvcOperation {
+struct ServiceOperation {
     const char* operation;
     bool needUri;
     std::list<AppSvcConversion> conversions;
 };
 
-typedef std::map<Scheme::Type, AppSvcOperation> AppSvcOperationMap;
+typedef std::map<Scheme::Type, ServiceOperation> ServiceOperationMap;
 
 // Regular expressions used to extract appsvc data from scheme
 // TODO what about multiple recipients?
-char const * const REGEX_BODY = ".*[?&]body=([^&]+).*";
-char const * const REGEX_SMS = "sms:([^&]+).*";
-char const * const REGEX_MMSTO = "mmsto:([^&]+).*";
-char const * const REGEX_MAILTO = "mailto:([^&]+).*";
-char const * const REGEX_TO = ".*[?&]to=([^&]+).*";
-char const * const REGEX_CC = ".*[?&]cc=([^&]+).*";
-char const * const REGEX_BCC = ".*[?&]bcc=([^&]+).*";
-char const * const REGEX_SUBJECT = ".*[?&]subject=([^&]+).*";
+char const * const REGEX_BODY =         ".*[?&]body=([^&]+).*";
+char const * const REGEX_SMS =           "sms:([^&]+).*";
+char const * const REGEX_SMSTO =        "smsto:([^&]+).*";
+char const * const REGEX_MMSTO =        "mmsto:([^&]+).*";
+char const * const REGEX_MAILTO =       "mailto:([^&]+).*";
+char const * const REGEX_TO =           ".*[?&]to=([^&]+).*";
+char const * const REGEX_CC =           ".*[?&]cc=([^&]+).*";
+char const * const REGEX_BCC =          ".*[?&]bcc=([^&]+).*";
+char const * const REGEX_SUBJECT =      ".*[?&]subject=([^&]+).*";
 char const * const REGEX_DATA_CONTEXT = ".*;phone-context=([^:]+).*";
 
-AppSvcOperationMap initializeAppSvcOperations()
+ServiceOperationMap initializeAppSvcOperations()
 {
-    AppSvcOperationMap ret;
+    ServiceOperationMap ret;
 
     // FILE, HTTP & HTTPS
-    AppSvcOperation viewOp;
-    viewOp.operation = APPSVC_OPERATION_VIEW;
+    ServiceOperation viewOp;
+    viewOp.operation = SERVICE_OPERATION_VIEW;
     viewOp.needUri = true;
     // no additional data
     ret.insert(std::make_pair(Scheme::FILE, viewOp));
@@ -139,41 +140,50 @@ AppSvcOperationMap initializeAppSvcOperations()
     ret.insert(std::make_pair(Scheme::HTTPS, viewOp));
 
     // SMS
-    AppSvcOperation smsOp;
-    smsOp.operation = APPSVC_OPERATION_SEND_TEXT;
+    ServiceOperation smsOp;
+    smsOp.operation = SERVICE_OPERATION_COMPOSE;
     smsOp.needUri = false;
-    smsOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_SMS));
-    smsOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TEXT, REGEX_BODY));
+    smsOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_SMS));
+    smsOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TEXT, REGEX_BODY));
     ret.insert(std::make_pair(Scheme::SMS, smsOp));
 
+    // SMSTO
+    ServiceOperation smstoOp;
+    smstoOp.operation = SERVICE_OPERATION_COMPOSE;
+    smstoOp.needUri = false;
+    smstoOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_SMSTO));
+    smstoOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TEXT, REGEX_BODY));
+    ret.insert(std::make_pair(Scheme::SMSTO, smstoOp));
+
+
     // MMSTO & MAILTO
-    AppSvcOperation sendOp;
-    sendOp.operation = APPSVC_OPERATION_SEND;
+    ServiceOperation sendOp;
+    sendOp.operation = SERVICE_OPERATION_COMPOSE;
     sendOp.needUri = true;
-    sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_MMSTO));
-    sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_MAILTO));
-    sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_CC, REGEX_CC));
+    sendOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_MMSTO));
+    sendOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_MAILTO));
+    sendOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_CC, REGEX_CC));
     sendOp.conversions.push_back(
-        AppSvcConversion(APPSVC_DATA_BCC, REGEX_BCC));
+        AppSvcConversion(SERVICE_DATA_BCC, REGEX_BCC));
     sendOp.conversions.push_back(
-        AppSvcConversion(APPSVC_DATA_SUBJECT, REGEX_SUBJECT));
+        AppSvcConversion(SERVICE_DATA_SUBJECT, REGEX_SUBJECT));
     sendOp.conversions.push_back(
-        AppSvcConversion(APPSVC_DATA_TEXT, REGEX_BODY));
+        AppSvcConversion(SERVICE_DATA_TEXT, REGEX_BODY));
     ret.insert(std::make_pair(Scheme::MMSTO, sendOp));
     ret.insert(std::make_pair(Scheme::MAILTO, sendOp));
 
     // TODO what about DATA?
 
     // TEL
-    AppSvcOperation telOp;
-    telOp.operation = APPSVC_OPERATION_CALL;
+    ServiceOperation telOp;
+    telOp.operation = SERVICE_OPERATION_CALL;
     telOp.needUri = true;
     ret.insert(std::make_pair(Scheme::TEL, telOp));
 
     return ret;
 }
 
-AppSvcOperationMap g_appSvcOperationMap = initializeAppSvcOperations();
+ServiceOperationMap g_serviceOperationMap = initializeAppSvcOperations();
 } // namespace
 
 namespace SchemeActionMap {
@@ -202,15 +212,19 @@ bool HandleUri(const char* uri,
         // case of unknown scheme, send to app-control
         // This is temporary soultion. "invalid" scheme should be handled by
         // scheme map data
-        bundle* bundleData = bundle_create();
-        appsvc_set_operation(bundleData, APPSVC_OPERATION_VIEW);
-        appsvc_set_uri(bundleData, uri);
-        CONTROLLER_POST_EVENT(
-            ApplicationLauncher,
-            ApplicationLauncherEvents::LaunchApplicationByAppService(
-                bundleData,
-                NULL,
-                NULL));
+
+        // create service
+        service_h serviceHandle = NULL;
+        if (SERVICE_ERROR_NONE != service_create(&serviceHandle)) {
+            service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+            service_set_uri(serviceHandle, uri);
+            CONTROLLER_POST_EVENT(
+                ApplicationLauncher,
+                ApplicationLauncherEvents::LaunchApplicationByAppService(
+                    serviceHandle,
+                    NULL,
+                    NULL));
+        }
         return false;
     }
 
@@ -238,18 +252,19 @@ bool HandleUri(const char* uri,
     case URI_ACTION_APPSVC:
     {
         // find AppSvcOperation for given scheme type
-        auto it = g_appSvcOperationMap.find(type);
-        if (it == g_appSvcOperationMap.end()) {
+        auto it = g_serviceOperationMap.find(type);
+        if (it == g_serviceOperationMap.end()) {
             LogError("No entry for scheme: " << name);
             return false;
         }
 
         // prepare appsvc bundle
-        bundle* bundleData = bundle_create();
+        service_h serviceHandle = NULL;
+        service_create(&serviceHandle);
         LogDebug("appsvc operation " << it->second.operation);
-        appsvc_set_operation(bundleData, it->second.operation);
+        service_set_operation(serviceHandle, it->second.operation);
         if (it->second.needUri) {
-            appsvc_set_uri(bundleData, uri);
+            service_set_uri(serviceHandle, uri);
         }
 
         // this is safe as there are no other threads
@@ -272,7 +287,7 @@ bool HandleUri(const char* uri,
             // convert scheme text to appsvc format
             while (cit->regex->Consume(&input, &match)) {
                 LogInfo("Adding apssvc data: " << cit->key << " " << match);
-                appsvc_add_data(bundleData, cit->key, match.c_str());
+                service_add_extra_data(serviceHandle, cit->key, match.c_str());
             }
         }
 
@@ -280,7 +295,7 @@ bool HandleUri(const char* uri,
         CONTROLLER_POST_EVENT(
             ApplicationLauncher,
             ApplicationLauncherEvents::LaunchApplicationByAppService(
-                bundleData,
+                serviceHandle,
                 NULL,
                 NULL));
         break;
index 46415ea..4571f4c 100644 (file)
@@ -72,7 +72,6 @@ const UriAction g_tizenActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = {
 #ifdef APP_SCHEME_ENABLED
     { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT },           // APP
 #endif
-    { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO },     // YOUTUBE
     { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO }      // RTSP
 };
 
@@ -91,7 +90,6 @@ const UriAction g_wacActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = {
 #ifdef APP_SCHEME_ENABLED
     { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_APPSVC },        // APP
 #endif
-    { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO },     // YOUTUBE
     { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO }      // RTSP
 };
 }
index dc7c318..4e07b7a 100644 (file)
@@ -65,10 +65,8 @@ class AppsSupportImplementation
              return false;
          }
 
-         bundle *args = NULL;
-         args = bundle_create();
-         void *userData = NULL;
-         appsvc_res_fn responseCallback = NULL;
+         service_h serviceHandle = NULL;
+         service_create(&serviceHandle);
 
          // ignore case match of string of mime type
          // if needed, define appsvc response callback
@@ -76,9 +74,9 @@ class AppsSupportImplementation
          if (!strcasecmp(mimeType.c_str(), HTTP_STREAMING_APPLE_MIMETYPE) ||
              !strcasecmp(mimeType.c_str(), HTTP_STREAMING_MPEG_MIMETYPE))
          {
-             appsvc_set_operation(args, APPSVC_OPERATION_VIEW);
-             appsvc_set_mime(args, mimeType.c_str());
-             appsvc_set_uri(args, uri.c_str());
+             service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+             service_set_mime(serviceHandle, mimeType.c_str());
+             service_set_uri(serviceHandle, uri.c_str());
          } else if (!strcasecmp(mimeType.c_str(), "video/mp4") ||
                     !strcasecmp(mimeType.c_str(), "vidoe/3gp"))
          {
@@ -91,16 +89,16 @@ class AppsSupportImplementation
                      "null"));
          } else {
              LogInfo("Not Supported MIME type in WRT");
-             bundle_free(args);
+             service_destroy(serviceHandle);
              return false;
          }
 
          CONTROLLER_POST_EVENT(
              ApplicationLauncher,
              ApplicationLauncherEvents::LaunchApplicationByAppService(
-                 args,
-                 responseCallback,
-                 userData));
+                 serviceHandle,
+                 NULL,
+                 NULL));
 
          return true;
      }
@@ -130,7 +128,7 @@ class AppsSupportImplementation
             return false;
         }
         std::ofstream out(dest);
-        if (in.is_open() == false) {
+        if (out.is_open() == false) {
             LogError("Fail to open output file");
             return false;
         }
@@ -288,7 +286,7 @@ class AppsSupportImplementation
                "AppsSupport has to be deinitialized prior destroying!");
     }
 
-    void initialize(WidgetModel *widgetModel)
+    void initialize(WidgetModel *widgetModel, unsigned windowHandle)
     {
         Assert(!m_initialized && "Already initialized!");
 
@@ -299,6 +297,7 @@ class AppsSupportImplementation
         ApplicationLauncherSingleton::Instance().Touch();
         ApplicationLauncherSingleton::Instance().setWidgetTizenId(
             DPL::ToUTF8String(m_widgetModel->TizenId));
+        ApplicationLauncherSingleton::Instance().setWindowHandle(windowHandle);
 
         LogDebug("Initialized");
         m_initialized = true;
@@ -386,9 +385,9 @@ AppsSupport::AppsSupport() : m_impl(new AppsSupportImplementation)
 AppsSupport::~AppsSupport()
 {}
 
-void AppsSupport::initialize(WidgetModel *widgetModel)
+void AppsSupport::initialize(WidgetModel *widgetModel, unsigned windowHandle)
 {
-    m_impl->initialize(widgetModel);
+    m_impl->initialize(widgetModel, windowHandle);
 }
 
 void AppsSupport::deinitialize()
index aeb89fc..505f3ac 100644 (file)
@@ -36,7 +36,7 @@ class AppsSupport
     AppsSupport();
     virtual ~AppsSupport();
 
-    void initialize(WidgetModel *);
+    void initialize(WidgetModel *, unsigned);
     void deinitialize();
     void html5VideoRequest(void* event_info);
     void downloadRequest(
old mode 100755 (executable)
new mode 100644 (file)
index 308157c..2ed0902
 #include <memory>\r
 #include <Evas.h>\r
 #include <Elementary.h>\r
-#include <vconf.h>\r
 #include <dpl/log/log.h>\r
 #include <dpl/assert.h>\r
 #include <dpl/wrt-dao-ro/common_dao_types.h>\r
-#include <dpl/wrt-dao-ro/vconf_config.h>\r
 #include <wrt-commons/certificate-dao/certificate_dao.h>\r
 #include <widget_model.h>\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 5f6dd74..f5ef385
 #include <memory>
 #include <Evas.h>
 #include <Elementary.h>
-#include <vconf.h>
 #include <dpl/log/log.h>
 #include <dpl/assert.h>
 #include <dpl/wrt-dao-ro/common_dao_types.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <wrt-commons/security-origin-dao/security_origin_dao.h>
 #include <widget_model.h>
 
@@ -72,33 +70,6 @@ class SecurityOriginSupportImplementation
         }
         return m_securityOriginDAO.get();
     }
-
-    WrtDB::SettingsType isNeedPermissionCheck(
-        WrtDB::Feature feature)
-    {
-        using namespace SecurityOriginDB;
-        using namespace WrtDB;
-        std::string key;
-        if (feature == FEATURE_GEOLOCATION) {
-            key = WrtDB::VconfConfig::GetVconfKeyGeolocationUsage(
-                    m_model->TizenId);
-        } else if (feature == FEATURE_WEB_NOTIFICATION) {
-            key = WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage(
-                    m_model->TizenId);
-        } else if (feature == FEATURE_WEB_DATABASE) {
-            key = WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage(
-                    m_model->TizenId);
-        } else {
-            Assert("Wrong feature argument is input");
-        }
-
-        int value = 0;
-        vconf_get_int(key.c_str(), &value);
-        LogDebug(key << " = " << value);
-        WrtDB::SettingsType ret = static_cast<WrtDB::SettingsType>(value);
-
-        return ret;
-    }
 };
 
 SecurityOriginSupport::SecurityOriginSupport(WidgetModel* widgetModel) :
@@ -114,12 +85,6 @@ SecurityOriginDB::SecurityOriginDAO* SecurityOriginSupport::
     return m_impl->getSecurityOriginDAO();
 }
 
-WrtDB::SettingsType SecurityOriginSupport::isNeedPermissionCheck(
-    WrtDB::Feature feature)
-{
-    return m_impl->isNeedPermissionCheck(feature);
-}
-
 Evas_Object* SecurityOriginSupportUtil::createPopup(
     Evas_Object* window,
     const char* bodyText,
old mode 100755 (executable)
new mode 100644 (file)
index 3779f2b..b8867bc
@@ -43,8 +43,6 @@ class SecurityOriginSupport
     SecurityOriginSupport(WidgetModel* widgetModel);
     virtual ~SecurityOriginSupport();
     SecurityOriginDB::SecurityOriginDAO* getSecurityOriginDAO();
-    WrtDB::SettingsType isNeedPermissionCheck(
-        WrtDB::Feature feature);
 
   private:
     std::unique_ptr<SecurityOriginSupportImplementation> m_impl;
index 258c637..ed720bd 100644 (file)
@@ -21,6 +21,8 @@
 #include "view_logic_storage_support.h"
 
 #include <string>
+#include <ftw.h>
+
 #include <dpl/assert.h>
 #include <dpl/exception.h>
 #include <dpl/log/log.h>
@@ -32,6 +34,43 @@ namespace ViewModule {
 namespace StorageSupport {
 namespace { //anonymous
 const mode_t TEMPORARY_STORAGE_MODE = 0700;
+static bool rootDirectory = true;
+
+static int removeFile(const char* path, const struct stat* /*sb*/, int tflag)
+{
+    if (path == NULL) {
+        LogError("Wrong input path");
+    }
+    LogDebug(path);
+    std::string inputPath = path;
+
+    if (rootDirectory) {
+        LogDebug("Skip root directory");
+        rootDirectory = false;
+        return 0;
+    }
+
+    if (tflag == FTW_F || tflag == FTW_D) {
+        if (!WrtUtilRemove(inputPath)) {
+            LogError("Fail to remove");
+        }
+    } else if (tflag == FTW_DNR) {
+        LogError("This is directory which can't be read");
+    } else if (tflag == FTW_NS) {
+        LogError("Unknow error");
+    }
+
+    return 0;
+}
+
+bool removeDirectory(const char* path)
+{
+    rootDirectory = true;
+    if (ftw(path, removeFile, 20) != 0) {
+        return false;
+    }
+    return true;
+}
 }
 
 void initializeStorage(WidgetModel *widgetModel)
@@ -42,9 +81,11 @@ void initializeStorage(WidgetModel *widgetModel)
     // create temporary storage
     std::string path =
         DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
-    if (!WrtUtilMakeDir(path, TEMPORARY_STORAGE_MODE)) {
-        ThrowMsg(DPL::CommonException::InternalError,
-                 "Fail to initialize temporary storage");
+    if (!WrtUtilDirExists(path)) {
+        if (!WrtUtilMakeDir(path, TEMPORARY_STORAGE_MODE)) {
+            ThrowMsg(DPL::CommonException::InternalError,
+                     "Fail to initialize temporary storage");
+        }
     }
 }
 
@@ -53,12 +94,11 @@ void deinitializeStorage(WidgetModel *widgetModel)
     LogDebug("deinitializeStorage");
     Assert(widgetModel && "Passed widgetModel is NULL!");
 
-    // remove temporary storage
+    // clean-up temporary storage
     std::string path =
         DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
-    if (!WrtUtilRemove(path)) {
-        ThrowMsg(DPL::CommonException::InternalError,
-                 "Fail to deinitialize temporary storage");
+    if (!removeDirectory(path.c_str())) {
+        LogError("Fail to deinitialize temporary storage");
     }
 }
 } // namespace StorageSupport
diff --git a/src/view/common/view_logic_user_agent_support.cpp b/src/view/common/view_logic_user_agent_support.cpp
deleted file mode 100644 (file)
index 971913f..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2011 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  Jaroslaw Osmanski (j.osmanski@samsung.com)
- * @brief   Implementation file of UserAgent API used by ViewLogic
- */
-
-#include "view_logic_user_agent_support.h"
-
-#include <vconf.h>
-#include <vconf-keys.h>
-
-#include <string>
-#include <dpl/log/log.h>
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-
-namespace {
-// TODO: remove this after ua is fixed...
-const std::string USERAGENT_KEY = VCONFKEY_BROWSER_BROWSER_USER_AGENT;
-const std::string SYSTEM_USER_AGENT = "System user agent";
-};
-
-namespace ViewModule {
-namespace UserAgentSupport {
-std::string getUserAgentFromVconf()
-{
-    using namespace WrtDB;
-    char* vconfValue = vconf_get_str(USERAGENT_KEY.c_str());
-    std::string userAgentName;
-
-    if (!vconfValue) {
-        userAgentName = "Tizen";
-    } else {
-        userAgentName = vconfValue;
-    }
-
-    free(vconfValue);
-
-    LogDebug("userAgentName: " << userAgentName);
-    std::string userAgent;
-
-    if (userAgentName == SYSTEM_USER_AGENT) {
-        /* do nothing */
-    } else {
-        DPL::String value =
-            GlobalDAOReadOnly::GetUserAgentValue(DPL::FromUTF8String(
-                                                     userAgentName));
-        userAgent = DPL::ToUTF8String(value);
-        LogDebug("value : " << value);
-    }
-    LogDebug("UA:[" << userAgentName << "] UA string:[" << userAgent << "]");
-
-
-    return userAgent;
-}
-} // namespace ViewModule
-} // namespace UserAgentSupport
index 3bd0305..7d004bf 100644 (file)
@@ -48,12 +48,13 @@ SET(VIEW_MODULE_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_authentication_challenge_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_certificate_confirm_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_geolocation_support.cpp
+    ${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_service_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
-    ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/plugin_module_support.cpp
     ${VIEW_MODULE_SOURCES}
 )
 
index 6df3a2a..5e445a8 100644 (file)
@@ -24,19 +24,19 @@ PKG_CHECK_MODULES(INJECTED_BUNDLE_DEP
     dpl-efl
     dpl-utils-efl
     dpl-wrt-dao-ro
-    dpl-encryption
     ewebkit2
-    vconf
-    osp-appfw
     libprivilege-control
     libiri
     libpcrecpp
+    wrt-plugins-ipc-message
+    wrt-dispatch-event
     REQUIRED
 )
 
 SET(INJECTED_BUNDLE_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/wrt-injected-bundle.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp
+    ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/injected_bundle_decryption_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/page_global_context_container.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/scheme.cpp
 )
@@ -63,7 +63,7 @@ TARGET_LINK_LIBRARIES(
 )
 
 # for encryption
-TARGET_LINK_LIBRARIES(${TARGET_INJECTED_BUNDLE_LIB} -L/usr/lib/osp -losp-appfw)
+TARGET_LINK_LIBRARIES(${TARGET_INJECTED_BUNDLE_LIB} "-lss-client")
 
 SET_TARGET_PROPERTIES(${TARGET_INJECTED_BUNDLE_LIB} PROPERTIES
     VERSION ${PROJECT_VERSION}
diff --git a/src/view/webkit/injected-bundle/injected_bundle_decryption_support.cpp b/src/view/webkit/injected-bundle/injected_bundle_decryption_support.cpp
new file mode 100644 (file)
index 0000000..d0ef7fb
--- /dev/null
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2012 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    injected_bundle_decryption_support.cpp
+ * @author  Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ */
+
+#include "injected_bundle_decryption_support.h"
+
+#include <memory>
+#include <set>
+#include <string>
+#include <sys/stat.h>
+#include <ss_manager.h>
+#include <openssl/sha.h>
+#include <openssl/hmac.h>
+#include <openssl/evp.h>
+#include <openssl/bio.h>
+#include <openssl/buffer.h>
+
+#include <dpl/log/log.h>
+#include <dpl/assert.h>
+#include <dpl/string.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/utils/mime_type_utils.h>
+
+namespace InjectedBundle {
+namespace {
+const char * const SCHEME_FILE_SLASH = "file://";
+const char * const DATA_STRING = "data:";
+const char * const BASE64_STRING = ";base64,";
+const char QUESTION_MARK = '?';
+const char ASTERISK_MARK = '#';
+}
+
+//Implementation class
+class DecryptionSupportImplementation
+{
+  private:
+    bool m_initialized;
+
+    WrtDB::TizenAppId m_appId;
+    WrtDB::EncryptedFileList m_encryptedFiles;
+    bool m_isEncrypted;
+    std::set<WrtDB::EncryptedFileInfo>::iterator m_targetIt;
+    bool m_isPreload;
+
+
+    std::string getFilePath(const std::string& url)
+    {
+        std::string filePath = url;
+
+        size_t pos = filePath.find_first_not_of(SCHEME_FILE_SLASH);
+        if (pos != std::string::npos) {
+            filePath = filePath.substr(pos - 1);
+        }
+
+        pos = filePath.find_first_of(ASTERISK_MARK);
+        if (pos != std::string::npos) {
+            filePath = filePath.substr(0, pos);
+        }
+
+        pos = filePath.find_first_of(QUESTION_MARK);
+        if (pos != std::string::npos) {
+            filePath = filePath.substr(0, pos);
+        }
+
+        return filePath;
+    }
+
+    int ssmDecrypt(const std::string pkgId, const char* inBuf, int inSize, char** outBuf, int* outSize)
+    {
+        if (m_isPreload) {
+            return ssm_decrypt_preloaded_application(inBuf, inSize, outBuf,
+                    outSize);
+        } else {
+            return ssm_decrypt(pkgId.c_str(), pkgId.length(), inBuf, inSize, outBuf, outSize);
+        }
+    }
+
+    std::string doDecrypt(std::string filePath, int size)
+    {
+        struct stat buf;
+        if (0 == stat(filePath.c_str(), &buf)) {
+            const std::size_t fileSize = buf.st_size;
+            std::unique_ptr<unsigned char[]> inChunk;
+
+            FILE* fp = fopen(filePath.c_str(), "rb");
+            if (NULL == fp) {
+                LogDebug("Couldnot open file : " << filePath);
+                return std::string();
+            }
+
+            std::unique_ptr<unsigned char[]> DecryptedString(new unsigned
+                    char[fileSize]);
+            std::string pkgid(DPL::ToUTF8String(m_appId));
+
+            int writeCount = 0;
+            do {
+                unsigned char getDecSize[4];
+                memset(getDecSize, 0x00, sizeof(getDecSize));
+
+                size_t readSize = fread(getDecSize, sizeof(unsigned char), sizeof(getDecSize), fp);
+                if (0 != readSize) {
+                    unsigned int readBufSize = 0;
+                    std::istringstream(std::string((char*)getDecSize)) >> readBufSize;
+                    inChunk.reset(new unsigned char[readBufSize]);
+
+                    size_t decReadSize = fread(inChunk.get(), sizeof(unsigned char), readBufSize, fp);
+
+                    if (0 != decReadSize) {
+                        char *outChunk = NULL;
+                        int outSize = 0;
+                        if (0 != ssmDecrypt(pkgid, (char*)inChunk.get(), (int)decReadSize, &outChunk, &outSize))
+                        {
+                            LogError("Failed to get decrypted resource");
+                            fclose(fp);
+                            return std::string();
+                        }
+                        memcpy(DecryptedString.get() + writeCount, outChunk, outSize);
+                        writeCount += outSize;
+                    }
+                }
+            } while( 0 == std::feof(fp));
+            fclose(fp);
+            memset(DecryptedString.get() + size, '\n', fileSize - size);
+            LogDebug("resource need to encoding base64");
+            BIO *bmem, *b64;
+            BUF_MEM *bptr;
+
+            b64 = BIO_new(BIO_f_base64());
+            bmem = BIO_new(BIO_s_mem());
+            b64 = BIO_push(b64, bmem);
+            BIO_write(b64, DecryptedString.get(), fileSize);
+            BIO_flush(b64);
+            BIO_get_mem_ptr(b64, &bptr);
+
+            std::string base64Enc((char *)bptr->data, bptr->length - 1);
+            BIO_free_all(b64);
+
+            return base64Enc;
+        }
+        return std::string();
+    }
+
+  public:
+    DecryptionSupportImplementation() :
+        m_initialized(false),
+        m_isEncrypted(false),
+        m_isPreload(false)
+    {
+    }
+
+    void initialize(WrtDB::TizenAppId appId)
+    {
+        LogInfo("initialize");
+
+        m_appId = appId;
+        WrtDB::WidgetDAOReadOnly dao(m_appId);
+        dao.getEncryptedFileList(m_encryptedFiles);
+        if (!m_encryptedFiles.empty()) {
+          m_isEncrypted = true;
+          LogDebug("encrypted application");
+        }
+
+        std::string installedPath =
+            DPL::ToUTF8String(*dao.getWidgetInstalledPath());
+        std::string preloadPath(WrtDB::GlobalConfig::GetUserPreloadedWidgetPath());
+        if (0 == installedPath.compare(0, preloadPath.length(), preloadPath)) {
+            m_isPreload = true;
+            LogDebug("preload application");
+        }
+
+        m_initialized = true;
+    }
+
+    void deinitialize(void)
+    {
+        LogInfo("deinitialize");
+
+        m_encryptedFiles.clear();
+        m_targetIt = m_encryptedFiles.end();
+        m_isEncrypted = false;
+        m_appId = DPL::String(L"");
+        m_initialized = false;
+    }
+
+    bool isNeedDecryption(std::string url)
+    {
+        if (!m_initialized) {
+            LogInfo("not initialize");
+            return false;
+        }
+
+        if (0 != strncmp(url.c_str(), SCHEME_FILE_SLASH, strlen(SCHEME_FILE_SLASH))) {
+            return false;
+        }
+
+        std::set<WrtDB::EncryptedFileInfo>::iterator it;
+        WrtDB::EncryptedFileInfo info;
+        std::string filePath = getFilePath(url);
+        info.fileName = DPL::FromUTF8String(filePath);
+        if (m_encryptedFiles.end() != (it = m_encryptedFiles.find(info))) {
+            LogDebug(" info file name : " << it->fileName);
+            LogDebug(" info file size : " << it->fileSize);
+            m_targetIt = it;
+            return true;
+        }
+        return false;
+    }
+
+    std::string decryptResource(std::string url)
+    {
+        if (!m_initialized) {
+            LogInfo("not initialize");
+            return std::string();
+        }
+
+        std::string filePath = getFilePath(url);
+        if (filePath != DPL::ToUTF8String(m_targetIt->fileName)) {
+            if (!isNeedDecryption(filePath)) {
+                return std::string();
+            }
+        }
+
+        std::string decryptString =
+            doDecrypt(DPL::ToUTF8String(m_targetIt->fileName),
+                      m_targetIt->fileSize);
+        if (!decryptString.empty()) {
+            std::string destString = DATA_STRING;
+
+            std::string mimeString =
+                DPL::ToUTF8String(
+                    MimeTypeUtils::identifyFileMimeType(
+                        DPL::FromUTF8String(url)));
+
+            destString += mimeString;
+            destString += BASE64_STRING;
+
+            decryptString.insert(0, destString);
+        }
+        return decryptString;
+    }
+};
+
+DecryptionSupport::DecryptionSupport() :
+    m_impl(new DecryptionSupportImplementation)
+{
+}
+
+DecryptionSupport::~DecryptionSupport()
+{
+}
+
+void DecryptionSupport::initialize(WrtDB::TizenAppId appId)
+{
+    m_impl->initialize(appId);
+}
+
+void DecryptionSupport::deinitialize(void)
+{
+    m_impl->deinitialize();
+}
+
+bool DecryptionSupport::isNeedDecryption(std::string url)
+{
+    return m_impl->isNeedDecryption(url);
+}
+
+std::string DecryptionSupport::decryptResource(std::string url)
+{
+    return m_impl->decryptResource(url);
+}
+}  // namespace InjectedBundle
diff --git a/src/view/webkit/injected-bundle/injected_bundle_decryption_support.h b/src/view/webkit/injected-bundle/injected_bundle_decryption_support.h
new file mode 100644 (file)
index 0000000..0f3897e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2012 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    injected_bundle_decryption_support.h
+ * @author  Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ */
+#ifndef INJECTED_BUNDLE_DECRYPTION_SUPPORT_H_
+#define INJECTED_BUNDLE_DECRYPTION_SUPPORT_H_
+
+#include <memory>
+#include <string>
+#include <dpl/wrt-dao-ro/common_dao_types.h>
+
+namespace InjectedBundle {
+class DecryptionSupportImplementation;
+
+class DecryptionSupport
+{
+  public:
+    DecryptionSupport();
+    virtual ~DecryptionSupport();
+    void initialize(WrtDB::TizenAppId appId);
+    void deinitialize(void);
+    bool isNeedDecryption(std::string url);
+    std::string decryptResource(std::string url);
+
+  private:
+    std::unique_ptr<DecryptionSupportImplementation> m_impl;
+};
+} // namespace InjectedBundle
+
+#endif // INJECTED_BUNDLE_DECRYPTION_SUPPORT_H_
index 9d41b04..3fda48f 100644 (file)
@@ -46,7 +46,6 @@
 #include <WKString.h>
 #include <WKType.h>
 
-
 namespace {
 char const * const SCHEME_TYPE_FILE = "file";
 char const * const SCHEME_TYPE_WIDGET = "widget";
@@ -106,8 +105,16 @@ bool checkWARP(const char *url, const DPL::String& tizenId)
     WrtDB::WidgetAccessInfoList widgetAccessInfoList;
     dao.getWidgetAccessInfo(widgetAccessInfoList);
 
+    // temporary solution for libiri parsing error
+    // This code will be removed
+    std::string urlstr = url;
+    size_t pos = urlstr.find_first_of("#?");
+    if (pos != std::string::npos) {
+        urlstr = urlstr.substr(0, pos);
+    }
+
     return (static_cast<WidgetAccessList>(widgetAccessInfoList)).isRequiredIRI(
-               DPL::FromUTF8String(std::string(url)));
+               DPL::FromUTF8String(urlstr));
 }
 
 bool checkWhitelist(const char *url)
@@ -243,6 +250,31 @@ bool checkACE(const char* url, bool xhr, const DPL::String& tizenId)
 } // namespace (anonymous)
 
 namespace InjectedBundleURIHandling {
+bool processURI(const std::string& inputURI,
+                const DPL::String& tizenId,
+                WrtDB::WidgetSecurityModelVersion version)
+{
+    if (version == WrtDB::WidgetSecurityModelVersion::WIDGET_SECURITY_MODEL_V1)
+    {
+        if (!checkWARP(inputURI.c_str(), tizenId))
+        {
+            LogWarning("Request was blocked by WARP: " << inputURI);
+
+            return false;
+        }
+    }
+
+// disable for performance
+#if 0
+    if (!preventSymlink(uri)) {
+        LogWarning("Request for symlink is invalid: " << uri);
+        return false;
+    }
+#endif
+
+    return true;
+}
+
 bool processURI(const DPL::String& inputURI,
                 const DPL::String& tizenId,
                 WrtDB::WidgetSecurityModelVersion version)
@@ -263,15 +295,13 @@ bool processURI(const DPL::String& inputURI,
         }
     }
 
-    if (!checkACE(uri.c_str(), true, tizenId)) {
-        LogWarning("Request was blocked by ACE: " << uri);
-        return false;
-    }
-
+// disable for performance
+#if 0
     if (!preventSymlink(uri)) {
         LogWarning("Request for symlink is invalid: " << uri);
         return false;
     }
+#endif
 
     return true;
 }
@@ -307,15 +337,13 @@ bool processMainResource(const DPL::String& inputURI,
 #endif
     }
 
-    if (!checkACE(uri.c_str(), true, tizenId)) {
-        LogWarning("Request was blocked by ACE: " << uri);
-        return false;
-    }
-
+// disable for performance
+#if 0
     if (!preventSymlink(uri)) {
         LogWarning("Request for symlink is invalid: " << uri);
         return false;
     }
+#endif
 
     return true;
 }
@@ -328,6 +356,26 @@ bool processURIForPlugin(const char* url)
     return true;
 }
 
+std::string localizeURI(const std::string& inputURI, const std::string& tizenId)
+{
+    if (inputURI.compare(0, strlen(SCHEME_TYPE_WIDGET), SCHEME_TYPE_WIDGET) &&
+        inputURI.compare(0, strlen(SCHEME_TYPE_FILE), SCHEME_TYPE_FILE) &&
+        inputURI.compare(0, strlen(SCHEME_TYPE_APP), SCHEME_TYPE_APP))
+    {
+        return inputURI;
+    }
+
+    std::string localizedURI = W3CFileLocalization::getFilePathInWidgetPackageFromUrl(tizenId, inputURI);
+
+    if (localizedURI.empty())
+    {
+        return inputURI;
+    }
+    else
+    {
+        return std::string("file://") + localizedURI;
+    }
+}
 
 DPL::OptionalString localizeURI(const DPL::String& inputURI,
                                 const DPL::String& tizenId)
@@ -360,6 +408,7 @@ DPL::OptionalString localizeURI(const DPL::String& inputURI,
     if (found.IsNull()) {
         // In this case, path doesn't need to localize. return input uri
         LogDebug("Path not found within current locale in current widget");
+
         return DPL::OptionalString(inputURI);
     } else {
         DPL::String uri(L"file://" + *found);
index afa92ce..f7705b9 100644 (file)
@@ -31,12 +31,16 @@ namespace InjectedBundleURIHandling {
 bool processURI(const DPL::String& inputURI,
                 const DPL::String& tizenId,
                 WrtDB::WidgetSecurityModelVersion m_securityModelVersion);
+bool processURI(const std::string& inputURI,
+                const DPL::String& tizenId,
+                WrtDB::WidgetSecurityModelVersion version);
 bool processMainResource(const DPL::String& inputURI,
                 const DPL::String& tizenId,
                 WrtDB::WidgetSecurityModelVersion m_securityModelVersion);
 bool processURIForPlugin(const char* url);
 DPL::OptionalString localizeURI(const DPL::String& inputURI,
                                 const DPL::String& tizenId);
+std::string localizeURI(const std::string& inputURI, const std::string& tizenId);
 }
 
 #endif // INJECTED_BUNDLE_URI_HANDLING_H_
diff --git a/src/view/webkit/injected-bundle/messages_names.h b/src/view/webkit/injected-bundle/messages_names.h
deleted file mode 100644 (file)
index ab2a755..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2011 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    messages_names.h
- * @author  Lukasz Wrzosek (l.wrzosek@samsung.com)
- * @author  Yunchan Cho (yunchan.cho@samsung.com)
- * @brief   definition of messages for bunlde IPC.
- */
-
-namespace BundleMessages {
-const char * const INIT = "PluginModule::init";
-
-const char * const START = "PluginModule::start";
-const char * const SHUTDOWN = "PluginModule::shutdown";
-const char * const SET_CUSTOM_PROPERTIES =
-    "PluginModule::setCustomProperties";
-const char * const DISPATCH_JAVASCRIPT_EVENT =
-    "PluginModule::dispatchJavaScriptEvent";
-} //namespace BundleMessages
-
index 078a1c1..1928ccd 100644 (file)
 #include <string>
 #include <cstdio>
 #include <sstream>
-#include <sys/stat.h>
 #include <set>
-#include <openssl/sha.h>
-#include <openssl/hmac.h>
-#include <openssl/evp.h>
-#include <openssl/bio.h>
-#include <openssl/buffer.h>
+#include <memory>
 
 #include <dpl/log/log.h>
 #include <dpl/foreach.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <dpl/wrt-dao-ro/common_dao_types.h>
-#include <dpl/utils/mime_type_utils.h>
 #include <dpl/localization/LanguageTagsProvider.h>
 #include <dpl/event/main_event_dispatcher.h>
-#include <FBaseByteBuffer.h>
-#include <security/FSecCrypto_TrustZoneService.h>
 
 #include <wrt_plugin_module.h>
 #include <profiling_util.h>
 
-#include <vconf.h>
 #include <appcore-efl.h>
 
-#include "messages_names.h"
+#include <message_support.h>
 
 #include <scheme.h>
 #include <scheme_action_map_type.h>
 #include <scheme_action_map_data.h>
 
 #include <js_overlay_types.h>
+#include <dispatch_event_support.h>
+#include <plugins-ipc-message/ipc_message_support.h>
 
-#include <sys/time.h>
 #include <sys/resource.h>
 #include <privilege-control.h>
 
 // URI localization on WebProcess side
 #include "injected_bundle_uri_handling.h"
-extern "C" {
-void InitWebAppInfo(const char* appId, const char* rootPath);
-}
+#include "injected_bundle_decryption_support.h"
 
 namespace {
-const char * const uriBlockedMessageName = "uri_blocked_msg";
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-const char * const webProcessPidMessageName = "web_process_pid_msg";
-#endif
 const char * const SCHEME_HTTP = "http";
 const char * const SCHEME_HTTPS = "https";
 const char * const SCHEME_FILE = "file";
 const char * const SCHEME_FILE_SLASH = "file://";
 const char * const SCHEME_BOX_SLASH = "box://";
-const char * const DATA_STRING = "data:";
-const char * const BASE64_STRING = ";base64,";
 const char * const BLANK_PAGE_URL = "about:blank";
 const char * const HTML_MIME = "text/html";
 const char * const PHP_MIME = "application/x-php";
@@ -108,43 +92,6 @@ const char * const PRIVILEGE_APP_TYPE = "wgt";
 #ifdef CORS_WHITELISTING_ENABLED
 const char * const warpAllowProtocolsForWildcard[] = { "http", "https" };
 #endif
-
-static bool m_initWebApp = false;
-
-Tizen::Base::ByteBuffer *DecryptChunkByTrustZone(
-        Tizen::Base::ByteBuffer *appInfo,
-        const unsigned char *inBuffer,
-        int inBufSize)
-{
-    using namespace Tizen::Base;
-
-    if (!m_initWebApp) {
-        char* pAppId = null;
-        pAppId = (char*)calloc(appInfo->GetRemaining()+1, 1);
-        memcpy(pAppId, appInfo->GetPointer(), appInfo->GetRemaining());
-
-        InitWebAppInfo(pAppId, "");
-        free (pAppId);
-        m_initWebApp = true;
-    }
-
-    Tizen::Security::Crypto::_TrustZoneService* pInstance;
-    pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance();
-
-    ByteBuffer pBuf;
-    pBuf.Construct(inBufSize);
-    const byte *pByte = reinterpret_cast<const byte*>(inBuffer);
-
-    if (pBuf.SetArray(pByte, 0, inBufSize) != E_SUCCESS) {
-        LogDebug("Couldnot set pBuf");
-        return NULL;
-    }
-
-    pBuf.Flip();
-
-    return pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf);
-}
-
 }
 
 Bundle::Bundle(WKBundleRef bundle) :
@@ -153,11 +100,11 @@ Bundle::Bundle(WKBundleRef bundle) :
     m_encodedBundle(""),
     m_theme(""),
     m_willRemoveContext(NULL),
-    m_encrypted(false),
     m_widgetType(WrtDB::APP_TYPE_UNKNOWN),
     m_securityModelVersion(
         WrtDB::WidgetSecurityModelVersion::WIDGET_SECURITY_MODEL_V1),
-    m_initialized(false)
+    m_initialized(false),
+    m_decryptionSupport(new InjectedBundle::DecryptionSupport())
 {
     LOG_PROFILE_START("Bundle attachToThread");
     WrtDB::WrtDatabase::attachToThreadRO();
@@ -225,7 +172,7 @@ void Bundle::didCreatePage(WKBundlePageRef page)
         willSendRequestForFrameCallback, /* willSendRequestForFrame */
         0, /* didReceiveResponseForResource */
         0, /* didReceiveContentLengthForResource */
-        didFinishLoadForResourceCallback, /* didFinishLoadForResource */
+        0, /* didFinishLoadForResource */
         0, /* didFailLoadForResource */
         0, /* shouldCacheResponse */
         0, /* shouldUseCredentialStorage */
@@ -371,14 +318,15 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
 {
     LogDebug("got message type: " << toString(messageName).c_str());
     if (WKStringIsEqualToUTF8CString(messageName,
-                                     BundleMessages::START))
+                                     Message::ToInjectedBundle::START))
     {
         if (!messageBody || WKStringGetTypeID() != WKGetTypeID(messageBody)) {
             LogError("Wrong message format received, ignoring");
             return;
         }
 
-        auto msgString = toString(static_cast<WKStringRef>(messageBody));
+        std::string msgString =
+            toString(static_cast<WKStringRef>(messageBody));
         LogDebug("Got message text: " << msgString);
         LogDebug("loading Page : " << m_pagesList.back() <<
                  " loading JSContext : " <<
@@ -396,13 +344,11 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
         ssMsg >> argScale;
         ssMsg >> argEncodedBundle;
         ssMsg >> argTheme;
-        ssMsg >> m_encrypted;
-        LogWarning("m_encrypted : " << m_encrypted);
 
         // ** Language tags setting completed **
         fixWKMessageArgs(argScale, argEncodedBundle, argTheme);
     } else if (WKStringIsEqualToUTF8CString(messageName,
-                                            BundleMessages::SHUTDOWN))
+                                            Message::ToInjectedBundle::SHUTDOWN))
     {
         LogDebug("shutdown plugins");
 
@@ -414,11 +360,12 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
         }
     }
     else if (WKStringIsEqualToUTF8CString(messageName,
-                                          BundleMessages::SET_CUSTOM_PROPERTIES))
+                                          Message::ToInjectedBundle::SET_CUSTOM_PROPERTIES))
     {
         LogDebug("reset custom properties of window objects");
         // set information from ui process
-        auto msgString = toString(static_cast<WKStringRef>(messageBody));
+        std::string msgString =
+            toString(static_cast<WKStringRef>(messageBody));
 
         std::string argScale;
         std::string argEncodedBundle;
@@ -441,54 +388,52 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
         }
     } else if (WKStringIsEqualToUTF8CString(
                    messageName,
-                   BundleMessages::DISPATCH_JAVASCRIPT_EVENT))
+                   Message::ToInjectedBundle::DISPATCH_JS_EVENT))
     {
         LogDebug("dispatch javascript event to created frames");
+        using namespace WrtPlugins::W3C;
+
         // set information from ui process
-        auto text = toString(static_cast<WKStringRef>(messageBody));
+        std::string text = toString(static_cast<WKStringRef>(messageBody));
         int eventType;
-        void *args = NULL;
+        SoftKeyboardChangeArgs softKeyboardArgs;
+
         std::stringstream ss(text);
         ss >> eventType;
 
-        using namespace WrtPlugins::W3C;
-        // set arguments to be sent to js handler of this custom event
-        if (eventType == SoftKeyboardChangeCustomEvent) {
-            args = new SoftKeyboardChangeArgs;
-            ss >> static_cast<SoftKeyboardChangeArgs *>(args)->state;
-            ss >> static_cast<SoftKeyboardChangeArgs *>(args)->width;
-            ss >> static_cast<SoftKeyboardChangeArgs *>(args)->height;
+        if (eventType == SoftKeyboardChangeCustomEvent)
+        {
+            ss >> softKeyboardArgs.state;
+            ss >> softKeyboardArgs.width;
+            ss >> softKeyboardArgs.height;
         }
 
         //apply for each context
         PageGlobalContextContainer::const_iterator it = m_pageGlobalContext.begin();
-        for (; it != m_pageGlobalContext.end(); ++it) {
-            PluginModule::dispatchJavaScriptEvent(
-                it->second,
-                static_cast<WrtPlugins::W3C::CustomEventType>(eventType),
-                args);
-        }
 
-        if (args) {
-            delete static_cast<SoftKeyboardChangeArgs *>(args);
+        for (; it != m_pageGlobalContext.end(); ++it)
+        {
+            if (eventType == SoftKeyboardChangeCustomEvent)
+            {
+                DispatchEventSupport::dispatchSoftKeyboardChangeEvent(it->second,
+                                                    softKeyboardArgs.state,
+                                                    softKeyboardArgs.width,
+                                                    softKeyboardArgs.height);
+            }
         }
     } else if (WKStringIsEqualToUTF8CString(
                    messageName,
-                   BundleMessages::INIT))
+                   Message::ToInjectedBundle::INIT))
     {
-        LogDebug("initializing plugins");
-
-        if (!m_initialized)
-        {
-            auto msgString = toString(static_cast<WKStringRef>(messageBody));
+        LogDebug("initialize");
 
+        if (!m_initialized) {
+            std::string msgString = toString(static_cast<WKStringRef>(messageBody));
             m_widgetTizenId = DPL::FromASCIIString(msgString);
-
             WrtDB::WidgetDAOReadOnly dao(m_widgetTizenId);
 
             // process pool - set app_privilige
-            if (UID_ROOT == getuid())
-            {
+            if (UID_ROOT == getuid()) {
                 using namespace WrtDB::GlobalConfig;
 
                 std::string appPath;
@@ -539,12 +484,19 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
 #ifdef CORS_WHITELISTING_ENABLED
             bypassCORSforWARPAccessList(dao);
 #endif
+            m_decryptionSupport->initialize(m_widgetTizenId);
             m_initialized = true;
-        }
-        else
-        {
+        } else {
             LogDebug("already initalized");
         }
+    } else if (WKStringIsEqualToUTF8CString(
+                   messageName,
+                   Message::ToInjectedBundle::SET_XWINDOW_HANDLE))
+    {
+            std::string msgString =
+                toString(static_cast<WKStringRef>(messageBody));
+            LogDebug("set x window handle [" << msgString << "]");
+            IPCMessageSupport::setXwindowHandle(atoi(msgString.c_str()));
     }
 }
 
@@ -556,9 +508,10 @@ WKURLRequestRef Bundle::willSendRequestForFrameCallback(
     WKURLResponseRef /*response*/,
     const void *clientInfo)
 {
-    LogDebug("willSendRequestForFrameCallback called");
     Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
-    return This->willSendRequestForFrame(request);
+    WKURLRequestRef ret = This->willSendRequestForFrame(request);
+
+    return ret;
 }
 
 void Bundle::didStartProvisionalLoadForFrameCallback(
@@ -785,34 +738,36 @@ WKBundlePagePolicyAction Bundle::decidePolicyForResponseCallback(
 
 WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
 {
-    LogDebug("willSendReq got " << toString(request).c_str());
-    WKURLRef url = WKURLRequestCopyURL(request);
-    WKStringRef urlStr = WKURLCopyString(url);
+    static bool logEnable = (getenv("WRT_WILL_SEND_REQUEST_LOG_ENABLE") != NULL);
 
-    DPL::String dplurl = DPL::FromUTF8String(toString(urlStr));
-    WKRelease(urlStr);
+    WKURLRef    wkUrl   = WKURLRequestCopyURL(request);
+    WKStringRef wkStr   = WKURLCopyString(wkUrl);
 
-    DPL::Optional<DPL::String> localizedUrl =
-        InjectedBundleURIHandling::localizeURI(dplurl, m_widgetTizenId);
-    bool ret =
-        InjectedBundleURIHandling::processURI(*localizedUrl,
-                                             m_widgetTizenId,
-                                             m_securityModelVersion);
+    std::string stdUrl  = Bundle::toString(wkStr);
+    std::string localizedUrl;
 
-    if (!ret) {
-        LogDebug("Not permitted resource: " << *localizedUrl);
+    WKRelease(wkStr);
+    WKRelease(wkUrl);
+
+    if (logEnable){ LogDebug("willSendRequestForFrame : " << stdUrl); }
+
+    localizedUrl = InjectedBundleURIHandling::localizeURI(stdUrl, DPL::ToUTF8String(m_widgetTizenId));
+    bool ret = InjectedBundleURIHandling::processURI(localizedUrl, m_widgetTizenId, m_securityModelVersion);
+
+    if (!ret)
+    {
+        LogDebug("Not permitted resource: " << localizedUrl);
         return NULL;
     }
 
-    LogDebug("URI processing result: " << *localizedUrl);
-    std::string tmpUrlStr = DPL::ToUTF8String(*localizedUrl);
-    WKURLRef tmpUrl = WKURLCreateWithUTF8CString(tmpUrlStr.c_str());
-    std::string scheme = toString(WKURLCopyScheme(url)); //scheme of original request
-    WKRelease(url);
+    // log disabled for performance
+    //LogDebug("URI processing result: " << result);
+    std::string scheme = localizedUrl.substr(0, localizedUrl.find_first_of(':'));
 
 #ifdef APP_SCHEME_ENABLED
-    if(scheme == SCHEME_FILE) {
-        LogError("File schema blocked for: " << dplurl);
+    if (scheme == SCHEME_FILE)
+    {
+        LogError("File schema blocked for: " << stdUrl);
         return NULL;
     }
 #endif
@@ -825,48 +780,41 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
 
     // external scheme also need to send message to UI process for
     // checking roaming and security
-    if (scheme == SCHEME_HTTP || scheme == SCHEME_HTTPS) {
-        LogDebug("external scheme return original WKURLRequestRef");
-        WKRelease(tmpUrl);
+
+    if (scheme == SCHEME_HTTP || scheme == SCHEME_HTTPS)
+    {
+        if (logEnable){ LogDebug("external scheme return original WKURLRequestRef"); }
         WKRetain(request);
         return request;
-    } else {
-        std::string checkUrl = toString(tmpUrl);
-
-        if (m_encrypted) {
-            int getFileSize;
-            if (isEncryptedResource(checkUrl, getFileSize)) {
-                std::string decryptString = DecryptResource(checkUrl,
-                                                            getFileSize);
-                if (!decryptString.empty()) {
-                    std::string destString = DATA_STRING;
-
-                    std::string mimeString =
-                        DPL::ToUTF8String(
-                            MimeTypeUtils::identifyFileMimeType(
-                                DPL::FromUTF8String(checkUrl)));
-
-                    destString += mimeString;
-                    destString += BASE64_STRING;
-
-                    decryptString.insert(0, destString);
-
-                    WKURLRef destUrl =
-                        WKURLCreateWithUTF8CString(decryptString.c_str());
-
-                    WKURLRequestRef req = WKURLRequestCreateWithWKURL(
-                            destUrl);
-                    WKRelease(destUrl);
-                    LogDebug("return value " << decryptString << "]]");
-                    return req;
-                }
-            }
+    }
+    else
+    {
+        std::string checkUrl = localizedUrl;
+
+        if (m_decryptionSupport->isNeedDecryption(checkUrl))
+        {
+            std::string decryptString =
+                m_decryptionSupport->decryptResource(checkUrl);
+
+            if (logEnable){ LogDebug("return value : " << decryptString ); }
+
+            WKURLRef destUrl =
+                WKURLCreateWithUTF8CString(decryptString.c_str());
+            WKURLRequestRef req = WKURLRequestCreateWithWKURL(destUrl);
+            WKRelease(destUrl);
+            
+            return req;
         }
-        WKURLRequestRef req = WKURLRequestCreateWithWKURL(tmpUrl);
-        WKRelease(tmpUrl);
-        LogDebug("return value " << toString(req).c_str());
-        return req;
     }
+    
+    WKURLRef newUrl = WKURLCreateWithUTF8CString(localizedUrl.c_str());
+    WKURLRequestRef req = WKURLRequestCreateWithWKURL(newUrl);
+    WKRelease(newUrl);
+
+    if (logEnable){ LogDebug("return value : " << localizedUrl); }
+
+    return req;
 }
 
 WKBundlePagePolicyAction Bundle::decidePolicyForAction(
@@ -908,7 +856,8 @@ WKBundlePagePolicyAction Bundle::decidePolicyForAction(
         // Send information about blocked URI to UIProcess
         WKStringRef urlStr = WKStringCreateWithUTF8CString(blockedUrl.c_str());
         WKTypeRef retVal = NULL;
-        WKStringRef blockMessage = WKStringCreateWithUTF8CString(uriBlockedMessageName);
+        WKStringRef blockMessage =
+            WKStringCreateWithUTF8CString(Message::ToUIProcess::BLOCKED_URL);
         WKBundlePostSynchronousMessage(m_bundle, blockMessage, urlStr, &retVal);
         WKRelease(urlStr);
         WKRelease(retVal);
@@ -964,13 +913,19 @@ WKBundlePagePolicyAction Bundle::decidePolicyForAction(
 
 std::string Bundle::toString(WKStringRef str)
 {
-    if (WKStringIsEmpty(str)) {
-        return std::string();
+    if (WKStringIsEmpty(str))
+    {
+        return "";
+    }
+    else
+    {
+        size_t size = WKStringGetMaximumUTF8CStringSize(str);
+
+        char buffer[size + 1];
+        WKStringGetUTF8CString(str, buffer, sizeof(buffer));
+
+        return buffer;
     }
-    size_t size = WKStringGetMaximumUTF8CStringSize(str);
-    char buffer[size + 1];
-    WKStringGetUTF8CString(str, buffer, size + 1);
-    return buffer;
 }
 
 std::string Bundle::toString(WKURLRef url)
@@ -1011,117 +966,6 @@ std::string Bundle::getScheme(std::string uri)
     return str;
 }
 
-bool Bundle::isEncryptedResource(std::string Url, int &size)
-{
-    if (m_encryptedFiles.empty()) {
-        WrtDB::WidgetDAOReadOnly(m_widgetTizenId).
-            getEncryptedFileList(m_encryptedFiles);
-    }
-
-    std::set<WrtDB::EncryptedFileInfo>::iterator it;
-    WrtDB::EncryptedFileInfo info;
-    std::string filePath;
-
-    if (0 != strncmp(Url.c_str(), SCHEME_FILE_SLASH, strlen(SCHEME_FILE_SLASH))) {
-        return false;
-    }
-
-    filePath = Url.substr(strlen(SCHEME_FILE_SLASH));
-    info.fileName = DPL::FromUTF8String(filePath);
-
-    if (m_encryptedFiles.end() != (it = m_encryptedFiles.find(info)))
-    {
-        LogDebug(" info file name : " << it->fileName);
-        LogDebug(" info file size : " << it->fileSize);
-        size = it->fileSize;
-        return true;
-    }
-    return false;
-}
-
-std::string Bundle::DecryptResource(std::string resource, int size)
-{
-    std::string filePath;
-
-    size_t pos = resource.find_first_not_of(SCHEME_FILE_SLASH);
-    if (std::string::npos != pos) {
-        filePath = resource.substr(pos - 1);
-    }
-
-    struct stat buf;
-    if (0 == stat(filePath.c_str(), &buf)) {
-        const std::size_t fileSize = buf.st_size;
-        std::unique_ptr<unsigned char[]> inChunk;
-
-        FILE* fp = fopen(filePath.c_str(), "rb");
-        if (NULL == fp) {
-            LogDebug("Couldnot open file : " << filePath);
-            return std::string();
-        }
-
-        std::unique_ptr<unsigned char[]> DecryptedString(new unsigned
-                char[fileSize]);
-        std::string pkgid(DPL::ToUTF8String(m_widgetTizenId));
-
-        using namespace Tizen::Base;
-        const byte *b_pkgid = reinterpret_cast<const byte*>(pkgid.c_str());
-        ByteBuffer appInfo;
-        appInfo.Construct(pkgid.length());
-        if (appInfo.SetArray(b_pkgid, 0, pkgid.length()) != E_SUCCESS) {
-            LogDebug("Couldnot set appInfo");
-            fclose(fp);
-            return std::string();
-        }
-        appInfo.Flip();
-
-        int writeCount = 0;
-        do {
-            unsigned char getDecSize[4];
-            memset(getDecSize, 0x00, sizeof(getDecSize));
-
-            size_t readSize = fread(getDecSize, sizeof(unsigned char),
-                    sizeof(getDecSize), fp);
-            if (0 != readSize) {
-                int readBufSize = 0;
-                std::istringstream(std::string((char*)getDecSize)) >> readBufSize;
-                inChunk.reset(new unsigned char[readBufSize]);
-
-                size_t decReadSize = fread(inChunk.get(), sizeof(unsigned char),
-                        readBufSize, fp);
-                if (0 != decReadSize) {
-                    ByteBuffer *getBuffer =
-                        DecryptChunkByTrustZone(&appInfo, inChunk.get(),
-                                decReadSize);
-                    memcpy(DecryptedString.get() + writeCount,
-                            getBuffer->GetPointer(), getBuffer->GetRemaining());
-                    writeCount += getBuffer->GetRemaining();
-                    getBuffer->Reset();
-                }
-            }
-
-        } while( 0 == std::feof(fp));
-        fclose(fp);
-
-        memset(DecryptedString.get() + size, '\n', fileSize - size);
-        LogDebug("resource need to encoding base64");
-        BIO *bmem, *b64;
-        BUF_MEM *bptr;
-
-        b64 = BIO_new(BIO_f_base64());
-        bmem = BIO_new(BIO_s_mem());
-        b64 = BIO_push(b64, bmem);
-        BIO_write(b64, DecryptedString.get(), fileSize);
-        BIO_flush(b64);
-        BIO_get_mem_ptr(b64, &bptr);
-
-        std::string base64Enc((char *)bptr->data, bptr->length - 1);
-        BIO_free_all(b64);
-
-        return base64Enc;
-    }
-    return std::string();
-}
-
 #ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
 void Bundle::sendWebProcessPid()
 {
@@ -1129,7 +973,9 @@ void Bundle::sendWebProcessPid()
     strPid << getpid();
     WKStringRef pidStr = WKStringCreateWithUTF8CString(strPid.str().c_str());
     WKTypeRef retVal = NULL;
-    WKStringRef message = WKStringCreateWithUTF8CString(webProcessPidMessageName);
+    WKStringRef message =
+        WKStringCreateWithUTF8CString(
+            Message::ToUIProcess::SEND_WEBPROCESS_PID);
     WKBundlePostSynchronousMessage(m_bundle, message, pidStr, &retVal);
     WKRelease(pidStr);
     WKRelease(retVal);
@@ -1166,5 +1012,6 @@ void WKBundleInitialize(WKBundleRef bundle,
     {
         setpriority(PRIO_PROCESS, 0, DEFAULT_PRIORITY);
     }
+    IPCMessageSupport::setWKBundleRef(bundle);
 }
 }
index aedf3f1..223815c 100644 (file)
@@ -22,6 +22,7 @@
 #define WRT_SRC_VIEW_WEBKIT_WRT_INJECTED_BUNDLE_H_
 
 #include <map>
+#include <memory>
 #include <set>
 #include <list>
 #include <string>
@@ -37,6 +38,10 @@ extern "C" {
 WK_EXPORT void WKBundleInitialize(WKBundleRef bundle, WKTypeRef);
 }
 
+namespace InjectedBundle {
+class DecryptionSupport;
+}
+
 class Bundle
 {
   public:
@@ -76,12 +81,12 @@ class Bundle
     std::string m_theme;
     std::set<JSGlobalContextRef> m_loadedContext;
     JSGlobalContextRef m_willRemoveContext;
-    bool m_encrypted;
-    WrtDB::EncryptedFileList m_encryptedFiles;
     WrtDB::WidgetType m_widgetType;
     WrtDB::WidgetSecurityModelVersion m_securityModelVersion;
     bool m_initialized;
 
+    std::unique_ptr<InjectedBundle::DecryptionSupport> m_decryptionSupport;
+
     // WKBundlePageResourceLoadClient callback
     static WKURLRequestRef willSendRequestForFrameCallback(
         WKBundlePageRef,
@@ -163,10 +168,10 @@ class Bundle
         WKTypeRef* userData);
 
     // basic
-    static std::string toString(WKStringRef str);
-    static std::string toString(WKURLRef url);
-    static std::string toString(WKURLRequestRef req);
-    static std::string toString(WKErrorRef err);
+    inline static std::string toString(WKStringRef str);
+    inline static std::string toString(WKURLRef url);
+    inline static std::string toString(WKURLRequestRef req);
+    inline static std::string toString(WKErrorRef err);
     static std::string getScheme(std::string uri);
 
     bool isEncryptedResource(std::string Url, int &size);
index cb7fd3b..4ae229d 100644 (file)
 #include <widget_model.h>
 #include <system_settings.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/utils/wrt_global_settings.h>
 
 #include <common/application_data.h>
 #include <common/application_launcher.h>
+#include <common/message_support.h>
 #include <common/scheme.h>
 
 #include <common/view_logic_apps_support.h>
 #include <common/view_logic_certificate_support.h>
 #include <common/view_logic_storage_support.h>
 #include <common/view_logic_uri_support.h>
-#include <common/view_logic_user_agent_support.h>
 #include <common/view_logic_vibration_support.h>
 #include <view_logic_authentication_challenge_support.h>
 #include <view_logic_certificate_confirm_support.h>
 #include <view_logic_geolocation_support.h>
+#include <view_logic_message_support.h>
+#include <view_logic_orientation_support.h>
 #include <view_logic_scheme_support.h>
 #include <view_logic_usermedia_support.h>
 #include <view_logic_web_notification_support.h>
 #include <view_logic_web_storage_support.h>
-#include "injected-bundle/plugin_module_support.h"
 
 #include <EWebKit2.h>
 #include <dpl/localization/w3c_file_localization.h>
@@ -80,11 +80,6 @@ extern "C" int appsvc_request_transient_app(bundle *b, Ecore_X_Window callee_id,
 #endif
 
 namespace {
-const char * const uriBlockedMessageName = "uri_blocked_msg";
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-const char * const webProcessPidMessageName = "web_process_pid_msg";
-#endif
-
 // IME State value
 const char * const IME_STATE_ON = "on";
 const char * const IME_STATE_OFF = "off";
@@ -110,6 +105,7 @@ std::map<const std::string,
     { "load,started", &ViewLogic::loadStartedCallback },
     { "load,finished", &ViewLogic::loadFinishedCallback },
     { "title,changed", &ViewLogic::titleChangedCallback },
+    { "load,progress,started", &ViewLogic::loadProgressStartedCallback },
     { "load,progress", &ViewLogic::loadProgressCallback },
     { "load,progress,finished", &ViewLogic::loadProgressFinishedCallback },
     { "process,crashed", &ViewLogic::processCrashedCallback },
@@ -167,7 +163,13 @@ std::map<const std::string,
     { "authentication,challenge",
       &ViewLogic::authenticationChallengeRequestCallback },
     { "frame,rendered",
-      &ViewLogic::viewFrameRenderedCallback }
+      &ViewLogic::viewFrameRenderedCallback },
+    { "mediacontrol,rotate,horizontal",
+      &ViewLogic::mediacontrolRotateHorizontal },
+    { "mediacontrol,rotate,vertical",
+      &ViewLogic::mediacontrolRotateVertical },
+    { "mediacontrol,rotate,exit",
+      &ViewLogic::mediacontrolRotateExit }
 };
 
 ViewLogic::ViewLogic() :
@@ -182,6 +184,7 @@ ViewLogic::ViewLogic() :
     m_imeHeight(0),
     m_isBackgroundReload(false),
     m_isBackgroundSupport(false),
+    m_rotateAngle(0),
     m_appsSupport(new ViewModule::AppsSupport()),
     m_vibrationSupport(new ViewModule::VibrationSupport())
 {
@@ -213,7 +216,13 @@ bool ViewLogic::createWebView(Ewk_Context* context,
     m_window = window;
 
     Evas* canvas = evas_object_evas_get(m_window);
-    return createEwkView(canvas);
+
+    if (!createEwkView(canvas)) {
+        return false;
+    }
+
+    elm_access_object_register(m_currentEwkView, window);
+    return true;
 }
 
 #ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
@@ -271,6 +280,7 @@ void ViewLogic::prepareView(WidgetModel* m, const std::string &startUrl)
     prepareEwkView(m_currentEwkView);
     ADD_PROFILING_POINT("prepareEwkView", "stop");
     initializePluginLoading();
+    initializeXwindowHandle();
 }
 
 void ViewLogic::showWidget()
@@ -451,7 +461,7 @@ Evas_Object* ViewLogic::getCurrentWebview()
 
 void ViewLogic::fireJavascriptEvent(int event, void* data)
 {
-    PluginModuleSupport::dispatchJavaScriptEvent(
+    ViewLogicMessageSupport::dispatchJavaScriptEvent(
         m_ewkContext,
         static_cast<WrtPlugins::W3C::CustomEventType>(event),
         data);
@@ -469,11 +479,10 @@ void ViewLogic::checkSyncMessageFromBundle(
 {
     LogDebug("didReceiveSynchronousMessage called");
     Assert(name);
-    Assert(returnData);
 
     LogDebug("received : " << name);
-    std::string result;
-    if (!strcmp(name, uriBlockedMessageName)) {
+
+    if (!strcmp(name, Message::ToUIProcess::BLOCKED_URL)) {
         // Currently WebProcess informs obly about blocked
         // URI - URI localization and security chekcs are
         // done by WebProcess itself (see: wrt-injected-bundle.cpp
@@ -481,7 +490,7 @@ void ViewLogic::checkSyncMessageFromBundle(
         requestUrlBlocked(std::string(body));
     }
 #ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-    else if (!strcmp(name, webProcessPidMessageName)) {
+    else if (!strcmp(name, Message::ToUIProcess::SEND_WEBPROCESS_PID)) {
         std::stringstream ss(body);
         unsigned int pid = 0;
         ss >> pid;
@@ -490,8 +499,21 @@ void ViewLogic::checkSyncMessageFromBundle(
             pid);
     }
 #endif
-
-    *returnData = strdup(result.c_str());
+    else if (!strcmp(name, Message::TizenScheme::GET_WINDOW_HANDLE)) {
+        if (m_window) {
+            Ecore_X_Window handle = elm_win_xwindow_get(m_window);
+            if (handle != 0) {
+                std::stringstream ss;
+                ss << handle;
+                std::string ret  = ss.str();
+                if (returnData) {
+                    *returnData = strdup(ret.c_str());
+                }
+            } else {
+                LogInfo("X window isn't exist");
+            }
+        }
+    }
 }
 
 void ViewLogic::downloadData(const char* url)
@@ -530,7 +552,7 @@ void ViewLogic::initializeSupport()
 
     m_schemeSupport.reset(new SchemeSupport(m_model->Type.Get().appType));
     ViewModule::StorageSupport::initializeStorage(m_model);
-    m_appsSupport->initialize(m_model);
+    m_appsSupport->initialize(m_model, elm_win_xwindow_get(m_window));
     m_securityOriginSupport.reset(new ViewModule::SecurityOriginSupport(m_model));
     m_certificateSupport.reset(new ViewModule::CertificateSupport(m_model));
     m_vibrationSupport->initialize();
@@ -539,13 +561,22 @@ void ViewLogic::initializeSupport()
 void ViewLogic::initializePluginLoading()
 {
     // inform wrt information for plugin loading to web process
-    PluginModuleSupport::start(
+    ViewLogicMessageSupport::start(
         m_ewkContext,
         m_model->TizenId,
         elm_config_scale_get(),
         ApplicationDataSingleton::Instance().getEncodedBundle(),
-        m_theme.c_str(),
-        m_model->SettingList.Get().isEncrypted());
+        m_theme.c_str());
+}
+
+void ViewLogic::initializeXwindowHandle()
+{
+    if (m_window) {
+        unsigned int handle = elm_win_xwindow_get(m_window);
+        ViewLogicMessageSupport::setXwindowHandle(
+            m_ewkContext,
+            handle);
+    }
 }
 
 void ViewLogic::ewkClientInit(Evas_Object *wkView)
@@ -642,20 +673,10 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView)
     // set user agent
     std::string customUserAgent = m_model->SettingList.Get().getUserAgent();
     if (customUserAgent.empty()) {
-        auto userAgentString =
-            ViewModule::UserAgentSupport::getUserAgentFromVconf();
-        if (!userAgentString.empty()) {
-            LogDebug("Setting user agent as: " << userAgentString);
-            ewk_view_user_agent_set(wkView, userAgentString.c_str());
-        }
-        else
-        {
-            ewk_view_user_agent_set(wkView, NULL);
-            LogDebug("Setting user agent as: default");
-
-            std::string defaultUA = ewk_view_user_agent_get(wkView);
-            LogDebug("webkit's UA: " << defaultUA);
-        }
+        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());
@@ -823,7 +844,6 @@ void ViewLogic::loadStartedCallback(
     LogDebug("loadStartedCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
-    evas_object_focus_set(This->m_currentEwkView, EINA_TRUE);
 
     // call loadFinish callback to wrt-client
     if (!This->m_cbs->loadStart.empty()) {
@@ -839,6 +859,7 @@ void ViewLogic::loadFinishedCallback(
     LogDebug("loadFinishedCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
+    evas_object_focus_set(This->m_currentEwkView, EINA_TRUE);
 
     // Fill id/password
     const char* url = ewk_view_url_get(This->m_currentEwkView);
@@ -854,16 +875,10 @@ void ViewLogic::loadFinishedCallback(
 
     // set only encoded bundle
     double scale = elm_config_scale_get();
-    PluginModuleSupport::setCustomProperties(
+    ViewLogicMessageSupport::setCustomProperties(
         This->m_ewkContext,
         &scale,
         ApplicationDataSingleton::Instance().getEncodedBundle());
-    // check if 'appsevice' event is registed at the current frames.
-    // If so, dispatch the event to frames.
-    PluginModuleSupport::dispatchJavaScriptEvent(
-        This->m_ewkContext,
-        WrtPlugins::W3C::ServiceCustomEvent,
-        NULL);
 
     // In this case, widget is reloaded in the background.
     // After finished load, bundle should disconnent callback.
@@ -906,6 +921,20 @@ void ViewLogic::titleChangedCallback(
     }
 }
 
+void ViewLogic::loadProgressStartedCallback(
+    void* data,
+    Evas_Object* /*obj*/,
+    void* /*eventInfo*/)
+{
+    LogDebug("loadProgressStartedCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    if (!This->m_cbs->progressStarted.empty()) {
+        This->m_cbs->progressStarted();
+    }
+}
+
+
 void ViewLogic::loadProgressCallback(
     void* data,
     Evas_Object* obj,
@@ -1248,15 +1277,12 @@ void ViewLogic::geolocationPermissionRequestCallback(
     Ewk_Geolocation_Permission_Request* permissionRequest =
         static_cast<Ewk_Geolocation_Permission_Request*>(eventInfo);
 
-    if (This->m_securityOriginSupport->isNeedPermissionCheck(
-            WrtDB::FEATURE_GEOLOCATION)
-        == WrtDB::SETTINGS_TYPE_OFF)
-    {
+    if (This->m_model->GeolocationUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
         ewk_geolocation_permission_request_set(permissionRequest, EINA_FALSE);
         return;
     }
     ViewModule::GeolocationSupport::geolocationPermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         eventInfo);
 }
@@ -1319,10 +1345,7 @@ void ViewLogic::notificationPermissionRequestCallback(
     LogDebug("notificationPermissionRequestCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
-    if (This->m_securityOriginSupport->isNeedPermissionCheck(
-            WrtDB::FEATURE_WEB_NOTIFICATION)
-        == WrtDB::SETTINGS_TYPE_OFF)
-    {
+    if (This->m_model->WebNotificationUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
         Ewk_Notification_Permission_Request* request =
             static_cast<Ewk_Notification_Permission_Request*>(eventInfo);
         ewk_notification_permission_request_set(
@@ -1333,7 +1356,7 @@ void ViewLogic::notificationPermissionRequestCallback(
 
     Assert(eventInfo);
     ViewModule::WebNotification::webNotificationPermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         eventInfo);
     return;
@@ -1342,47 +1365,31 @@ void ViewLogic::notificationPermissionRequestCallback(
 // EWK Orientation Callback
 Eina_Bool ViewLogic::orientationLockCallback(
     Evas_Object* obj,
-    Eina_Bool /*needLock*/,
+    Eina_Bool needLock,
     int orientation,
     void* data)
 {
     LogDebug("orientationLockCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
+    This->m_rotateAngle = orientation;
 
-    if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) {
-        LogDebug("orientation is portrait-primary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            This->m_window,
-            OrientationAngle::Window::Portrait::PRIMARY);
-        ewk_view_orientation_send(obj, OrientationAngle::W3C::Portrait::PRIMARY);
-    } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
-        LogDebug("orientation is landscape-primary");
-        elm_win_wm_rotation_preferred_rotation_set(
+    if (needLock == EINA_TRUE) {
+        // Screen.lockOrientation
+        ViewModule::OrientationSupport::setOrientation(
             This->m_window,
-            OrientationAngle::Window::Landscape::PRIMARY);
-        ewk_view_orientation_send(
             obj,
-             OrientationAngle::W3C::Landscape::PRIMARY);
-    } else if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
-        LogDebug("orientation is portrait-secondary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            This->m_window,
-            OrientationAngle::Window::Portrait::SECONDARY);
-        ewk_view_orientation_send(
-            obj,
-            OrientationAngle::W3C::Portrait::SECONDARY);
-    } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
-        LogDebug("orientation is landscape-secondary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            This->m_window,
-            OrientationAngle::Window::Landscape::SECONDARY);
-        ewk_view_orientation_send(
-            obj,
-            OrientationAngle::W3C::Landscape::SECONDARY);
+            orientation);
     } else {
-        LogDebug("Wrong orientation is set");
-        return EINA_FALSE;
+        // Screen.unlockOrientation
+        if (This->m_model->SettingList.Get().getRotationValue() ==
+            Screen_AutoRotation)
+        {
+            elm_win_wm_rotation_preferred_rotation_set(
+                This->m_window,
+                OrientationAngle::Window::UNLOCK);
+            This->m_rotateAngle = 0;
+        }
     }
     return EINA_TRUE;
 }
@@ -1444,6 +1451,10 @@ void ViewLogic::imeOpenedCallback(
     This->fireJavascriptEvent(
         static_cast<int>(SoftKeyboardChangeCustomEvent),
         &args);
+
+    if (!This->m_cbs->editorClientIme.empty()) {
+        This->m_cbs->editorClientIme(true);
+    }
 }
 
 void ViewLogic::imeClosedCallback(
@@ -1458,10 +1469,12 @@ void ViewLogic::imeClosedCallback(
     using namespace WrtPlugins::W3C;
     SoftKeyboardChangeArgs args;
     args.state = IME_STATE_OFF;
-
     This->fireJavascriptEvent(
         static_cast<int>(SoftKeyboardChangeCustomEvent),
         &args);
+    if (!This->m_cbs->editorClientIme.empty()) {
+        This->m_cbs->editorClientIme(false);
+    }
 }
 
 void ViewLogic::usermediaPermissionRequestCallback(
@@ -1473,7 +1486,7 @@ void ViewLogic::usermediaPermissionRequestCallback(
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
     ViewModule::UsermediaSupport::usermediaPermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         eventInfo);
 }
@@ -1913,16 +1926,13 @@ Eina_Bool ViewLogic::exceededDatabaseQuotaCallback(Evas_Object* obj,
     ViewLogic* This = static_cast<ViewLogic*>(data);
     Assert(obj);
 
-    if (This->m_securityOriginSupport->isNeedPermissionCheck(
-        WrtDB::FEATURE_WEB_DATABASE) ==
-            WrtDB::SETTINGS_TYPE_OFF)
-    {
+    if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
         ewk_view_exceeded_database_quota_reply(obj, EINA_FALSE);
         return EINA_TRUE;
     }
 
     ViewModule::WebStorageSupport::createPermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         obj,
         origin,
@@ -1941,16 +1951,13 @@ Eina_Bool ViewLogic::exceededIndexedDatabaseQuotaCallback(Evas_Object* obj,
     ViewLogic* This = static_cast<ViewLogic*>(data);
     Assert(obj);
 
-    if (This->m_securityOriginSupport->isNeedPermissionCheck(
-        WrtDB::FEATURE_WEB_DATABASE) ==
-            WrtDB::SETTINGS_TYPE_OFF)
-    {
-        ewk_view_exceeded_database_quota_reply(obj, EINA_FALSE);
+    if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+        ewk_view_exceeded_indexed_database_quota_reply(obj, EINA_FALSE);
         return EINA_TRUE;
     }
 
     ViewModule::WebStorageSupport::createPermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         obj,
         origin,
@@ -1969,16 +1976,14 @@ Eina_Bool ViewLogic::exceededLocalFileSystemQuotaCallback(Evas_Object* obj,
     ViewLogic* This = static_cast<ViewLogic*>(data);
     Assert(obj);
 
-    if (This->m_securityOriginSupport->isNeedPermissionCheck(
-        WrtDB::FEATURE_WEB_DATABASE) ==
-            WrtDB::SETTINGS_TYPE_OFF)
-    {
-        ewk_view_exceeded_database_quota_reply(obj, EINA_FALSE);
+
+    if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+        ewk_view_exceeded_local_file_system_quota_reply(obj, EINA_FALSE);
         return EINA_TRUE;
     }
 
     ViewModule::WebStorageSupport::createPermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         obj,
         origin,
@@ -1998,7 +2003,7 @@ void ViewLogic::certificateConfirmRequestCallback(
     ViewLogic* This = static_cast<ViewLogic*>(data);
     Assert(eventInfo);
     ViewModule::CertificateConfirmSupport::certificatePermissionRequest(
-        This->m_window,
+        This->m_currentEwkView,
         This->m_certificateSupport->getCertificateDAO(),
         eventInfo);
 }
@@ -2033,22 +2038,86 @@ void ViewLogic::viewFrameRenderedCallback(
     LogInfo("enter");
 }
 
+void ViewLogic::mediacontrolRotateHorizontal(void* data,
+                                             Evas_Object* obj,
+                                             void* /*eventInfo*/)
+{
+    LogInfo("mediacontrolRotateHorizontal called");
+    Assert(data);
+    Assert(obj);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    ViewModule::OrientationSupport::setOrientation(
+        This->m_window,
+        obj,
+        ViewModule::OrientationSupport::Mode::LANDSCAPE_PRIMARY);
+}
+
+void ViewLogic::mediacontrolRotateVertical(void* data,
+                                           Evas_Object* obj,
+                                           void* /*eventInfo*/)
+{
+    LogInfo("mediacontrolRotateVertical called");
+    Assert(data);
+    Assert(obj);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    ViewModule::OrientationSupport::setOrientation(
+        This->m_window,
+        obj,
+        ViewModule::OrientationSupport::Mode::PORTRAIT_PRIMARY);
+}
+
+void ViewLogic::mediacontrolRotateExit(void* data,
+                                       Evas_Object* obj,
+                                       void* /*eventInfo*/)
+{
+    LogInfo("mediacontrolRotateExit called");
+    Assert(data);
+    Assert(obj);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    if (This->m_rotateAngle == 0) {
+        // application hasn't call orientation lock
+        WidgetSettingScreenLock screenLock =
+            This->m_model->SettingList.Get().getRotationValue();
+        if (screenLock == Screen_Portrait) {
+            ViewModule::OrientationSupport::setOrientation(
+                This->m_window,
+                obj,
+                ViewModule::OrientationSupport::Mode::PORTRAIT_PRIMARY);
+        } else if (screenLock == Screen_Landscape) {
+            ViewModule::OrientationSupport::setOrientation(
+                This->m_window,
+                obj,
+                ViewModule::OrientationSupport::Mode::LANDSCAPE_PRIMARY);
+        } else if (screenLock == Screen_AutoRotation) {
+            elm_win_wm_rotation_preferred_rotation_set(
+                This->m_window,
+                OrientationAngle::Window::UNLOCK);
+        }
+    } else {
+        // Restore previous orientation
+        ViewModule::OrientationSupport::setOrientation(
+            This->m_window,
+            obj,
+            This->m_rotateAngle);
+    }
+}
+
 void ViewLogic::requestUrlBlocked(const std::string& blockedUrl)
 {
     LogInfo("enter");
 
     // block this page and open it in browser
     LogDebug("Request was blocked : " << blockedUrl);
-    bundle* bundleData = bundle_create();
-    appsvc_set_operation(bundleData, APPSVC_OPERATION_VIEW);
-    appsvc_set_uri(bundleData, blockedUrl.c_str());
+    service_h serviceHandle = NULL;
+    service_create(&serviceHandle);
+    service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+    service_set_uri(serviceHandle, blockedUrl.c_str());
     CONTROLLER_POST_EVENT(
         ApplicationLauncher,
         ApplicationLauncherEvents::LaunchApplicationByAppService(
-            bundleData,
+            serviceHandle,
             NULL,
             NULL));
-
     // set block url. This is used on load finished callback
     m_blockedUri = blockedUrl;
 }
index 2b88867..f5114dd 100644 (file)
@@ -75,6 +75,7 @@ class ViewLogic : public ViewModule::IViewModule
   private:
     void initializeSupport();
     void initializePluginLoading();
+    void initializeXwindowHandle();
 
     // EwkView operations
     void ewkClientInit(Evas_Object *wkView);
@@ -102,6 +103,10 @@ class ViewLogic : public ViewModule::IViewModule
         void* data,
         Evas_Object* obj,
         void* eventInfo);
+    static void loadProgressStartedCallback(
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void loadProgressCallback(
         void* data,
         Evas_Object* obj,
@@ -249,6 +254,16 @@ class ViewLogic : public ViewModule::IViewModule
         Evas_Object* obj,
         void* eventInfo);
 
+    static void mediacontrolRotateHorizontal(void* data,
+                                             Evas_Object* obj,
+                                             void* eventInfo);
+    static void mediacontrolRotateVertical(void* data,
+                                           Evas_Object* obj,
+                                           void* eventInfo);
+    static void mediacontrolRotateExit(void* data,
+                                       Evas_Object* obj,
+                                       void* eventInfo);
+
 #ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
     static int appServiceCallerIsKilled(void *data);
 #endif
@@ -290,6 +305,7 @@ class ViewLogic : public ViewModule::IViewModule
     size_t m_imeHeight;
     bool m_isBackgroundReload;
     bool m_isBackgroundSupport;
+    int m_rotateAngle;
 
     std::unique_ptr<SchemeSupport> m_schemeSupport;
     std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
  *    limitations under the License.
  */
 /**
- * @file    plugin_module_support.cpp
+ * @file    view_logic_message_support.cpp
  * @author  Lukasz Wrzosek (l.wrzosek@samsung.com)
  * @author  Yunchan Cho (yunchan.cho@samsung.com)
- * @brief   Plugin module support for Webkit2 - implementation.
+ * @brief   View logic message support - implementation
  */
-#include "plugin_module_support.h"
-#include "messages_names.h"
+#include "view_logic_message_support.h"
 
 #include <sstream>
 #include <EWebKit2.h>
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <common/message_support.h>
 #include <js_overlay_types.h>
 
-namespace PluginModuleSupport {
+namespace ViewLogicMessageSupport {
 void init(Ewk_Context* ewkContext, const std::string& tizenId)
 {
-    const char* name = BundleMessages::INIT;
+    const char* name = Message::ToInjectedBundle::INIT;
     const char* msg = tizenId.c_str();
 
     ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
@@ -40,8 +39,7 @@ void start(Ewk_Context* ewkContext,
            const DPL::String& tizenId,
            double scale,
            const char *encodedBundle,
-           const char *theme,
-           bool encrypted)
+           const char *theme)
 {
     std::stringstream ssMsg;
 
@@ -57,24 +55,22 @@ void start(Ewk_Context* ewkContext,
     }
 
     if (theme) {
-        ssMsg << "_" << theme << " ";
+        ssMsg << "_" << theme;
     } else {
-        ssMsg << "null" << " ";
+        ssMsg << "null";
     }
 
-    ssMsg << encrypted;
-
     std::string msgString = ssMsg.str();
 
     const char* msg = msgString.c_str();
-    const char* name = BundleMessages::START;
+    const char* name = Message::ToInjectedBundle::START;
 
     ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
 }
 
 void shutdown(Ewk_Context* ewkContext)
 {
-    const char* name = BundleMessages::SHUTDOWN;
+    const char* name = Message::ToInjectedBundle::SHUTDOWN;
     ewk_context_message_post_to_injected_bundle(ewkContext, name, name);
 }
 
@@ -107,7 +103,7 @@ void setCustomProperties(
     std::string msgString = ssMsg.str();
 
     const char* msg = msgString.c_str();
-    const char* name = BundleMessages::SET_CUSTOM_PROPERTIES;
+    const char* name = Message::ToInjectedBundle::SET_CUSTOM_PROPERTIES;
 
     ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
 }
@@ -134,9 +130,19 @@ void dispatchJavaScriptEvent(
 
     std::string msgString = str.str();
     const char* msg = msgString.c_str();
-    const char* name = BundleMessages::DISPATCH_JAVASCRIPT_EVENT;
+    const char* name = Message::ToInjectedBundle::DISPATCH_JS_EVENT;
 
     ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
 }
 
-} //namespace PluginModuleSupport
+void setXwindowHandle(Ewk_Context* ewkContext, const unsigned int handle)
+{
+    const char* name = Message::ToInjectedBundle::SET_XWINDOW_HANDLE;
+    std::stringstream ssMsg;
+    ssMsg << handle;
+    std::string msgString = ssMsg.str();
+    const char* msg = msgString.c_str();
+
+    ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
+}
+} // namespace ViewLogicMessageSupport
\ No newline at end of file
  *    limitations under the License.
  */
 /**
- * @file    plugin_module_support.h
+ * @file    view_logic_message_support.h
  * @author  Lukasz Wrzosek (l.wrzosek@samsung.com)
  * @author  Yunchan Cho (yunchan.cho@samsung.com)
- * @brief   Plugin module support for Webkit2 - declaration.
+ * @brief   View logic message support - declaration
  */
-#ifndef WRT_SRC_VIEW_WEBKIT2_PLUGIN_MODULE_SUPPORT_H_
-#define WRT_SRC_VIEW_WEBKIT2_PLUGIN_MODULE_SUPPORT_H_
+#ifndef VIEW_LOGIC_MESSAGE_SUPPORT_H_
+#define VIEW_LOGIC_MESSAGE_SUPPORT_H_
 
 #include <EWebKit2.h>
 #include <dpl/string.h>
 #include <js_overlay_types.h>
 
-namespace PluginModuleSupport {
+namespace ViewLogicMessageSupport {
 void init(Ewk_Context* ewkContext,
           const std::string& tizenId);
 void start(Ewk_Context* ewkContext,
            const DPL::String& tizenId,
            double scale,
            const char *encodedBundle,
-           const char *theme,
-           bool encrypted);
+           const char *theme);
 void shutdown(Ewk_Context* ewkContext);
 void setCustomProperties(
     Ewk_Context* ewkContext,
@@ -45,6 +44,7 @@ void dispatchJavaScriptEvent(
     Ewk_Context* ewkContext,
     WrtPlugins::W3C::CustomEventType eventType,
     void* data);
-} // namespace PluginModuleSupport
+void setXwindowHandle(Ewk_Context* ewkContext, const unsigned int handle);
+} // namespace ViewLogicMessageSupport
 
-#endif /* WRT_SRC_VIEW_WEBKIT2_PLUGIN_MODULE_SUPPORT_H_ */
+#endif // VIEW_LOGIC_MESSAGE_SUPPORT_H_
\ No newline at end of file
diff --git a/src/view/webkit/view_logic_orientation_support.cpp b/src/view/webkit/view_logic_orientation_support.cpp
new file mode 100644 (file)
index 0000000..d97d5a2
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2011 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_orientation_support.cpp
+ * @author     Jihoon Chung (jihoon.chung@samsung.com)
+ * @version    1.0
+ */
+
+ #include "view_logic_orientation_support.h"
+
+#include <dpl/log/log.h>
+#include <widget_data_types.h>
+
+#include <EWebKit2.h>
+
+namespace ViewModule {
+
+void OrientationSupport::setOrientation(Evas_Object* window,
+                                        Evas_Object* ewk,
+                                        Mode orientation)
+{
+    LogInfo("setOrientation called");
+    if (orientation == Mode::PORTRAIT_PRIMARY) {
+        LogDebug("orientation is portrait-primary");
+        elm_win_wm_rotation_preferred_rotation_set(
+            window,
+            OrientationAngle::Window::Portrait::PRIMARY);
+        ewk_view_orientation_send(
+            ewk,
+            OrientationAngle::W3C::Portrait::PRIMARY);
+    } else if (orientation == Mode::LANDSCAPE_PRIMARY) {
+        LogDebug("orientation is landscape-primary");
+        elm_win_wm_rotation_preferred_rotation_set(
+            window,
+            OrientationAngle::Window::Landscape::PRIMARY);
+        ewk_view_orientation_send(
+            ewk,
+             OrientationAngle::W3C::Landscape::PRIMARY);
+    } else if (orientation == Mode::PORTRAIT_SECONDARY) {
+        LogDebug("orientation is portrait-secondary");
+        elm_win_wm_rotation_preferred_rotation_set(
+            window,
+            OrientationAngle::Window::Portrait::SECONDARY);
+        ewk_view_orientation_send(
+            ewk,
+            OrientationAngle::W3C::Portrait::SECONDARY);
+    } else if (orientation == Mode::LANDSCAPE_SECONDARY) {
+        LogDebug("orientation is landscape-secondary");
+        elm_win_wm_rotation_preferred_rotation_set(
+            window,
+            OrientationAngle::Window::Landscape::SECONDARY);
+        ewk_view_orientation_send(
+            ewk,
+            OrientationAngle::W3C::Landscape::SECONDARY);
+    } else {
+        LogDebug("Wrong orientation value is passed");
+        return;
+    }
+}
+
+void OrientationSupport::setOrientation(Evas_Object* window,
+                                        Evas_Object* ewk,
+                                        int ewkOrientation)
+{
+    LogInfo("setOrientation called");
+    Mode orientation;
+    if (ewkOrientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) {
+        orientation = Mode::PORTRAIT_PRIMARY;
+    } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
+        orientation = Mode::LANDSCAPE_PRIMARY;
+    } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
+        orientation = Mode::PORTRAIT_SECONDARY;
+    } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
+        orientation = Mode::LANDSCAPE_SECONDARY;
+    } else {
+        LogDebug("Wrong orientation value is passed");
+        return;
+    }
+    setOrientation(window, ewk, orientation);
+}
+} // ViewModule
\ No newline at end of file
  *    See the License for the specific language governing permissions and
  *    limitations under the License.
  */
-/**
- * @file    view_logic_user_agent_support.h
- * @author  Jaroslaw Osmanski (j.osmanski@samsung.com)
- * @brief   Header file of UserAgentSupport API used by ViewLogic
+/*
+ * @file       view_logic_orientation_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_
+#ifndef VIEW_LOGIC_ORIENTATION_SUPPORT_H_
+#define VIEW_LOGIC_ORIENTATION_SUPPORT_H_
 
-#include <string>
+#include <Elementary.h>
 
 namespace ViewModule {
-namespace UserAgentSupport {
-std::string getUserAgentFromVconf();
-} // namespace UserAgentSupport
+namespace OrientationSupport {
+enum class Mode {
+PORTRAIT_PRIMARY = 0,
+LANDSCAPE_PRIMARY,
+PORTRAIT_SECONDARY,
+LANDSCAPE_SECONDARY
+};
+void setOrientation(Evas_Object* window,
+                    Evas_Object* ewk,
+                    Mode orientation);
+void setOrientation(Evas_Object* window,
+                    Evas_Object* ewk,
+                    int ewkOrientation);
+} // namespace OrientationSupport
 } // namespace ViewModule
 
-#endif /* VIEW_LOGIC_USER_AGENT_SUPPORT_H_ */
+#endif // VIEW_LOGIC_ORIENTATION_SUPPORT_H_
\ No newline at end of file
index 6cdce5b..4cd4f0f 100644 (file)
@@ -28,11 +28,8 @@ SplashScreenSupport::SplashScreenSupport(Evas_Object* parent)
     LogDebug("enter");
     Evas_Coord x, y, w, h;
     evas_object_geometry_get(parent, &x, &y, &w, &h);
-
     m_splashScreen = elm_icon_add(parent);
-
     evas_object_resize(m_splashScreen, w, h);
-    evas_object_image_fill_set(m_splashScreen, 0, 0, w, h);
 }
 
 SplashScreenSupport::~SplashScreenSupport()
index 8a22767..6cdaf98 100644 (file)
@@ -31,6 +31,9 @@ char const* const THEME_EDJ_PATH = "/usr/share/edje/wrt/wrt_theme.edj";
 char const* const ELM_STATE_SHOW_CONTENT = "elm,state,show,content";
 char const* const ELM_SWALLOW_CONTENT = "elm.swallow.content";
 char const* const ELM_SWALLOW_BACKWARD = "elm.swallow.backward";
+char const* const ELM_SWALLOW_PROGRESS = "elm.swallow.progress";
+char const* const ELM_STATE_TOOLBAR_INSTANT_OPEN = "elm,state,toolbar,instant_open";
+char const* const ELM_STATE_TOOLBAR_INSTANT_CLOSE = "elm,state,toolbar,instant_close";
 
 const char *ELM_EVENT_PROFILE_CHANGED = "profile,changed";
 
@@ -42,11 +45,12 @@ char const* const NOINDICATOR = "noindicator";
 char const* const INTERNAL_LAYOUT = "internal_layout";
 char const* const FLOATBACKWARD_BUTTON_STYLE = "wrt/backward";
 const std::string DESKTOP_PROFILE("desktop");
+const int PROGRESS_H = 7;
 } // anonymous namespace
 
 WindowData::WindowData(unsigned long pid, bool manualInit) :
     m_win(NULL),
-    m_naviBackButton(NULL),
+    m_naviframeBackButton(NULL),
     m_initialized(false)
 {
     m_win = createWindow(pid);
@@ -81,8 +85,11 @@ void WindowData::init()
     evas_object_show(m_platform_layout);
     m_navigation = createNavigationBar(m_platform_layout);
     evas_object_show(m_navigation);
+    m_naviframeBackButton = createNaviframeBackbutton(m_navigation);
     m_user_layout = createUserLayout(m_navigation);
     evas_object_show(m_user_layout);
+    m_progressbar = createProgressBar(m_win, m_user_layout);
+    evas_object_show(m_progressbar);
 
     UG_INIT_EFL(m_win, UG_OPT_INDICATOR_ENABLE);
     m_initialized = true;
@@ -109,6 +116,22 @@ void WindowData::toggleIndicator(bool fullscreen)
     }
 }
 
+void WindowData::toggleToolbar(bool enable)
+{
+    LogDebug("toolbar = " << (enable ? "enable" : "disable"));
+    Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
+    if (enable) {
+        elm_object_item_signal_emit(naviIt, ELM_STATE_TOOLBAR_INSTANT_OPEN, "");
+    } else {
+        elm_object_item_signal_emit(naviIt, ELM_STATE_TOOLBAR_INSTANT_CLOSE, "");
+    }
+}
+
+bool WindowData::isFullscreen()
+{
+    return m_fullscreen;
+}
+
 void WindowData::setViewMode(
     bool fullscreen,
     bool backbutton)
@@ -122,7 +145,8 @@ void WindowData::setViewMode(
     toggleIndicator(m_fullscreen);
 
     if (backbutton) {
-        createFloatBackButton();
+        // This code will be deprecated by naviframe back button
+        // createFloatBackButton();
     }
 }
 
@@ -207,6 +231,14 @@ Evas_Object* WindowData::createNavigationBar(Evas_Object* parent)
     return navigation;
 }
 
+Evas_Object* WindowData::createNaviframeBackbutton(Evas_Object* parent)
+{
+    Assert(parent != NULL && "Parent for naviframe backbutton is null");
+    Evas_Object* object = elm_button_add(parent);
+    elm_object_style_set(object, "naviframe/end_btn/default");
+    return object;
+}
+
 Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
 {
     Assert(parent != NULL && "Parent for User Layout is null");
@@ -221,9 +253,9 @@ Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
             /* Evas_Object *obj */
             parent,
             /* const char *title_label  */
-            "",
-            /* Evas_Object *prev_btn */
             NULL,
+            /* Evas_Object *prev_btn */
+            m_naviframeBackButton,
             /* Evas_Object *next_btn */
             NULL,
             /* Evas_Object *content */
@@ -231,12 +263,21 @@ Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
             /* const char *item_style */
             NULL);
     ADD_PROFILING_POINT("elm_naviframe_item_push", "stop");
-
     elm_naviframe_item_title_visible_set(naviIt, EINA_FALSE);
 
     return layout;
 }
 
+Evas_Object* WindowData::createProgressBar(Evas_Object* window, Evas_Object* parent)
+{
+    Assert(parent != NULL && "Parent is null");
+    Evas_Object* progressbar = evas_object_rectangle_add(evas_object_evas_get(window));
+    evas_object_color_set(progressbar, 91, 166, 255, 255);
+    elm_object_part_content_set(parent, ELM_SWALLOW_PROGRESS, progressbar);
+    evas_object_resize(progressbar, 0, 0);
+    return progressbar;
+}
+
 void WindowData::setDesktopIcon()
 {
     // set window icon
@@ -247,21 +288,13 @@ void WindowData::setDesktopIcon()
     elm_win_icon_object_set(m_win, icon);
 }
 
-void WindowData::addNaviBackButtonCallback(
-    const char* event,
-    CallbackType callback,
-    const void* data)
-{
-    Assert(m_naviBackButton != NULL && "m_naviBackButton is null");
-    evas_object_smart_callback_add(m_naviBackButton, event, callback, data);
-}
-
-void* WindowData::delNaviBackButtonCallback(
-    const char* event,
-    CallbackType callBack)
+void WindowData::addNaviframeItemPopCallback(
+    NaviframePopCallbackType callback,
+    void* data)
 {
-    Assert(m_naviBackButton != NULL && "m_naviBackButton is null");
-    return evas_object_smart_callback_del(m_naviBackButton, event, callBack);
+    Assert(m_navigation != NULL && "m_navigation is null");
+    Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
+    elm_naviframe_item_pop_cb_set(naviIt, callback, data);
 }
 
 void WindowData::addFloatBackButtonCallback(
@@ -314,20 +347,14 @@ void WindowData::toggleFullscreen(bool fullscreen)
 {
     LogDebug(__PRETTY_FUNCTION__);
 
-    static bool alreadyFullscreen = false;
-
-    if (alreadyFullscreen == fullscreen) {
+    if (m_fullscreen == fullscreen) {
         // window is in fullscreen mode and fullscreen mode is requested, or
         // window is not in fullscreen and a request is made to exit fullscreen
         // In these two situations we don't have to do anything here.
         return;
     }
-
-    if (!m_fullscreen) { //If ViewMode is not fullscreen, toggle indicator
-        toggleIndicator(fullscreen);
-    }
-
-    alreadyFullscreen = !alreadyFullscreen;
+    toggleIndicator(fullscreen);
+    m_fullscreen = fullscreen;
 }
 
 void WindowData::winProfileChangedCallback(void *data,
@@ -347,3 +374,11 @@ void WindowData::winProfileChangedCallback(void *data,
     }
 }
 
+void WindowData::updateProgress(double value)
+{
+    int x, y, w, h;
+    evas_object_geometry_get(m_user_layout, &x, &y, &w, &h);
+    evas_object_resize(m_progressbar,
+                       static_cast<int>(w * value),
+                       static_cast<int>(PROGRESS_H * elm_config_scale_get()));
+}
index 8411ac6..720b9bf 100644 (file)
@@ -47,6 +47,8 @@ class WindowData : private DPL::Noncopyable
         void* data, Evas_Object* obj, void* event_info);
     typedef void (*EvasCallbackType)(
         void* data, Evas* evas, Evas_Object* obj, void* event_info);
+    typedef void (*NaviframePopCallbackType)(
+        void* data, Elm_Object_Item* it);
 
     struct EventWithFunction
     {
@@ -70,13 +72,9 @@ class WindowData : private DPL::Noncopyable
     void init();
     void setEvasObjectForLayout(Evas_Object* evas_object);
     void unsetEvasObjectForLayout();
-    void addNaviBackButtonCallback(
-        const char* event,
-        CallbackType callback,
-        const void* data);
-    void* delNaviBackButtonCallback(
-        const char* event,
-        CallbackType callBack);
+    void addNaviframeItemPopCallback(
+        NaviframePopCallbackType callback,
+        void* data);
     void addFloatBackButtonCallback(
         const char* event,
         CallbackType callback,
@@ -100,24 +98,30 @@ class WindowData : private DPL::Noncopyable
         bool backbutton);
 
     void toggleFullscreen(bool fullscreen);
+    void toggleToolbar(bool enable);
+    bool isFullscreen();
     static void winProfileChangedCallback(void *data,
                                           Evas_Object * obj,
                                           void *event_info);
+    void updateProgress(double value);
 
   protected:
     Evas_Object* m_conformant;
     Evas_Object* m_platform_layout;
     Evas_Object* m_navigation;
-    Evas_Object* m_naviBackButton;
+    Evas_Object* m_naviframeBackButton;
     Evas_Object* m_floatBackButton;
+    Evas_Object* m_progressbar;
     bool m_fullscreen;
     bool m_initialized;
 
     Evas_Object* createWindow(unsigned long pid);
+    Evas_Object* createConformant(Evas_Object* parent);
     Evas_Object* createPlatformLayout(Evas_Object* parent);
     Evas_Object* createNavigationBar(Evas_Object* parent);
+    Evas_Object* createNaviframeBackbutton(Evas_Object* parent);
     Evas_Object* createUserLayout(Evas_Object* parent);
-    Evas_Object* createConformant(Evas_Object* parent);
+    Evas_Object* createProgressBar(Evas_Object* window, Evas_Object* parent);
 
     void alignProgressPosition();
     void toggleIndicator(bool fullscreen);
index 24d8cdd..e1883fb 100644 (file)
@@ -32,7 +32,6 @@
 #include <EWebKit2.h>
 #include <dpl/localization/w3c_file_localization.h>
 #include <dpl/localization/LanguageTagsProvider.h>
-#include "webkit/injected-bundle/plugin_module_support.h"
 #include <popup-runner/PopupInvoker.h>
 #include <prepare_external_storage.h>
 #include <vconf.h>
 
 // window signal callback
 const char *EDJE_SHOW_BACKWARD_SIGNAL = "show,backward,signal";
+const char *EDJE_SHOW_PROGRESS_SIGNAL = "show,progress,signal";
+const char *EDJE_HIDE_PROGRESS_SIGNAL = "hide,progress,signal";
 const std::string VIEWMODE_TYPE_FULLSCREEN = "fullscreen";
 const std::string VIEWMODE_TYPE_MAXIMIZED = "maximized";
 char const* const ELM_SWALLOW_CONTENT = "elm.swallow.content";
 const char* const BUNDLE_PATH = "/usr/lib/libwrt-injected-bundle.so";
 const char* const caCertPath = "/opt/usr/share/certs/ca-certificate.crt";
+const char* const MESSAGE_NAME_INITIALIZE = "ToInjectedBundle::INIT";
 
 // process pool
 const char* const DUMMY_PROCESS_PATH = "/usr/bin/wrt_launchpad_daemon_candidate";
@@ -62,6 +64,7 @@ static char** app_argv = NULL;
 // env
 const char* const HOME = "HOME";
 const char* const APP_HOME_PATH = "/opt/home/app";
+const char* const ROOT_HOME_PATH = "/opt/home/root";
 
 WrtClient::WrtClient(int argc, char **argv) :
     Application(argc, argv, "wrt-client", false),
@@ -311,11 +314,7 @@ void WrtClient::initStep()
         SwitchToStep(&WrtClient::shutdownStep);
     }
 
-    // ecore_event_jobs are processed sequentially without concession to
-    // other type events. To give a chance of execute to other events,
-    // ecore_timer_add was used.
-    DPL::Event::ControllerEventHandler<NextStepEvent>::PostTimedEvent(
-        NextStepEvent(), 0.001);
+    DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(NextStepEvent());
 }
 
 void WrtClient::loadFinishCallback(Evas_Object* webview)
@@ -389,9 +388,27 @@ void WrtClient::loadFinishCallback(Evas_Object* webview)
     delete debug;
 }
 
+void WrtClient::progressStartedCallback()
+{
+    if (m_settingList->getProgressBarPresence() == ProgressBar_Enable) {
+        m_windowData->emitSignalForUserLayout(EDJE_SHOW_PROGRESS_SIGNAL, "");
+        m_windowData->updateProgress(0);
+    }
+}
+
+void WrtClient::loadProgressCallback(Evas_Object* /*webview*/, double value)
+{
+    m_windowData->updateProgress(value);
+}
+
 void WrtClient::progressFinishCallback()
 {
-    m_splashScreen->stopSplashScreen();
+    if (m_splashScreen->createSplashScreen(m_dao->getSplashImgSrc())) {
+        m_splashScreen->stopSplashScreen();
+    }
+    if (m_settingList->getProgressBarPresence() == ProgressBar_Enable) {
+        m_windowData->emitSignalForUserLayout(EDJE_HIDE_PROGRESS_SIGNAL, "");
+    }
 }
 
 void WrtClient::webkitExitCallback()
@@ -410,6 +427,33 @@ void WrtClient::webCrashCallback()
         NextStepEvent());
 }
 
+void WrtClient::toggleFullscreenCallback(bool fullscreen)
+{
+    LogError("toggleFullscreen");
+
+    if (fullscreen) {
+        m_windowData->toggleFullscreen(true);
+        if (m_settingList->getBackButtonPresence() == BackButton_Enable) {
+            m_windowData->toggleToolbar(false);
+        }
+    } else {
+        m_windowData->toggleFullscreen(false);
+        if (m_settingList->getBackButtonPresence() == BackButton_Enable) {
+            m_windowData->toggleToolbar(true);
+        }
+    }
+}
+
+void WrtClient::imeChangedCallback(bool open)
+{
+    LogError("imeChangedCallback");
+    if (m_settingList->getBackButtonPresence() == BackButton_Enable &&
+        m_windowData->isFullscreen())
+    {
+        m_windowData->toggleToolbar(open);
+    }
+}
+
 void WrtClient::launchStep()
 {
     ADD_PROFILING_POINT("launchStep", "start");
@@ -442,6 +486,10 @@ void WrtClient::launchStep()
     }
 
     m_dao.reset(new WrtDB::WidgetDAOReadOnly(DPL::FromASCIIString(m_tizenId)));
+    WrtDB::WidgetSettings widgetSettings;
+    m_dao->getWidgetSettings(widgetSettings);
+    m_settingList.reset(new WidgetSettingList(widgetSettings));
+
     DPL::Optional<DPL::String> defloc = m_dao->getDefaultlocale();
     if (!defloc.IsNull()) {
         LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(
@@ -474,10 +522,6 @@ void WrtClient::launchStep()
         new SplashScreenSupport(m_windowData->m_win));
     if (m_splashScreen->createSplashScreen(m_dao->getSplashImgSrc())) {
         m_splashScreen->startSplashScreen();
-        cbs->progressFinish = DPL::MakeDelegate(
-                this,
-                &WrtClient::
-                    progressFinishCallback);
     }
     ADD_PROFILING_POINT("Create splash screen", "stop");
     DPL::OptionalString startUrl = W3CFileLocalization::getStartFile(m_dao);
@@ -493,8 +537,9 @@ void WrtClient::launchStep()
 
     //you can't show window with splash screen before PrepareView
     //ewk_view_add_with_context() in viewLogic breaks window
-
     m_windowData->init();
+    m_windowData->toggleToolbar(
+        m_settingList->getBackButtonPresence() == BackButton_Enable);
 
     WrtDB::WidgetLocalizedInfo localizedInfo =
         W3CFileLocalization::getLocalizedInfo(m_dao);
@@ -517,17 +562,19 @@ void WrtClient::launchStep()
     LogInfo("Widget launch accepted. Entering running state");
     m_widgetState = WidgetState_Running;
 
+    cbs->progressStarted = DPL::MakeDelegate(this, &WrtClient::progressStartedCallback);
+    cbs->progress = DPL::MakeDelegate(this, &WrtClient::loadProgressCallback);
+    cbs->progressFinish = DPL::MakeDelegate(this, &WrtClient::progressFinishCallback);
     cbs->loadFinish = DPL::MakeDelegate(this, &WrtClient::loadFinishCallback);
     cbs->bufferSet = DPL::MakeDelegate(this, &WrtClient::setLayout);
     cbs->bufferUnset = DPL::MakeDelegate(this, &WrtClient::unsetLayout);
     cbs->webkitExit = DPL::MakeDelegate(this, &WrtClient::webkitExitCallback);
     cbs->webCrash = DPL::MakeDelegate(this, &WrtClient::webCrashCallback);
-    cbs->toggleFullscreen = DPL::MakeDelegate(
-            m_windowData.get(), &WindowData::toggleFullscreen);
+    cbs->toggleFullscreen = DPL::MakeDelegate(this, &WrtClient::toggleFullscreenCallback);
+    cbs->editorClientIme = DPL::MakeDelegate(this, &WrtClient::imeChangedCallback);
 
     m_widget->SetUserDelegates(cbs);
     m_widget->Show();
-
     m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
 
     ADD_PROFILING_POINT("launchStep", "stop");
@@ -540,13 +587,7 @@ void WrtClient::initializeWindowModes()
     auto windowModes = m_dao->getWindowModes();
     bool fullscreen = false;
     bool backbutton = false;
-    if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
-        WrtDB::WidgetSettings widgetSettings;
-        m_dao->getWidgetSettings(widgetSettings);
-        WidgetSettingList settings(widgetSettings);
-        backbutton =
-            (settings.getBackButtonPresence() == BackButton_Enable);
-    }
+    backbutton = (m_settingList->getBackButtonPresence() == BackButton_Enable);
 
     FOREACH(it, windowModes)
     {
@@ -571,7 +612,16 @@ void WrtClient::backButtonCallback(void* data,
     Assert(data);
 
     WrtClient* This = static_cast<WrtClient*>(data);
+    This->m_widget->Backward();
+}
+
+void WrtClient::naviframeBackButtonCallback(void* data,
+                                            Elm_Object_Item* it)
+{
+    LogInfo("BackButtonCallback");
+    Assert(data);
 
+    WrtClient* This = static_cast<WrtClient*>(data);
     This->m_widget->Backward();
 }
 
@@ -591,10 +641,7 @@ void WrtClient::setOrientationWindow(void)
     Assert(m_windowData);
     Assert(m_dao);
 
-    WrtDB::WidgetSettings widgetSettings;
-    m_dao->getWidgetSettings(widgetSettings);
-    WidgetSettingList settings(widgetSettings);
-    WidgetSettingScreenLock rotationValue = settings.getRotationValue();
+    WidgetSettingScreenLock rotationValue = m_settingList->getRotationValue();
     if (rotationValue == Screen_Portrait) {
         elm_win_wm_rotation_preferred_rotation_set(
             m_windowData->m_win,
@@ -617,10 +664,7 @@ void WrtClient::unsetOrientationWindow(void)
     Assert(m_windowData);
     Assert(m_dao);
 
-    WrtDB::WidgetSettings widgetSettings;
-    m_dao->getWidgetSettings(widgetSettings);
-    WidgetSettingList settings(widgetSettings);
-    WidgetSettingScreenLock rotationValue = settings.getRotationValue();
+    WidgetSettingScreenLock rotationValue = m_settingList->getRotationValue();
     if (rotationValue == Screen_AutoRotation) {
         LogInfo("Nothing to do");
     }
@@ -632,10 +676,7 @@ void WrtClient::setOrientationEwk(void)
     Assert(m_widget);
     Assert(m_dao);
 
-    WrtDB::WidgetSettings widgetSettings;
-    m_dao->getWidgetSettings(widgetSettings);
-    WidgetSettingList settings(widgetSettings);
-    WidgetSettingScreenLock rotationValue = settings.getRotationValue();
+    WidgetSettingScreenLock rotationValue = m_settingList->getRotationValue();
     if (rotationValue == Screen_Portrait) {
         ewk_view_orientation_send(
             m_widget->GetCurrentWebview(),
@@ -659,13 +700,10 @@ void WrtClient::connectElmCallback()
 {
     Assert(m_windowData);
     Assert(m_dao);
-    WrtDB::WidgetSettings widgetSettings;
-    m_dao->getWidgetSettings(widgetSettings);
-    WidgetSettingList settings(widgetSettings);
-    if (settings.getBackButtonPresence() == BackButton_Enable) {
-        m_windowData->addFloatBackButtonCallback(
-            "clicked",
-            &WrtClient::backButtonCallback,
+
+    if (m_settingList->getBackButtonPresence() == BackButton_Enable) {
+        m_windowData->addNaviframeItemPopCallback(
+            WrtClient::naviframeBackButtonCallback,
             this);
     }
 }
@@ -854,6 +892,9 @@ int main(int argc,
             sprintf(argv[0], "%s                                              ",
                     DUMMY_PROCESS_PATH);
 
+            // Set 'root' home directory
+            setenv(HOME, ROOT_HOME_PATH, 1);
+
             LogInfo("Prepare ewk_context");
             appcore_set_i18n("wrt-client", NULL);
             ewk_set_arguments(argc, argv);
@@ -910,7 +951,10 @@ int main(int argc,
             vconf_ignore_key_changed(VCONFKEY_LANGSET, vconf_changed_handler);
 
             std::string tizenId = WrtClient::getTizenIdFromArgument(argc, argv);
-            PluginModuleSupport::init(s_preparedEwkContext, tizenId);
+            ewk_context_message_post_to_injected_bundle(
+                s_preparedEwkContext,
+                MESSAGE_NAME_INITIALIZE,
+                tizenId.c_str());
         }
         else
         {
@@ -939,8 +983,10 @@ int main(int argc,
                 }
 
                 // plugin init
-                PluginModuleSupport::init(s_preparedEwkContext, tizenId);
-
+                ewk_context_message_post_to_injected_bundle(
+                    s_preparedEwkContext,
+                    MESSAGE_NAME_INITIALIZE,
+                    tizenId.c_str());
             }
         }
 
index 773c425..794c987 100644 (file)
@@ -82,6 +82,9 @@ class WrtClient :
     static void backButtonCallback(void* data,
                                    Evas_Object* obj,
                                    void* event_info);
+    static void naviframeBackButtonCallback(void* data,
+                                            Elm_Object_Item* it);
+
     // Low Memory Callback
     static int appcoreLowMemoryCallback(void* data);
 
@@ -96,9 +99,13 @@ class WrtClient :
     void shutdownStep();
     static int languageChangedCallback(void *data);
     void loadFinishCallback(Evas_Object* webview);
+    void progressStartedCallback();
+    void loadProgressCallback(Evas_Object* webview, double value);
     void progressFinishCallback();
     void webkitExitCallback();
     void webCrashCallback();
+    void toggleFullscreenCallback(bool fullscreen);
+    void imeChangedCallback(bool open);
     void setLayout(Evas_Object* newBuffer);
     void unsetLayout(Evas_Object* currentBuffer);
 
@@ -115,6 +122,7 @@ class WrtClient :
     ReturnStatus::Type m_returnStatus;
     WRT::RunnableWidgetObjectPtr m_widget;
     WrtDB::WidgetDAOReadOnlyPtr m_dao;
+    WidgetSettingListPtr m_settingList;
     WidgetState m_widgetState;
     std::unique_ptr<WindowData> m_windowData;
     std::unique_ptr<SplashScreenSupport> m_splashScreen;
index 9bfb30a..a751121 100644 (file)
@@ -1 +1,3 @@
 export WRT_PROCESS_POOL_DISABLE=ON
+#export WRT_WILL_SEND_REQUEST_LOG_ENABLE=ON
+#export WRT_LOAD_PLUGINS_LOG_ENABLE=ON
index f7a306e..19f6e69 100644 (file)
@@ -1,5 +1,6 @@
 wrt_launchpad_daemon system::share rwx
 wrt_launchpad_daemon system::homedir rwx
 wrt_launchpad_daemon device::app_logging w
-wrt_launchpad_daemon xorg w
+wrt_launchpad_daemon xorg rw
 wrt_launchpad_daemon webkit2-efl rwxa
+wrt_launchpad_daemon sys-assert::core rwxat