update wrt_0.8.107
authorSoyoung Kim <sy037.kim@samsung.com>
Thu, 25 Oct 2012 10:34:04 +0000 (19:34 +0900)
committerSoyoung Kim <sy037.kim@samsung.com>
Thu, 25 Oct 2012 15:00:50 +0000 (00:00 +0900)
79 files changed:
CMakeLists.txt
data/Daemon.edc
data/Platform.edc [new file with mode: 0755]
data/images/icon_left_arrow.png [new file with mode: 0644]
data/images/icon_refresh.png [new file with mode: 0644]
data/images/icon_right_arrow.png [new file with mode: 0644]
data/images/mp_stop.png [new file with mode: 0644]
debian/changelog
debian/control
packaging/wrt.spec
src/CMakeLists.txt
src/api_new/CMakeLists.txt
src/api_new/core_module.cpp
src/api_new/core_module.h
src/api_new/i_runnable_widget_object.h
src/api_new/runnable_widget_object.cpp
src/api_new/runnable_widget_object.h
src/api_new/runnable_widget_object_state.cpp [new file with mode: 0644]
src/api_new/runnable_widget_object_state.h [new file with mode: 0644]
src/domain/localization_setting.cpp
src/domain/localization_setting.h
src/domain/main_thread.cpp
src/domain/widget_data_types.cpp
src/domain/widget_data_types.h
src/domain/widget_deserialize_model.cpp
src/domain/widget_deserialize_model.h
src/domain/widget_localize_model.cpp
src/domain/widget_localize_model.h
src/domain/widget_model.cpp
src/domain/widget_model.h
src/popup-process/PopupInvoker.cpp
src/popup-process/PopupInvoker.h
src/popup-process/PopupSerializer.cpp
src/profiling/profiling_util.h
src/profiling/script/profiling-target-part.pl
src/view/common/CMakeLists.txt
src/view/common/application_launcher.cpp
src/view/common/application_launcher.h
src/view/common/evas_object.h
src/view/common/roaming_agent.cpp
src/view/common/scheme_action_map.cpp
src/view/common/scheme_action_map.h
src/view/common/scheme_action_map_data.h [new file with mode: 0644]
src/view/common/scheme_action_map_type.h [new file with mode: 0644]
src/view/common/view_logic_apps_support.cpp
src/view/common/view_logic_geolocation_support.cpp
src/view/common/view_logic_geolocation_support.h
src/view/common/view_logic_password_support.cpp
src/view/common/view_logic_security_support.cpp
src/view/common/view_logic_security_support.h
src/view/common/view_logic_storage_support.cpp
src/view/common/view_logic_uri_support.cpp
src/view/common/view_logic_web_notification_support.cpp
src/view/common/view_logic_web_notification_support.h
src/view/i_view_module.h
src/view/view_module.cpp
src/view/webkit/CMakeLists.txt
src/view/webkit/bundles/CMakeLists.txt
src/view/webkit/bundles/bundle_uri_handling.cpp [new file with mode: 0644]
src/view/webkit/bundles/bundle_uri_handling.h [new file with mode: 0644]
src/view/webkit/bundles/plugin_module_support.cpp
src/view/webkit/bundles/plugin_module_support.h
src/view/webkit/bundles/wrt-wk2-bundle.cpp
src/view/webkit/bundles/wrt-wk2-bundle.h
src/view/webkit/view_logic.cpp
src/view/webkit/view_logic.h
src/view/webkit/view_logic_geolocation_support_webkit2.cpp
src/view/webkit/view_logic_geolocation_support_webkit2.h
src/view/webkit/view_logic_scheme_support.cpp
src/view/webkit/view_logic_scheme_support.h
src/wrt-client/CMakeLists.txt
src/wrt-client/splash_screen_support.cpp
src/wrt-client/splash_screen_support.h
src/wrt-client/window_data.cpp
src/wrt-client/window_data.h
src/wrt-client/wrt-client.cpp
src/wrt-client/wrt-client.h
src/wrt-launcher/wrt-launcher.cpp
wrt.manifest [new file with mode: 0644]

index 8013b07..bee5b1e 100644 (file)
@@ -152,6 +152,22 @@ INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/default_icon_tizen.png
 INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/default_icon_wac.png
     DESTINATION share/wrt-engine/
     )
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/icon_left_arrow.png
+    DESTINATION /usr/etc/wrt/
+    PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
+    )
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/icon_refresh.png
+    DESTINATION /usr/etc/wrt/
+    PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
+    )
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/icon_right_arrow.png
+    DESTINATION /usr/etc/wrt/
+    PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
+    )
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/mp_stop.png
+    DESTINATION /usr/etc/wrt/
+    PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
+    )
 INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/userAgentProfile.xml
     DESTINATION share/wrt-engine/
     )
@@ -182,6 +198,13 @@ ADD_CUSTOM_COMMAND(
           ${PROJECT_SOURCE_DIR}/data/Daemon.edj
     DEPENDS ${PROJECT_SOURCE_DIR}/data/Daemon.edc
     )
+ADD_CUSTOM_COMMAND(
+    OUTPUT ${PROJECT_SOURCE_DIR}/data/Platform.edj
+    COMMAND edje_cc
+    ARGS  ${PROJECT_SOURCE_DIR}/data/Platform.edc
+          ${PROJECT_SOURCE_DIR}/data/Platform.edj
+    DEPENDS ${PROJECT_SOURCE_DIR}/data/Platform.edc
+    )
 ADD_CUSTOM_TARGET( ACE_EDJES ALL DEPENDS
     ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
     )
@@ -191,6 +214,9 @@ ADD_CUSTOM_TARGET( WRT_THEME_EDJES ALL DEPENDS
 ADD_CUSTOM_TARGET( WRT_EDJES ALL DEPENDS
     ${PROJECT_SOURCE_DIR}/data/Daemon.edj
     )
+ADD_CUSTOM_TARGET( WRT_PLATFORM_LAYOUT_EDJES ALL DEPENDS
+    ${PROJECT_SOURCE_DIR}/data/Platform.edj
+    )
 ADD_CUSTOM_COMMAND(
     OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
     COMMAND edje_cc
@@ -213,6 +239,9 @@ INSTALL(FILES   ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
 INSTALL(FILES   ${PROJECT_SOURCE_DIR}/data/Daemon.edj
     DESTINATION share/edje/wrt/
     )
+INSTALL(FILES   ${PROJECT_SOURCE_DIR}/data/Platform.edj
+    DESTINATION share/edje/wrt/
+    )
 ADD_CUSTOM_COMMAND(
     OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
     COMMAND edje_cc
index 48e72b3..4c9c9d7 100644 (file)
@@ -46,6 +46,48 @@ collections {
                 }
             }
             part {
+                name: "elm.swallow.toolbar";
+                type: SWALLOW;
+                mouse_events: 1;
+                repeat_events: 0;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    visible: 0;
+                    min: 700 100;
+                    max: 800 100;
+                    fixed: 0 0 ;
+                    align: 1.0 1.0;
+                    rel1 { relative: 0.0 1.0; }
+                    rel2 { relative: 1.0 1.0; }
+                }
+                description {
+                    state: "visible" 0.0;
+                    inherit: "default" 0.0;
+                    visible: 1;
+                }
+            }
+            part {
+                name: "elm.rect.hiddenOption";
+                type: RECT;
+                mouse_events: 1;
+                description {
+                    state: "default" 0.0;
+                    visible: 0;
+                    min: 50 50;
+                    max: 50 50;
+                    align: 1.0 1.0;
+                    rel1 { relative: 1.0 1.0; to: base; }
+                    rel2 { relative: 1.0 1.0; to: base; }
+                }
+                description {
+                    state: "visible" 0.0;
+                    inherit: "default" 0.0;
+                    color: 100 55 55 100;
+                    visible: 1;
+                }
+            }
+            part {
                 name: "elm.rect.comboboxPickerBG";
                 type: RECT;
                 mouse_events: 0;
@@ -107,6 +149,26 @@ collections {
                 action: STATE_SET "default" 0.0;
                 target: "elm.swallow.backward";
             }
+            program { name: "show,toolbar";
+                signal: "show,toolbar,signal";
+                action: STATE_SET "visible" 0.0;
+                target: "elm.swallow.toolbar";
+            }
+            program { name: "hide,toolbar";
+                signal: "hide,toolbar,signal";
+                action: STATE_SET "default" 0.0;
+                target: "elm.swallow.toolbar";
+            }
+            program { name: "show,hiddenOption";
+                signal: "show,hiddenOption,signal";
+                action: STATE_SET "visible" 0.0;
+                target: "elm.rect.hiddenOption";
+            }
+            program { name: "hide,hiddenOption";
+                signal: "hide,hiddenOption,signal";
+                action: STATE_SET "default" 0.0;
+                target: "elm.rect.hiddenOption";
+            }
             program { name: "showComboboxPicker";
                 signal: "show,comboboxPicker";
                 action: STATE_SET "showComboboxPicker" 0.0;
diff --git a/data/Platform.edc b/data/Platform.edc
new file mode 100755 (executable)
index 0000000..8bc57fa
--- /dev/null
@@ -0,0 +1,24 @@
+collections {
+    group { name: "platformlayout";
+        parts {
+            part { name: "elm.swallow.bg";
+                type: SWALLOW;
+                scale: 1;
+                description { state: "default" 0.0;
+                }
+            }
+            part { name: "elm.swallow.content";
+                type: SWALLOW;
+                scale: 1;
+                description { state: "default" 0.0;
+                }
+            }
+            part { name: "elm.swallow.controlbar";
+                type: SWALLOW;
+                description { state: "default" 0.0;
+                    visible: 0;
+                }
+            }
+        }
+    }
+}
diff --git a/data/images/icon_left_arrow.png b/data/images/icon_left_arrow.png
new file mode 100644 (file)
index 0000000..556399e
Binary files /dev/null and b/data/images/icon_left_arrow.png differ
diff --git a/data/images/icon_refresh.png b/data/images/icon_refresh.png
new file mode 100644 (file)
index 0000000..5ea70bf
Binary files /dev/null and b/data/images/icon_refresh.png differ
diff --git a/data/images/icon_right_arrow.png b/data/images/icon_right_arrow.png
new file mode 100644 (file)
index 0000000..6bbb2c6
Binary files /dev/null and b/data/images/icon_right_arrow.png differ
diff --git a/data/images/mp_stop.png b/data/images/mp_stop.png
new file mode 100644 (file)
index 0000000..e09dd1f
Binary files /dev/null and b/data/images/mp_stop.png differ
index aeab0c6..4969fe4 100644 (file)
@@ -1,3 +1,199 @@
+wrt (0.8.107) unstable; urgency=low
+
+  * [Engine] wrt-launcher widget info display change.
+  * [Engine] Remove widgetHandle from geolocation support
+  * URI handling moved to WebProcess
+  * [Engine] Replacing FileUtils function calls
+  * Profiling script modified to according to wrt-launcher changes
+
+
+  * Git : framework/web/wrt
+  * Tag : wrt_0.8.107
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Thu, 25 Oct 2012 14:57:29 +0900
+
+wrt (0.8.106) unstable; urgency=low
+
+  * Rename PkgName to TizenId in widget model
+  * Changed callback mechanism to use FastDelegates #2
+  * wrt-client attach to database thread
+  * Remove widget model from wrt api
+  * Remove widget handle from wrt-launcher
+  * Removing direct call to DBus from RunnableWidgetObject
+  * Fix for RunnableObjectGuardState when background page enable
+  * Remove unused fields from widget model
+  * Replace WK API to ewk
+
+  * Git : framework/web/wrt
+  * Tag : wrt_0.8.106
+
+ -- Leerang Song <leerang.song@samsung.com>  Fri, 19 Oct 2012 10:59:45 +0900
+
+wrt (0.8.105) unstable; urgency=low
+
+  * Remove widget handle from wrt api
+  * Fix for profiling scripts
+  * Removed unused YouTubeHD::parseXML() and libxml2
+  * Remove widget handle from youtubehd
+  * Remove ewk_xxx header
+  * Add license installing
+
+  * Git : framework/web/wrt
+  * Tag : wrt_0.8.105
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Thu, 11 Oct 2012 08:33:48 +0900
+
+wrt (0.8.104) unstable; urgency=low
+
+  * Blank IFrame issue fix
+  * Manifest file changed
+  * Prevent popup from asking filesystem permission
+  * Remove widget handle from wrt-client
+  * Fixed get application service uri
+  * WRT Runnable Object State Guard
+
+  * Git : framework/web/wrt
+  * Tag : wrt_0.8.104
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Tue, 09 Oct 2012 21:13:55 +0900
+
+wrt (0.8.103) unstable; urgency=low
+
+  * NPAPI plugins support is always on by default
+  * backbutton support
+  * Change the setting method of window layout
+  * Removed unused code after old wrt api
+  * Removed unused ace profiling scripts
+
+  * Git : framework/web/wrt
+  * Tag : wrt_0.8.103
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Mon, 08 Oct 2012 21:05:09 +0900
+
+wrt (0.8.102) unstable; urgency=low
+
+  * [Engine] Allow to launch widget with tizen id
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.102
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Fri, 05 Oct 2012 15:41:22 +0900
+
+wrt (0.8.101) unstable; urgency=low
+
+  * [Engine] DPL pointer replaced by std pointers
+  * LanguageTagsProvider reset on system lang change
+  * Widget localization refactoring
+  * [Engine] Few new profiling points. Profiling script modification to parse debug
+  * LanguageTags removed from WidgetModel
+  * Added FullscreenAPI handling in wrt-client
+  * [Engine] Add wrt-popup
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.101
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Fri, 05 Oct 2012 08:00:36 +0900
+
+wrt (0.8.100) unstable; urgency=low
+
+  * Fix for crash when terminated
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.100
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Fri, 28 Sep 2012 15:25:13 +0900
+
+wrt (0.8.99) unstable; urgency=low
+
+  * Add SEL Verification tag
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.99
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Thu, 27 Sep 2012 21:21:28 +0900
+
+wrt (0.8.98) unstable; urgency=low
+
+  * Add hidden option for developer
+  * Fix for N_SE-10234 and Redefine of system language change action
+  * Filesystem permission request ask Popup
+  * Add WKBundlePagePolicyClient callbacks for improving launching time
+  * unregister callback on widget close
+  * Set export env for rendering
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.98
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Thu, 27 Sep 2012 16:05:14 +0900
+
+wrt (0.8.97) unstable; urgency=low
+
+  * Add smack manifest
+
+  * Git : framework/web/wrt
+  * Tag : wrt_0.8.97
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Thu, 20 Sep 2012 20:16:12 +0900
+
+wrt (0.8.96) unstable; urgency=low
+
+  * for SEL_verification release
+
+  * Git : framework/web/wrt
+  * Tag : wrt_0.8.96
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Thu, 20 Sep 2012 11:54:36 +0900
+
+wrt (0.8.95) unstable; urgency=low
+
+  * Fixed N_SE-10195
+  * CMakeLists cleanup
+  * Change related to new language tags provider.
+  * Tizen setting configuration extention rename
+  * wrt-security dep fixed
+  * Database Usage Exceed Permission Ask Popup
+  * Changed callback mechanism to use FastDelegates
+  * Move up WebProcess fork timing.
+  * Removing the "Search the Web" context menu.
+  * Unnecessary method declarations removed
+  * Framework directory removed
+
+  * Git : framework/web/wrt
+  * Tag : wrt_0.8.95
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Wed, 19 Sep 2012 12:21:22 +0900
+
+wrt (0.8.94) unstable; urgency=low
+
+  * [Engine] fix for wrt test mode
+  * [Engine] Fixed N_SE-9280
+  * [Engine] Add evas_object_focus_set in the OnPause
+  * [Engine] Remove progress evas_object
+  * [Engine] Remove build warning
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.94
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Wed, 12 Sep 2012 15:55:45 +0900
+
+wrt (0.8.93) unstable; urgency=low
+
+  * [Engine] Upgrade Security dependencies
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.93
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Tue, 11 Sep 2012 15:41:57 +0900
+
+wrt (0.8.92) unstable; urgency=low
+
+  * [Engine] support multiple view object
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.92
+
+ -- Yunchan Cho <yunchan.cho@samsung.com>  Thu, 06 Sep 2012 00:17:20 +0900
+
 wrt (0.8.91) unstable; urgency=low
 
   * [Engine] Rearrange return value for IDE
index c143586..67cc159 100644 (file)
@@ -3,7 +3,7 @@ Section: devel
 Priority: extra
 Maintainer:  Krzysztof Jackiewicz<k.jackiewicz@samsung.com>,  Bartlomiej Grzelewski<b.grzelewski@samsung.com>, jihoon Chung <jihoon.chung@samsung.com>, yunchan Cho <yunchan.cho@samsung.com>
 Uploaders: Lukasz Wrzosek <l.wrzosek@samsung.com>,  Grzegorz Krawczyk <g.krawczyk@samsung.com>, Soyoung Kim <sy037.kim@samsung.com>,Pawel Sikorski <p.sikorski@samsung.com>,  Zbigniew Kostrzewa <z.kostrzewa@samsung.com>, Wonguk Jeong <wonguk.jeong@samsung.com>
-Build-Depends: debhelper (>= 5), libglib2.0-dev, libsqlite3-dev, libxml2-dev, libdbus-1-dev, libefreet-dev, libappcore-efl-dev, openssl (>= 0.9.7), libcert-svc-dev, wrt-commons-dev (>= 0.2.21), libpcre-dev, libelm-dev, libecore-dev, libeina-dev, libui-gadget-dev, libslp-utilx-dev, libsecurity-server-client-dev, libpkgmgr-installer-dev, libxmlsec1-dev, libidn11-dev, libpkgmgr-types-dev, libss-client-dev, libiri-dev, libappsvc-dev, wrt-security-dev (>=0.0.13), libwebkit2-efl-dev, libnotification-dev, libprivilege-control-dev, wrt-plugins-common-dev
+Build-Depends: debhelper (>= 5), libglib2.0-dev, libsqlite3-dev, libdbus-1-dev, libefreet-dev, libappcore-efl-dev, openssl (>= 0.9.7), libcert-svc-dev, wrt-commons-dev (>= 0.2.21), libpcre-dev, libelm-dev, libecore-dev, libeina-dev, libui-gadget-dev, libslp-utilx-dev, libsecurity-server-client-dev, libpkgmgr-installer-dev, libxmlsec1-dev, libidn11-dev, libpkgmgr-types-dev, libss-client-dev, libiri-dev, libappsvc-dev, wrt-security-dev (>=0.0.13), libwebkit2-efl-dev, libnotification-dev, libprivilege-control-dev, wrt-plugins-common-dev
 Standards-Version: 0.1.0
 
 Package: wrt
index 744954c..ff2b953 100644 (file)
@@ -1,7 +1,7 @@
-#sbs-git:slp/pkgs/w/wrt wrt 0.8.91
+#sbs-git:slp/pkgs/w/wrt wrt 0.8.107
 Name:       wrt
 Summary:    web runtime
-Version:    0.8.91
+Version:    0.8.107
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
@@ -13,7 +13,6 @@ BuildRequires:  edje-tools
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(sqlite3)
 BuildRequires:  pkgconfig(ewebkit2)
-BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(dbus-1)
 BuildRequires:  pkgconfig(efreet)
 BuildRequires:  pkgconfig(appcore-efl)
@@ -31,9 +30,10 @@ BuildRequires:  pkgconfig(xmlsec1)
 BuildRequires:  pkgconfig(libidn)
 BuildRequires:  pkgconfig(libiri)
 BuildRequires:  pkgconfig(appsvc)
-BuildRequires:  pkgconfig(vcore)
+BuildRequires:  pkgconfig(cert-svc-vcore)
 BuildRequires:  pkgconfig(libsoup-2.4)
-BuildRequires:  pkgconfig(ace-client)
+BuildRequires:  pkgconfig(security-core)
+BuildRequires:  pkgconfig(security-client)
 BuildRequires:  pkgconfig(notification)
 BuildRequires:  pkgconfig(libprivilege-control)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
@@ -42,6 +42,7 @@ 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-runner)
 
 %description
 web runtime
@@ -67,6 +68,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 make %{?jobs:-j%jobs}
 
 %install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
 %make_install
 
 %clean
@@ -85,6 +88,7 @@ chmod +s /usr/bin/wrt-launcher
 echo "[WRT] wrt postinst done ..."
 
 %files
+%manifest wrt.manifest
 %{_libdir}/*.so
 %{_libdir}/*.so.*
 %{_libdir}/wrt-wk2-bundles/*.so
@@ -95,6 +99,7 @@ echo "[WRT] wrt postinst done ..."
 %attr(755,root,root) %{_bindir}/wrt_reset_db.sh
 %{_datadir}/locale/*
 %{_datadir}/wrt-engine/*
+%{_datadir}/license/%{name}
 %attr(644,root,root) %{_datadir}/edje/wrt/*
 %attr(644,root,root) %{_datadir}/edje/ace/*
 %attr(644,root,root) /usr/etc/wrt/*
index dc7f299..10ef0a0 100755 (executable)
@@ -44,7 +44,6 @@ SET(WRT_CORE_INCLUDES
     ${WRT_SRC_DIR}/configuration
     ${WRT_SRC_DIR}/domain
     ${WRT_SRC_DIR}/localization
-    ${WRT_SRC_DIR}/framework
     ${WRT_SRC_DIR}/profiling
     ${WRT_SRC_DIR}/global_logic
     ${WRT_SRC_DIR}/ui
@@ -56,25 +55,17 @@ SET(WRT_PLUGIN_LOADING_DIR
     ${WRT_SRC_DIR}/plugin-service/plugin-loading/
    )
 
-SET(WRT_DAO_DIR
-    ${WRT_SRC_DIR}/configuration/
-    )
-
-SET(WRT_DAO_INCLUDES
-    ${WRT_DAO_DIR}
-   )
 
 SET(PLUGIN_LOADING_INCLUDES
   ${WRT_PLUGIN_LOADING_DIR}
 )
 
 SET(WRT_BASIC_DEP
-    libxml-2.0
     openssl
     libpcrecpp
     dpl-popup-efl
     dpl-efl
-    vcore
+    cert-svc-vcore
     dpl-dbus-efl
     dpl-event-efl
     dpl-utils-efl
@@ -101,34 +92,23 @@ SET(WRT_BASIC_DEP
     secure-storage
     libiri
     appsvc
-    wrt-security
-    ace-client
+    security-core
+    security-client
+    wrt-popup-runner
 )
 
 IF(SMACK_ENABLED)
   LIST(APPEND WRT_BASIC_DEP libprivilege-control)
 ENDIF(SMACK_ENABLED)
 
-#defining:
-    # WRT_ENGINE_SOURCES
-    # WRT_ENGINE_INCLUDE_DIRS
-
 PKG_CHECK_MODULES(WRT_ENGINE_DEPS
     ${WRT_BASIC_DEP}
     REQUIRED)
 
-SET(WRT_ENGINE_SOURCES
-    ${WRT_CORE_SOURCES}
-    ${WRT_DAO_INCLUDES}
-    ${WRT_PERFORMANCE_SOURCES}
-    ${WRT_CORE_BASE_SOURCES}
-)
-
 SET(WRT_ENGINE_INCLUDE_DIRS
     ${WRT_CORE_INCLUDES}
     ${PLUGIN_LOADING_INCLUDES}
     ${WRT_ENGINE_DEPS_INCLUDE_DIRS}
-    ${WRT_PERFORMANCE_INCLUDES}
 )
 
 #wrt-engine-static
@@ -137,7 +117,7 @@ ADD_DEFINITIONS(${WRT_ENGINE_DEPS_CFLAGS_OTHER})
 INCLUDE_DIRECTORIES(${WRT_ENGINE_INCLUDE_DIRS})
 
 ADD_LIBRARY(${TARGET_WRT_ENGINE_STATIC} STATIC
-    ${WRT_ENGINE_SOURCES}
+    ${WRT_CORE_BASE_SOURCES}
 )
 
 SET_TARGET_PROPERTIES(${TARGET_WRT_ENGINE_STATIC} PROPERTIES
index bc9beb6..ebf122f 100644 (file)
@@ -16,6 +16,7 @@
 ADD_LIBRARY(${TARGET_CORE_MODULE_LIB} SHARED
     ${PROJECT_SOURCE_DIR}/src/api_new/core_module.cpp
     ${PROJECT_SOURCE_DIR}/src/api_new/runnable_widget_object.cpp
+    ${PROJECT_SOURCE_DIR}/src/api_new/runnable_widget_object_state.cpp
 )
 
 SET_TARGET_PROPERTIES(${TARGET_CORE_MODULE_LIB} PROPERTIES
@@ -28,6 +29,7 @@ PKG_CHECK_MODULES(CORE_MODULE_DEP
     ewebkit2
     wrt-plugin-js-overlay
     dpl-efl
+    security-wrt-ocsp
     REQUIRED
 )
 
index be65560..cdf482d 100644 (file)
@@ -31,7 +31,6 @@
 #include <dpl/exception.h>
 #include <dpl/popup/popup_controller.h>
 #include <dpl/singleton_impl.h>
-#include <libxml/parser.h>
 #include "localization_setting.h"
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <profiling_util.h>
@@ -124,27 +123,6 @@ public:
             }
             Try
             {
-                GlobalContext::TouchArchitecture();
-
-                ADD_PROFILING_POINT("attach databases", "start");
-                MainThreadSingleton::Instance().AttachDatabases();
-                ADD_PROFILING_POINT("attach databases", "stop");
-
-                ADD_PROFILING_POINT("xml_parser_init", "start");
-                xmlInitParser();
-                ADD_PROFILING_POINT("xml_parser_init", "stop");
-
-                // Initialize popup manager
-                ADD_PROFILING_POINT("popup_manager_init", "start");
-                DPL::Popup::PopupManagerSingleton::Instance().Initialize(
-                    DPL::Popup::PopupRendererPtr(new DPL::Popup::PopupRenderer));
-                ADD_PROFILING_POINT("popup_manager_init", "stop");
-
-                // Initialize Language Subtag registry
-                ADD_PROFILING_POINT("language_rst_init", "start");
-                LocalizationSetting::SetLocalization();
-                ADD_PROFILING_POINT("language_rst_init", "stop");
-
 
                 // Needed settings for WKContext are located here
                 // create Ewk_Context
@@ -159,6 +137,23 @@ public:
                                             EWK_CACHE_MODEL_PRIMARY_WEBBROWSER);
                 m_ewkContext = newEwkContext;
 
+                // To fork a Webprocess as soon as possible,
+                // the following ewk_api is called explicitly.
+                ewk_context_cookies_policy_set(m_ewkContext,
+                                               EWK_COOKIE_JAR_ACCEPT_ALWAYS);
+
+                GlobalContext::TouchArchitecture();
+
+                ADD_PROFILING_POINT("attach databases", "start");
+                MainThreadSingleton::Instance().AttachDatabases();
+                ADD_PROFILING_POINT("attach databases", "stop");
+
+                // Initialize popup manager
+                ADD_PROFILING_POINT("popup_manager_init", "start");
+                DPL::Popup::PopupManagerSingleton::Instance().Initialize(
+                    DPL::Popup::PopupRendererPtr(new DPL::Popup::PopupRenderer));
+                ADD_PROFILING_POINT("popup_manager_init", "stop");
+
                 LogDebug("Initialize finished");
             } catch (const DPL::Exception& ex) {
                 LogError("Internal Error during screen preparation:");
@@ -185,19 +180,23 @@ public:
         // Deinitialize popup manager
         DPL::Popup::PopupManagerSingleton::Instance().Deinitialize();
 
-        LogInfo("Cleanup libxml2 global values.");
-        xmlCleanupParser();
         m_initialized = false;
     }
 
-    RunnableWidgetObjectPtr getRunnableWidgetObject(const WidgetHandle& handle)
+    RunnableWidgetObjectPtr getRunnableWidgetObject(
+            const std::string& tizenId)
     {
-        RunnableWidgetObjectPtr runnable;
-        WidgetModelPtr model = Domain::deserializeWidgetModel(handle);
-        if (!!model) {
-            runnable.reset(new RunnableWidgetObject(model, m_ewkContext));
+        try {
+            RunnableWidgetObjectPtr runnable;
+            WidgetModelPtr model = Domain::deserializeWidgetModel(tizenId);
+            if (!!model) {
+                runnable.reset(new RunnableWidgetObject(model, m_ewkContext));
+            }
+            return runnable;
+        } catch (WrtDB::WidgetDAOReadOnly::Exception::WidgetNotExist) {
+            LogDebug("Widget not found.");
+            return RunnableWidgetObjectPtr();
         }
-        return runnable;
     }
 
 private:
@@ -223,21 +222,10 @@ void CoreModule::Terminate()
     return m_impl->Terminate();
 }
 
-RunnableWidgetObjectPtr CoreModule::getRunnableWidgetObject(const WidgetHandle& handle)
+RunnableWidgetObjectPtr CoreModule::getRunnableWidgetObject(
+        const std::string& tizenId)
 {
-    return m_impl->getRunnableWidgetObject(handle);
-}
-
-RunnableWidgetObjectPtr CoreModule::getRunnableWidgetObject(const std::string& packageName)
-{
-    DPL::OptionalString pkgName(DPL::FromUTF8String(packageName));
-    try {
-        return m_impl->getRunnableWidgetObject(
-                WrtDB::WidgetDAOReadOnly::getHandle(*pkgName));
-    } catch (WrtDB::WidgetDAOReadOnly::Exception::WidgetNotExist) {
-        LogDebug("Widget not found.");
-        return RunnableWidgetObjectPtr();
-    }
+    return m_impl->getRunnableWidgetObject(tizenId);
 }
 
 } /* namespace WRT */
index 28fd94f..fae27a9 100644 (file)
@@ -49,22 +49,14 @@ class CoreModule
      */
     void Terminate();
     /**
-     * Create model with given widget handle.
+     * Create model with given package name.
      * Init must be called earlier. You MUST destroy all
      * RunnableWidgetObjectPtr before calling Terminate.
-     * @param handle
-     * @return NULL on fail
-     */
-    RunnableWidgetObjectPtr getRunnableWidgetObject(
-            const WidgetHandle& handle);
-    /**
-     * Create model with given package name.
-     * Init must be called earlier.
      * @param packageName
      * @return NULL on fail
      */
     RunnableWidgetObjectPtr getRunnableWidgetObject(
-            const std::string& packageName);
+            const std::string& tizenId);
   private:
     CoreModule();
     ~CoreModule();
index 1b1f0df..26dd362 100644 (file)
@@ -14,7 +14,7 @@
  *    limitations under the License.
  */
 /**
- * @file    core_module.cpp
+ * @file    i_runnable_widget_object.h
  * @author  Przemyslaw Ciezkowski (p.ciezkowski@samsung.com)
  * @version 1.0
  * @brief   File contains declaration of IRunnableWidgetObject interface.
 #define RUNNABLE_WIDGET_OBJECT_INTERFACE_H_
 
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
+#include <dpl/fast_delegate.h>
 #include <memory>
 #include <Evas.h>
 #include <widget_model.h>
 
+#include <dpl/exception.h>
+
 namespace WRT {
 
-typedef struct UserCallbacks {
-    void (*progressFinish)(void *data);
-    void (*loadFinish)(bool success, void *data);
-    void (*webCrash)(void *data);
-    void (*windowClose)(void *data);
-    void (*resume)(bool success, void *data);
-    void (*suspend)(bool success, void *data);
-    void (*reset)(bool success, void *data);
-    void (*bufferUnset)(Evas_Object* currentBuffer, void *data);
-    void (*bufferSet)(Evas_Object* newBuffer, void *data);
+typedef DPL::FastDelegate0<void> ProgressFinishCB;
+typedef DPL::FastDelegate1<bool, void> LoadFinishCB;
+typedef DPL::FastDelegate0<void> WebCrashCB;
+typedef DPL::FastDelegate0<void> WindowCloseCB;
+typedef DPL::FastDelegate1<bool, void> ResumeCB;
+typedef DPL::FastDelegate1<bool, void> SuspendCB;
+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 struct UserDelegates {
+    ProgressFinishCB progressFinish;
+    LoadFinishCB loadFinish;
+    WebCrashCB webCrash;
+    WindowCloseCB windowClose;
+    ResumeCB resume;
+    SuspendCB suspend;
+    ResetCB reset;
+    BufferUnsetCB bufferUnset;
+    BufferSetCB bufferSet;
+    ToggleFullscreenCB toggleFullscreen;
+} UserDelegates;
 
-    UserCallbacks():
-            progressFinish(NULL),
-            loadFinish(NULL),
-            windowClose(NULL),
-            resume(NULL),
-            suspend(NULL),
-            reset(NULL),
-            bufferUnset(NULL),
-            bufferSet(NULL)  {}
-} UserCallbacks;
-typedef std::shared_ptr<UserCallbacks> UserCallbacksPtr;
+typedef std::shared_ptr<UserDelegates> UserDelegatesPtr;
 typedef std::shared_ptr<WidgetModel> WidgetModelPtr;
 
+/**
+ * @brief The IRunnableWidgetObject class Runnable object interface
+ *
+ * Interface for managing WRT widgets runnable object.
+ * Methods should be called in approopriatte order. Check graph below.
+ *
+ *    /----------->(INITIAL)
+ *    |                |
+ *    |                | PrepareView()
+ *    |                V
+ *    |            (PREPARED)
+ *    |                |
+ *    | Reset()        | CheckBeforeLaunch()
+ *    |                V
+ *    |           (SECCHECKED)
+ *    |                |
+ *    |                | Show()
+ *    |                V
+ *    |             (SHOWED)
+ *    |               /  ^
+ *    |     Suspend() |  | Resume()
+ *    |               V  /
+ *    |            (SUSPENDED)
+ *    |
+ *    |
+ *    |     (any state besides INITIAL)
+ *    |                |
+ *    |                | Hide()
+ *    |                V
+ *    \-------------(HIDDEN)
+ *
+ */
 class IRunnableWidgetObject {
 public:
+    // IRunnableWidgetObject base exception
+    DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
+
+    // Throwed by any method if it is called in wrong state
+    DECLARE_EXCEPTION_TYPE(Base, MethodInvocationForbidden)
+
     /**
      * Runs OCSPCheck
      * @return false when widget is already running or
@@ -95,11 +139,6 @@ public:
      */
     virtual void Reset() = 0;
     /**
-     * Retrieve widget's model
-     * @return WidgetModelPtr
-     */
-    virtual WidgetModelPtr GetModel() = 0;
-    /**
      * Reload start page on widget.
      */
     virtual void ReloadStartPage() = 0;
@@ -109,13 +148,16 @@ public:
      */
     virtual Evas_Object* GetCurrentWebview() = 0;
     /**
-     * Register widget's callbacks
+     * Register widget's delegates
      */
-    virtual void SetUserCallbacks(UserCallbacksPtr cbs, void *data) = 0;
-    /*
+    virtual void SetUserDelegates(const UserDelegatesPtr& cbs) = 0;
+    /**
      * Call goBack() on webkit
      */
-    virtual void GoBack() = 0;
+    virtual void Backward() = 0;
+    virtual void Reload() = 0;
+    virtual void Forward() = 0;
+
     virtual ~IRunnableWidgetObject() {};
 };
 
index cf7df6b..51749b9 100644 (file)
 #include <privilege-control.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 #include "global_logic.h"
-#include <dpl/dbus/dbus_client.h>
-#include "security_daemon_dbus_config.h"
-#include "ocsp_server_api.h"
-#include <vcore/VerificationStatus.h>
 #include <dpl/utils/wrt_global_settings.h>
 #include <dpl/popup/popup_controller.h>
 #include <appcore-common.h>
@@ -35,6 +31,8 @@
 #include <signal.h>
 #include "webkit/bundles/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>
 
 namespace { //Anonymous
 
@@ -81,57 +79,55 @@ namespace WRT {
 
 RunnableWidgetObject::RunnableWidgetObject(WidgetModelPtr &model, Ewk_Context* context) :
         m_widgetModel(model),
-        m_ewkContext(context) {
+        m_view(ViewModule::createView()),
+        m_ewkContext(context)
+{
+    //set initial state of runnable object
+    m_guardstate = std::shared_ptr<State::RunnableWidgetObjectState>(new State::InitialState(*this));
     // If current uid is 'root', change privilege to apps
     if (UID_ROOT == getuid()) {
-        // Set privilege by pkgname
+        // Set privilege by tizen id
         // this code prevent that widget launch with "root" permission,
         // when developers launch by command in the shell
-        set_privilege(DPL::ToUTF8String(m_widgetModel->PkgName.Get()).c_str());
+        set_privilege(DPL::ToUTF8String(m_widgetModel->TizenId.Get()).c_str());
     }
 }
 
 bool RunnableWidgetObject::CheckBeforeLaunch()
 {
+    State::StateChange change = m_guardstate->allowCheckBeforeLaunch();
     Assert(m_widgetModel);
-    #ifdef WRT_SMACK_ENABLED
-        // TODO - this should be in the very first line of the process's main()
-        // for security reasons; but for now it is easier to place here because
-        // here the pkg name is already known; we don't struggle to move it
-        // near the start of main() because we don't know yet if this will
-        // stay in this process at all: it may be moved to AUL altogether
-        set_process_config(DPL::ToUTF8String(widgetModel->PkgName.Get()).c_str());
-    #endif
-
-    if (m_widgetModel->StartURL.Get().IsNull()) {
-        LogWarning("Widget is invalid in currently selected locales");
-        return false;
-    }
+
+#ifdef WRT_SMACK_ENABLED
+    // TODO - this should be in the very first line of the process's main()
+    // for security reasons; but for now it is easier to place here because
+    // here the pkg name is already known; we don't struggle to move it
+    // near the start of main() because we don't know yet if this will
+    // stay in this process at all: it may be moved to AUL altogether
+    set_process_config(DPL::ToUTF8String(widgetModel->TizenId.Get()).c_str());
+#endif
 
     // Inform view controller about new widget model displaying
     ADD_PROFILING_POINT("OCSPCheck", "start");
 
-    ValidationCore::WidgetVerificationStatus response;
+    wrt_ocsp_widget_verification_status_t response;
     if (m_widgetModel->Type.Get().appType == WrtDB::APP_TYPE_WAC20) {
-        DPL::DBus::Client dbusClient(
-                        WrtSecurity::SecurityDaemonConfig::OBJECT_PATH(),
-                        WrtSecurity::SecurityDaemonConfig::SERVICE_NAME(),
-                        WrtSecurity::OcspServerApi::INTERFACE_NAME());
-        int intResponse;
-        dbusClient.call(WrtSecurity::OcspServerApi::CHECK_ACCESS_METHOD(),
-                        m_widgetModel->Handle.Get(),
-                        &intResponse);
-        response = static_cast<ValidationCore::WidgetVerificationStatus>(
-                intResponse);
+
+        wrt_ocsp_initialize();
+        wrt_ocsp_verify_widget(m_widgetModel->Handle.Get(), &response);
+        wrt_ocsp_shutdown();
+
     } else {
-        response = ValidationCore::WIDGET_VERIFICATION_STATUS_GOOD;
+        response = WRT_OCSP_WIDGET_VERIFICATION_STATUS_GOOD;
     }
     ADD_PROFILING_POINT("OCSPCheck", "stop");
 
-    if (response == ValidationCore::WIDGET_VERIFICATION_STATUS_GOOD) {
+    LogDebug("WRT OCSP response " << static_cast<int>(response));
+    if (response == WRT_OCSP_WIDGET_VERIFICATION_STATUS_GOOD) {
+        change.commit();
         return true;
     } else {
-        if (!GlobalSettings::TestModeEnabled()) {
+        if (!GlobalSettings::PopupsTestModeEnabled()) {
             popupsDisplayer.displayCertificateRevokedPopup();
         }
         return false;
@@ -141,54 +137,88 @@ bool RunnableWidgetObject::CheckBeforeLaunch()
 void RunnableWidgetObject::PrepareView(const std::string &startUrl,
         Evas_Object *window)
 {
+    State::StateChange change = m_guardstate->allowPrepareView();
     Assert(window);
+
     ADD_PROFILING_POINT("view_logic_init", "start");
-    m_view = ViewModule::getView();
     m_view->createWebView(m_ewkContext, window);
     m_view->initialize();
     m_view->prepareView(m_widgetModel.get(), startUrl);
     ADD_PROFILING_POINT("view_logic_init", "stop");
+
+    change.commit();
 }
 
 void RunnableWidgetObject::Show()
 {
+    State::StateChange change = m_guardstate->allowShow();
+
     m_view->showWidget();
+
+    change.commit();
 }
 
 void RunnableWidgetObject::Hide() {
+    State::StateChange change = m_guardstate->allowHide();
+
     m_view->hideWidget();
+    m_view->destroyWebView();
+
+    change.commit();
 }
 
 void RunnableWidgetObject::Suspend() {
     LogDebug("Suspending widget");
+    State::StateChange change = m_guardstate->allowSuspend();
     Assert(m_widgetModel);
 
-    WrtDB::WidgetDAOReadOnly dao(m_widgetModel->Handle.Get());
-    WrtDB::PropertyDAOReadOnly::WidgetPropertyValue bgEnableValue =
-        dao.getPropertyValue(DPL::String(BACKGROUND_ENABLED));
-    if(!bgEnableValue.IsNull() && !bgEnableValue->compare(L"true")) {
-        LogWarning("Background enabled, skipping suspend");
-        return;
+    bool suspendWebkit = true;
+
+    if( m_widgetModel->SettingList.Get().getBackgroundSupport()
+        == BackgroundSupport_Enable ) {
+        //skip suspendWidget
+        LogDebug("Background enabled, skipping suspend");
+        suspendWebkit = false;
+    }
+#ifndef DEPRECATED_SETTING_STRING
+    else {
+        WrtDB::WidgetDAOReadOnly dao(WrtDB::WidgetDAOReadOnly::getHandle(
+                m_widgetModel->TizenId.Get()));
+        WrtDB::PropertyDAOReadOnly::WidgetPropertyValue bgEnableValue =
+            dao.getPropertyValue(DPL::String(BACKGROUND_ENABLED));
+
+        if(!bgEnableValue.IsNull() && !bgEnableValue->compare(L"true")) {
+            //skip suspendWidget
+            LogDebug("Background enabled, skipping suspend");
+            suspendWebkit = false;
+        }
+    }
+#endif
+
+    if(suspendWebkit) //if widget has background page suspending wk will be skipped
+    {
+        m_view->suspendWidget();
     }
-    m_view->suspendWidget();
+
+    change.commit();
 }
 
 void RunnableWidgetObject::Resume()
 {
     LogDebug("Resuming widget");
+    State::StateChange change = m_guardstate->allowResume();
     m_view->resumeWidget();
+
+    change.commit();
 }
 
 void RunnableWidgetObject::Reset()
 {
     LogDebug("Reseting widget");
+    State::StateChange change = m_guardstate->allowReset();
     m_view->resetWidget();
-}
 
-WidgetModelPtr RunnableWidgetObject::GetModel()
-{
-    Assert(m_widgetModel);
-    return m_widgetModel;
+    change.commit();
 }
 
 void RunnableWidgetObject::ReloadStartPage()
@@ -197,15 +227,45 @@ void RunnableWidgetObject::ReloadStartPage()
 }
 
 Evas_Object* RunnableWidgetObject::GetCurrentWebview() {
-    return m_view->getCurrentWebview();
+    State::StateChange change = m_guardstate->allowGetCurrentWebview();
+
+    Evas_Object* cww = m_view->getCurrentWebview();
+
+    change.commit();
+    return cww;
 }
 
-void RunnableWidgetObject::SetUserCallbacks(UserCallbacksPtr cbs, void *data) {
-    m_view->setUserCallbacks(cbs, data);
+void RunnableWidgetObject::SetUserDelegates(const UserDelegatesPtr& cbs) {
+    State::StateChange change = m_guardstate->allowSetUserDelegates();
+    m_view->setUserCallbacks(cbs);
+    change.commit();
 }
 
-void RunnableWidgetObject::GoBack() {
-    m_view->goBack();
+void RunnableWidgetObject::Backward() {
+    State::StateChange change = m_guardstate->allowBackward();
+    m_view->backward();
+
+    change.commit();
+}
+
+void RunnableWidgetObject::Reload() {
+    State::StateChange change = m_guardstate->allowReload();
+    m_view->reload();
+
+    change.commit();
+}
+
+void RunnableWidgetObject::Forward() {
+    State::StateChange change = m_guardstate->allowForward();
+    m_view->forward();
+
+    change.commit();
+}
+
+void RunnableWidgetObject::setNewState(std::shared_ptr<State::RunnableWidgetObjectState> sptr)
+{
+    LogInfo("RunnableWidgetObject changes state to: " << sptr->toString());
+    m_guardstate = sptr;
 }
 
 RunnableWidgetObject::~RunnableWidgetObject()
index e414173..84ba1e5 100644 (file)
 #ifndef RUNNABLE_WIDGET_OBJECT_H_
 #define RUNNABLE_WIDGET_OBJECT_H_
 
+//forward declaration
+namespace WRT {
+namespace State {
+class RunnableWidgetObjectState;
+class StateChange;
+}
+}
 
 #include <string>
-#include "i_runnable_widget_object.h"
+#include <memory>
+
+#include <common_error.h>
 #include <widget_model.h>
 #include <i_view_module.h>
-#include <string>
-#include <common_error.h>
-#include <ewk_context.h>
+#include "i_runnable_widget_object.h"
+#include <EWebKit2.h>
 
 namespace WRT {
 
@@ -48,19 +56,25 @@ public:
     void Suspend();
     void Resume();
     void Reset();
-    WidgetModelPtr GetModel();
     void ReloadStartPage();
     Evas_Object* GetCurrentWebview();
-    void SetUserCallbacks(UserCallbacksPtr cbs, void *data);
-    void GoBack();
+    void SetUserDelegates(const UserDelegatesPtr& cbs);
+    void Backward();
+    void Reload();
+    void Forward();
+
 private:
+
     bool CheckWACTestCertififedWidget();
-    void LocalizeWidgetModel();
 
     WidgetModelPtr m_widgetModel;
-    void localizeWidgetModel();
     ViewModule::IViewModulePtr m_view;
     Ewk_Context* m_ewkContext;
+    void setNewState(std::shared_ptr<WRT::State::RunnableWidgetObjectState> sptr);
+
+    std::shared_ptr<State::RunnableWidgetObjectState> m_guardstate;
+
+    friend class State::StateChange;
 };
 
 } /* namespace WRT */
diff --git a/src/api_new/runnable_widget_object_state.cpp b/src/api_new/runnable_widget_object_state.cpp
new file mode 100644 (file)
index 0000000..485d020
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ * 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    core_module.cpp
+ * @author  Tomasz Iwanek (t.iwanek@samsung.com)
+ * @version 1.0
+ * @brief   State classes for runnable object
+ */
+
+#include "runnable_widget_object_state.h"
+
+#include <dpl/log/log.h>
+
+#include "runnable_widget_object.h"
+
+namespace WRT {
+namespace State {
+
+const StateChange StateChange::NoChange = StateChange();
+
+StateChange::StateChange()
+{
+}
+
+StateChange::StateChange(RunnableWidgetObjectStatePtr sptr)
+    : m_sptr(sptr)
+{
+}
+
+void StateChange::commit()
+{
+    if(m_sptr)
+    {
+        m_sptr->getObject().setNewState(m_sptr);
+    }
+}
+
+RunnableWidgetObjectState::RunnableWidgetObjectState(RunnableWidgetObject & object)
+    : m_object(object)
+{
+}
+
+RunnableWidgetObjectState::~RunnableWidgetObjectState()
+{
+}
+
+RunnableWidgetObject & RunnableWidgetObjectState::getObject() const
+{
+    return m_object;
+}
+
+StateChange RunnableWidgetObjectState::allowCheckBeforeLaunch()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "CheckBeforeLaunch cannot be called in current state" << toString());
+}
+
+StateChange RunnableWidgetObjectState::allowPrepareView()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "PrepareView cannot be called in current state" << toString());
+}
+
+StateChange RunnableWidgetObjectState::allowShow()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Show cannot be called in current state" << toString());
+}
+
+StateChange RunnableWidgetObjectState::allowHide()
+{
+    return StateChange(RunnableWidgetObjectStatePtr(new HiddenState(m_object)));
+}
+
+StateChange RunnableWidgetObjectState::allowSuspend()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Hide cannot be called in current state" << toString());
+}
+
+StateChange RunnableWidgetObjectState::allowResume()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Resume cannot be called in current state" << toString());
+}
+
+StateChange RunnableWidgetObjectState::allowReset()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Cannot reset in curretn state");
+}
+
+StateChange RunnableWidgetObjectState::allowGetCurrentWebview()
+{
+    return StateChange::NoChange;
+}
+
+StateChange RunnableWidgetObjectState::allowSetUserDelegates()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "SetUserCallbacks cannot be called in current state");
+}
+
+StateChange RunnableWidgetObjectState::allowBackward()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Backward cannot be called in current state ");
+}
+
+StateChange RunnableWidgetObjectState::allowForward()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Foreward cannot be called in current state ");
+}
+
+StateChange RunnableWidgetObjectState::allowReload()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Reload cannot be called in current state ");
+}
+
+InitialState::InitialState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
+{
+}
+
+std::string InitialState::toString() const
+{
+    return "INITIAL";
+}
+
+StateChange InitialState::allowPrepareView()
+{
+    return StateChange(RunnableWidgetObjectStatePtr(new PreparedState(m_object)));
+}
+
+StateChange InitialState::allowHide()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Cannot hide before RunnableWidgetObject initialization");
+}
+
+StateChange InitialState::allowGetCurrentWebview()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Cannot call GetCurrentWebview before RunnableWidgetObject initialization");
+}
+
+PreparedState::PreparedState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
+{
+}
+
+StateChange PreparedState::allowCheckBeforeLaunch()
+{
+    return StateChange(RunnableWidgetObjectStatePtr(new SecurityCheckedState(m_object)));
+}
+
+std::string PreparedState::toString() const
+{
+    return "PREPARED";
+}
+
+SecurityCheckedState::SecurityCheckedState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
+{
+}
+
+std::string SecurityCheckedState::toString() const
+{
+    return "SECURITY_CHECKED";
+}
+
+StateChange SecurityCheckedState::allowShow()
+{
+    return StateChange(RunnableWidgetObjectStatePtr(new ShowedState(m_object)));
+}
+
+StateChange SecurityCheckedState::allowSetUserDelegates()
+{
+    return StateChange::NoChange;
+}
+
+ShowedState::ShowedState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
+{
+}
+
+std::string ShowedState::toString() const
+{
+    return "SHOWED";
+}
+
+StateChange ShowedState::allowSuspend()
+{
+    return StateChange(RunnableWidgetObjectStatePtr(new SuspendedState(m_object)));
+}
+
+StateChange ShowedState::allowBackward()
+{
+    return StateChange::NoChange;
+}
+
+StateChange ShowedState::allowForward()
+{
+    return StateChange::NoChange;
+}
+
+StateChange ShowedState::allowReload()
+{
+    return StateChange::NoChange;
+}
+
+SuspendedState::SuspendedState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
+{
+}
+
+std::string SuspendedState::toString() const
+{
+    return "SUSPENDED";
+}
+
+StateChange SuspendedState::allowResume()
+{
+    return StateChange(RunnableWidgetObjectStatePtr(new ShowedState(m_object)));
+}
+
+HiddenState::HiddenState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
+{
+}
+
+std::string HiddenState::toString() const
+{
+    return "HIDEN";
+}
+
+StateChange HiddenState::allowReset()
+{
+    return StateChange(RunnableWidgetObjectStatePtr(new InitialState(m_object)));
+}
+
+StateChange HiddenState::allowHide()
+{
+    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
+             "Hide cannot be called in current state" << toString());
+}
+
+}
+}
diff --git a/src/api_new/runnable_widget_object_state.h b/src/api_new/runnable_widget_object_state.h
new file mode 100644 (file)
index 0000000..8db860a
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * 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    core_module.cpp
+ * @author  Tomasz Iwanek (t.iwanek@samsung.com)
+ * @version 1.0
+ * @brief   State classes for runnable object
+ */
+#ifndef RUNNABLE_WIDGET_OBJECT_STATE_H
+#define RUNNABLE_WIDGET_OBJECT_STATE_H
+
+//forward declarations
+namespace WRT {
+class RunnableWidgetObject;
+
+namespace State {
+class RunnableWidgetObjectState;
+}
+
+}
+
+#include <dpl/exception.h>
+
+#include <i_runnable_widget_object.h>
+
+namespace WRT {
+namespace State {
+
+typedef std::shared_ptr<RunnableWidgetObjectState> RunnableWidgetObjectStatePtr;
+
+/**
+ * @brief The StateChange class
+ *
+ * RunnableWidgetObject state change abstraction
+ */
+class StateChange
+{
+public:
+    static const StateChange NoChange;
+
+    StateChange();
+    explicit StateChange(RunnableWidgetObjectStatePtr sptr);
+
+    /**
+     * @brief commit actually performs change of state
+     */
+    void commit();
+private:
+    RunnableWidgetObjectStatePtr m_sptr;
+};
+
+/**
+ * @brief The RunnableWidgetObjectState class
+ *
+ * Base class for all runnable object states
+ *
+ * Allow methods should be called if referenced method are actually
+ * going to be called effectively. They return next state object.
+ * Call commit on this object to make change of state of RunnableWidgetObject
+ */
+class RunnableWidgetObjectState
+{
+public:
+    explicit RunnableWidgetObjectState(RunnableWidgetObject & object);
+    virtual ~RunnableWidgetObjectState();
+
+    virtual StateChange allowCheckBeforeLaunch();
+    virtual StateChange allowPrepareView();
+    virtual StateChange allowShow();
+    virtual StateChange allowHide();
+    virtual StateChange allowSuspend();
+    virtual StateChange allowResume();
+    virtual StateChange allowReset();
+    virtual StateChange allowGetCurrentWebview();
+    virtual StateChange allowSetUserDelegates();
+    virtual StateChange allowBackward();
+    virtual StateChange allowForward();
+    virtual StateChange allowReload();
+
+    virtual std::string toString() const = 0;
+    virtual RunnableWidgetObject & getObject() const;
+
+protected:
+    RunnableWidgetObject & m_object;
+};
+
+/**
+ * INITIAL STATE
+ */
+class InitialState : public RunnableWidgetObjectState
+{
+public:
+    explicit InitialState(RunnableWidgetObject & object);
+    std::string toString() const;
+
+    StateChange allowPrepareView();
+    StateChange allowHide();
+    StateChange allowGetCurrentWebview();
+};
+
+/**
+ * PREPARED STATE
+ */
+class PreparedState : public RunnableWidgetObjectState
+{
+public:
+    explicit PreparedState(RunnableWidgetObject & object);
+    std::string toString() const;
+
+    StateChange allowCheckBeforeLaunch();
+};
+
+/**
+ * SECURITY CHECKED STATE
+ */
+class SecurityCheckedState : public RunnableWidgetObjectState
+{
+public:
+    explicit SecurityCheckedState(RunnableWidgetObject & object);
+    std::string toString() const;
+
+    StateChange allowShow();
+    StateChange allowSetUserDelegates();
+};
+
+/**
+ * SHOWED STATE
+ */
+class ShowedState : public RunnableWidgetObjectState
+{
+public:
+    explicit ShowedState(RunnableWidgetObject & object);
+    std::string toString() const;
+
+    StateChange allowSuspend();
+    StateChange allowBackward();
+    StateChange allowForward();
+    StateChange allowReload();
+};
+
+/**
+ * SUSPENDED STATE
+ */
+class SuspendedState : public RunnableWidgetObjectState
+{
+public:
+    explicit SuspendedState(RunnableWidgetObject & object);
+    std::string toString() const;
+
+    StateChange allowResume();
+};
+
+/**
+ * HIDDEN STATE
+ */
+class HiddenState : public RunnableWidgetObjectState
+{
+public:
+    explicit HiddenState(RunnableWidgetObject & object);
+    std::string toString() const;
+
+    StateChange allowHide();
+    StateChange allowReset();
+};
+
+}
+}
+
+#endif // RUNNABLE_WIDGET_OBJECT_STATE_H
index 8b1cf86..82e0edb 100644 (file)
 #include "localization_setting.h"
 #include <dpl/log/log.h>
 
-#include <vconf.h>
 #include <appcore-efl.h>
-#include <dpl/localization/localization_utils.h>
-
-using namespace LocalizationUtils;
 
 namespace LocalizationSetting{
 
-void SetLocalization()
-{
-    char* lang = vconf_get_str(VCONFKEY_LANGSET);
-    if (!lang) {
-        LogError("Cannot get locale settings from vconf");
-    }
-
-    LanguageTagsList list;
-    list.push_back(DPL::FromUTF8String(lang));
-    LocalizationUtils::SetSystemLanguageTags(list);
-
-    LogDebug("Language set to: " << lang);
-}
-
 void SetLanguageChangedCallback(LanguageChangedCallback cb, void *data)
 {
     LogDebug("Set language changed callback");
index a5bd0a6..7f5dc34 100644 (file)
@@ -26,7 +26,6 @@ namespace LocalizationSetting {
 
 typedef int (*LanguageChangedCallback)(void *data);
 
-void SetLocalization();
 void SetLanguageChangedCallback(LanguageChangedCallback cb, void *data);
 
 } //LocalizationSetting
index 36274b2..9367b92 100644 (file)
@@ -24,7 +24,9 @@
 #include <dpl/wrt-dao-ro/WrtDatabase.h>
 #include <ace_api_client.h>
 #include <wrt-commons/auto-save-dao-rw/auto_save_dao.h>
+#include <dpl/wrt-dao-ro/WrtDatabase.h>
 #include <dpl/singleton_impl.h>
+#include <popup-runner/popup-runner.h>
 IMPLEMENT_SINGLETON(MainThread)
 
 using namespace WrtDB;
@@ -43,9 +45,9 @@ void MainThread::AttachDatabases()
 {
     Assert(!m_attached);
     // Attach databases
-    ace_return_t ret = ace_client_initialize(NULL);
-    // Assert(ACE_OK == ret); // this is commented because right
-    // now UI handlers are not implemented
+    ace_return_t ret = ace_client_initialize(Wrt::Popup::run_popup);
+    Assert(ACE_OK == ret);
+    WrtDB::WrtDatabase::attachToThreadRO();
     AutoSaveDB::AutoSaveDAO::attachDatabaseRW();
     m_attached = true;
 }
index fc56231..eca38c4 100644 (file)
@@ -96,7 +96,8 @@ WidgetSettingList::WidgetSettingList() :
     m_IndicatorPresence(Indicator_Enable),
     m_BackButtonPresence(BackButton_Disable),
     m_ContextMenu(ContextMenu_Enable),
-    m_Encryption(Encryption_Disable)
+    m_Encryption(Encryption_Disable),
+    m_BackgroundSupport(BackgroundSupport_Disable)
 {
 }
 
@@ -107,6 +108,7 @@ WidgetSettingList::WidgetSettingList(WidgetSettings &widgetSettings)
     m_BackButtonPresence = BackButton_Disable;
     m_ContextMenu = ContextMenu_Enable;
     m_Encryption = Encryption_Disable;
+    m_BackgroundSupport = BackgroundSupport_Disable;
 
     FOREACH(it, widgetSettings)
     {
@@ -146,11 +148,14 @@ WidgetSettingList::WidgetSettingList(WidgetSettings &widgetSettings)
                     value << "]");
                 m_BackButtonPresence = BackButton_Disable;
             }
-        } else if (name == SETTING_NAME_CONTEXTMENU) {
-            if (value == SETTING_VALUE_CONTEXTMENU_ENALBE) {
+        } else if ( name == SETTING_NAME_CONTEXT_MENU
+#ifndef DEPRECATED_SETTING_STRING
+                    || name == SETTING_NAME_CONTEXTMENU
+#endif
+                  ) {
+            if (value == SETTING_VALUE_ENABLE) {
                 m_ContextMenu = ContextMenu_Enable;
-            } else if (value ==
-                            SETTING_VALUE_CONTEXTMENU_DISABLE) {
+            } else if (value == SETTING_VALUE_DISABLE) {
                 m_ContextMenu = ContextMenu_Disable;
             } else {
                 LogError("Invalid contextmenu value!! [" <<
@@ -168,7 +173,18 @@ WidgetSettingList::WidgetSettingList(WidgetSettings &widgetSettings)
                     value << "]");
                 m_Encryption = Encryption_Disable;
             }
-        } else {
+        } else if (name == SETTING_NAME_BACKGROUND_SUPPORT) {
+            if (value == SETTING_VALUE_ENABLE) {
+                m_BackgroundSupport = BackgroundSupport_Enable;
+            } else if (value == SETTING_VALUE_DISABLE) {
+                m_BackgroundSupport = BackgroundSupport_Disable;
+            } else {
+                LogError("Invalid background-support value!! [" <<
+                    value << "]");
+                m_BackgroundSupport = BackgroundSupport_Enable;
+            }
+        }
+        else {
             LogError("Invalid setting name!! [" << name << "]");
         }
     }
@@ -177,6 +193,7 @@ WidgetSettingList::WidgetSettingList(WidgetSettings &widgetSettings)
     LogDebug("m_BackButtonPresence: " << m_BackButtonPresence);
     LogDebug("m_ContextMenu: " << m_ContextMenu);
     LogDebug("m_Encryption: " << m_Encryption);
+    LogDebug("m_BackgroundSupport: " << m_BackgroundSupport);
 }
 
 WidgetSettingScreenLock WidgetSettingList::getRotationValue() const
@@ -204,6 +221,11 @@ WidgetSettingEncryption WidgetSettingList::getEncryption() const
     return m_Encryption;
 }
 
+WidgetSettingBackgroundSupport WidgetSettingList::getBackgroundSupport() const
+{
+    return m_BackgroundSupport;
+}
+
 bool WidgetSettingList::isEncrypted() const
 {
     if (m_Encryption == Encryption_Enable) {
@@ -218,5 +240,6 @@ bool WidgetSettingList::operator ==(const WidgetSettingList& other) const
         m_IndicatorPresence == other.m_IndicatorPresence &&
         m_BackButtonPresence == other.m_BackButtonPresence &&
         m_ContextMenu == other.m_ContextMenu &&
-        m_Encryption == other.m_Encryption;
+        m_Encryption == other.m_Encryption &&
+        m_BackgroundSupport == other.m_BackgroundSupport;
 }
index 99301a6..2a1d1b6 100644 (file)
@@ -129,8 +129,18 @@ static const DPL::String SETTING_NAME_INDICATOR_PRESENCE =
     L"indicator-presence";
 static const DPL::String SETTING_NAME_BACKBUTTON_PRESENCE =
     L"backbutton-presence";
+#ifndef DEPRECATED_SETTING_STRING
 static const DPL::String SETTING_NAME_CONTEXTMENU =
     L"contextmenu";
+#endif
+static const DPL::String SETTING_NAME_CONTEXT_MENU =
+    L"context-menu";
+static const DPL::String SETTING_NAME_BACKGROUND_SUPPORT =
+    L"background-support";
+static const DPL::String SETTING_VALUE_ENABLE =
+    L"enable";
+static const DPL::String SETTING_VALUE_DISABLE =
+    L"disable";
 static const DPL::String SETTING_NAME_ENCRYPTION=
     L"encryption";
 static const DPL::String SETTING_VALUE_SCREEN_ORIENTATION_PORTRAIT =
@@ -145,10 +155,6 @@ static const DPL::String SETTING_VALUE_BACKBUTTON_PRESENCE_ENALBE =
     L"enable";
 static const DPL::String SETTING_VALUE_BACKBUTTON_PRESENCE_DISABLE =
     L"disable";
-static const DPL::String SETTING_VALUE_CONTEXTMENU_ENALBE =
-    L"enable";
-static const DPL::String SETTING_VALUE_CONTEXTMENU_DISABLE =
-    L"disable";
 static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE =
     L"enable";
 static const DPL::String SETTING_VALUE_ENCRYPTION_DISABLE =
@@ -184,6 +190,12 @@ enum WidgetSettingEncryption
     Encryption_Disable     /* Default */
 };
 
+enum WidgetSettingBackgroundSupport
+{
+    BackgroundSupport_Enable,
+    BackgroundSupport_Disable    /* Default */
+};
+
 class WidgetSettingList
 {
   public:
@@ -201,15 +213,19 @@ class WidgetSettingList
 
     WidgetSettingEncryption getEncryption() const;
 
+    WidgetSettingBackgroundSupport getBackgroundSupport() const;
+
     bool isEncrypted() const;
 
     bool operator ==(const WidgetSettingList& other) const;
+
   private:
     WidgetSettingScreenLock m_RotationLock;
     WidgetSettingIndicatorPresence m_IndicatorPresence;
     WidgetSettingBackButtonPresence m_BackButtonPresence;
     WidgetSettingContextMenu m_ContextMenu;
     WidgetSettingEncryption m_Encryption;
+    WidgetSettingBackgroundSupport m_BackgroundSupport;
 };
 
 #endif /* WRT_SRC_DOMAIN_WIDGET_DATA_TYPES_H_ */
index b1bee7a..973f272 100644 (file)
  */
 
 #include "widget_localize_model.h"
+#include "widget_model.h"
 
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <dpl/log/log.h>
 
 namespace Domain {
 
-std::shared_ptr<WidgetModel> deserializeWidgetModel(WidgetHandle widgetHandle)
+std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId)
 {
     std::shared_ptr<WidgetModel> model;
-    if (WrtDB::WidgetDAOReadOnly::isWidgetInstalled(widgetHandle)) {
+    DPL::String dplTizenId(DPL::FromUTF8String(tizenId));
+    if (WrtDB::WidgetDAOReadOnly::isWidgetInstalled(dplTizenId)) {
         LogDebug("Widget installed - creating model");
-        model.reset(new WidgetModel(widgetHandle));
+        model.reset(new WidgetModel(tizenId));
 
         // Read DAO data
-        WrtDB::WidgetDAOReadOnly dao(widgetHandle);
+        WrtDB::WidgetDAOReadOnly dao(
+                WrtDB::WidgetDAOReadOnly::getHandle(dplTizenId));
 
         // Set localized data
-        Domain::localizeWidgetModel(model);
+        Domain::localizeWidgetModel(model->defaultlocale.Get());
 
         WrtDB::WidgetAccessInfoList widgetAccessInfoList;
         // widgetAccessInfoList is output parameter
index b97fb36..83eb41f 100644 (file)
@@ -23,7 +23,7 @@
 #define WRT_ENGINE_SRC_DOMAIN_WIDGET_DESERIALIZE_MODEL_H_
 
 #include <memory>
-
+#include <string>
 #include <widget_model.h>
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
 
@@ -31,11 +31,10 @@ namespace Domain {
 
 /**
  * @brief Creates widget model associated with selected
- * @param[in] widgetHandle
+ * @param[in] tizenId
  * @retval WidgetModel
- * WidgetHandle
  */
-std::shared_ptr<WidgetModel> deserializeWidgetModel(WidgetHandle widgetHandle);
+std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId);
 
 } //Namespace Domain
 
index b7fd4a5..241e626 100644 (file)
  * @brief   Widget localize localizes WidgetModel from system configuration
  */
 
-#include <algorithm>
-
 #include <dpl/foreach.h>
 #include <dpl/log/log.h>
-
-#include <widget_model.h>
-#include <dpl/localization/w3c_file_localization.h>
-#include <dpl/localization/localization_utils.h>
+#include <dpl/optional_typedefs.h>
+#include <dpl/localization/LanguageTagsProvider.h>
 
 namespace Domain {
 
-void localizeWidgetModel(const std::shared_ptr<WidgetModel>& model)
+//TODO this should be moved and renamed in LanguageTagsProviderSingleton
+void localizeWidgetModel(const DPL::OptionalString& defaultLocale)
 {
-    using namespace WrtDB;
-
-    LogDebug("Updating model with localized info ...");
-    LanguageTagsList tags = LocalizationUtils::GetUserAgentLanguageTags();
-    DPL::OptionalString defaultlocale = model->defaultlocale.Get();
-    LogDebug("Default locale for widget: " << defaultlocale);
-    if (!!defaultlocale &&
-        std::find(tags.begin(), tags.end(), *defaultlocale) == tags.end())
+    LogDebug("Default locale for widget: " << defaultLocale);
+    LanguageTags tags = LanguageTagsProviderSingleton::Instance().getLanguageTags();
+    if (!!defaultLocale &&
+        std::find(tags.begin(), tags.end(), *defaultLocale) == tags.end())
     {
         if (tags.size() < 2) {
-            tags.push_front(*defaultlocale);
+            tags.push_front(*defaultLocale);
         } else {
-            LanguageTagsList::iterator placeToInsert = tags.end();
+            LanguageTags::iterator placeToInsert = tags.end();
             --placeToInsert;
             if (*placeToInsert != L"") { ++placeToInsert; }
-            tags.insert(placeToInsert, *defaultlocale);
+            tags.insert(placeToInsert, *defaultLocale);
         }
     }
     LogDebug("Setting runtime widget locale:");
     FOREACH(it, tags) {
         LogDebug("Locale: " << *it);
     }
-    model->LanguageTags.Set(tags);
-
-    WidgetLocalizedInfo localizedInfo =
-        W3CFileLocalization::getLocalizedInfo(model->Handle.Get());
-
-    model->Name.Set(localizedInfo.name);
-    model->ShortName.Set(localizedInfo.shortName);
-    model->Description.Set(localizedInfo.description);
-    model->License.Set(localizedInfo.license);
-    model->LicenseHref.Set(localizedInfo.licenseHref);
-    model->StartURL.Set(W3CFileLocalization::getStartFile(model->Handle.Get()));
-    model->Icon.Set(W3CFileLocalization::getIcon(model->Handle.Get()));
-    LogDebug("... finished");
-    OptionalWidgetStartFileInfo info =
-        W3CFileLocalization::getStartFileInfo(
-            model->Handle.Get(),
-            model->LanguageTags.Get());
-    model->StartFileInfo.Set(info);
+    LanguageTagsProviderSingleton::Instance().setLanguageTags(tags);
 }
 
 } //Namespace Domain
index 8f13582..78e43fe 100644 (file)
@@ -22,9 +22,7 @@
 #ifndef WRT_ENGINE_SRC_DOMAIN_WIDGET_LOCALIZE_MODEL_H_
 #define WRT_ENGINE_SRC_DOMAIN_WIDGET_LOCALIZE_MODEL_H_
 
-#include <memory>
-
-#include <widget_model.h>
+#include <dpl/optional_typedefs.h>
 
 namespace Domain {
 
@@ -37,7 +35,7 @@ namespace Domain {
  *
  * @param[in] model
  */
-void localizeWidgetModel(const std::shared_ptr<WidgetModel>& model);
+void localizeWidgetModel(const DPL::OptionalString& defaultLocale);
 
 } //Namespace Domain
 
index dbc4ea6..4b4158d 100644 (file)
@@ -51,8 +51,8 @@ struct BindToWidgetDAOStatic :
 {
 };
 
-WidgetModel::WidgetModel(const WidgetHandle &handle) :
-    Handle(this, handle),
+WidgetModel::WidgetModel(const std::string &tizenId) :
+    Handle(this, WidgetDAOReadOnly::getHandle(DPL::FromASCIIString(tizenId))),
     Type(this, &BindToWidgetDAO<WidgetType,
          &WidgetDAOReadOnly::getWidgetType>::Get),
     ActualSize(this),
@@ -70,12 +70,13 @@ WidgetModel::WidgetModel(const WidgetHandle &handle) :
     PersistentStoragePath(this,
                           DPL::FromUTF8String(
                               WidgetConfig::GetWidgetPersistentStoragePath(
-                                  readPkgName(this)))
+                                  readTizenId(this)))
                           ),
+    // use of multiple widget model
     TemporaryStoragePath(this,
                          DPL::FromUTF8String(
                              WidgetConfig::GetWidgetTemporaryStoragePath(
-                                 readPkgName(this)))
+                                 readTizenId(this) + getTimestamp()))
                          ),
     GUID(
         this,
@@ -96,29 +97,15 @@ WidgetModel::WidgetModel(const WidgetHandle &handle) :
     LicenseHref(this),
     //localized, so not binded
     Icon(this),
-    //localized, so not binded
-    RunningName(this),
-    //localized, so not binded
-    RunningIcon(this),
-    //localized, so not binded
-    RunningStartURL(this),
-    //localized, so not binded
-    RunningShortName(this),
-    //localized, so not binded
-    RunningDescription(this),
-    //localized, so not binded
-    RunningLicense(this),
-    //localized, so not binded
-    RunningLicenseHref(this),
-    //localized, so not binded
-    RunningStartFileInfo(this),
-    //localized, so not binded
+    SplashImg(
+        this,
+        &BindToWidgetDAO<DPL::OptionalString,
+                         &WidgetDAOReadOnly::getSplashImgSrc>::Get),
     WindowModes(
         this,
         &BindToWidgetDAO<WindowModeList,
                          &WidgetDAOReadOnly::getWindowModes>::Get),
-    PkgName(this, &WidgetModel::readPkgName),
-    LanguageTags(this),
+    TizenId(this, &WidgetModel::readTizenId),
     //localized, so not binded
     Standard(this, &WidgetModel::readStandard),
     ApplicationStorage(this, &WidgetModel::getApplicationStorage),
@@ -204,15 +191,15 @@ WidgetStorageSize WidgetModel::getApplicationStorage(DPL::Event::Model *model)
     return WidgetStorageSize(appSize, persistanceSize + temporarySize);
 }
 
-DPL::String WidgetModel::readPkgName(DPL::Event::Model *model)
+DPL::String WidgetModel::readTizenId(DPL::Event::Model *model)
 {
     WidgetModel *widgetModel = static_cast<WidgetModel *>(model);
-    DPL::OptionalString pkgName =
+    DPL::OptionalString tizenId =
         WidgetDAOReadOnly(widgetModel->Handle.Get()).getPkgname();
 
-    Assert(!!pkgName && "pkg name shouldn't be NULL");
-    DPL::String name = *pkgName;
-    return name;
+    Assert(!!tizenId && "tizen id shouldn't be NULL");
+    DPL::String id = *tizenId;
+    return id;
 }
 
 namespace { //anonymous
@@ -257,3 +244,14 @@ OptionalWidgetVersion WidgetModel::readVersion(DPL::Event::Model *model)
     }
 }
 
+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 a768086..d0f4f82 100644 (file)
@@ -25,6 +25,7 @@
 #include <dpl/event/model.h>
 #include <dpl/event/property.h>
 #include <dpl/optional.h>
+#include <string>
 
 #include "widget_data_types.h"
 
@@ -166,44 +167,11 @@ class WidgetModel : public DPL::Event::Model
     DPL::Event::Property<OptionalWidgetIcon> Icon;
 
     /**
-     * @brief Widget name if running
+     * @brief Widget splash image src
      */
-    DPL::Event::Property<DPL::OptionalString> RunningName;
-
-    /**
-     * @brief Widget icon if running
-     */
-    DPL::Event::Property<OptionalWidgetIcon> RunningIcon;
-
-    /**
-     * @brief Start URL for widget if running
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningStartURL;
-
-    /**
-     * @brief Widget short name  for widget if running
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningShortName;
-
-    /**
-     * @brief Widget description for widget if running
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningDescription;
-
-    /**
-     * @brief Widget license
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningLicense;
-
-    /**
-     * @brief Widget license href
-     */
-    DPL::Event::Property<DPL::OptionalString> RunningLicenseHref;
-
-    /**
-     * @brief Start URL information for widget
-     */
-    DPL::Event::Property<OptionalWidgetStartFileInfo> RunningStartFileInfo;
+    DPL::Event::Property<DPL::OptionalString,
+                  DPL::Event::PropertyReadOnly,
+                  DPL::Event::PropertyStorageDynamicCached> SplashImg;
 
     /**
      * @brief window mode
@@ -217,12 +185,7 @@ class WidgetModel : public DPL::Event::Model
      */
     DPL::Event::Property<DPL::String,
                   DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> PkgName;
-
-    /**
-     * @brief Current widget language tags
-     */
-    DPL::Event::Property<LanguageTagsList> LanguageTags;
+                  DPL::Event::PropertyStorageDynamicCached> TizenId;
 
     /**
      * @brief Minimum of the WAC Engine Standard required to run widget.
@@ -278,14 +241,15 @@ class WidgetModel : public DPL::Event::Model
      */
     DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
 
-    WidgetModel(const WidgetHandle &handle);
+    WidgetModel(const std::string &tizenId);
 
   private:
     // Custom read write delegates
-    static DPL::String           readPkgName(DPL::Event::Model *model);
+    static DPL::String           readTizenId(DPL::Event::Model *model);
     static WidgetStandard        readStandard(DPL::Event::Model *model);
     static OptionalWidgetVersion readVersion(DPL::Event::Model *model);
     static WidgetStorageSize     getApplicationStorage(DPL::Event::Model *model);
+    static DPL::String           getTimestamp();
 
     WidgetHandle getHandle() const;
 };
index 90f3edb..783f44b 100644 (file)
@@ -201,7 +201,7 @@ bool PopupInvoker::securityDaemonCall(bool allowed,
                                            const AceUserdata &data)
 {
     if(!m_dbusPopupClient)
-        m_dbusPopupClient.Reset(new DPL::DBus::Client(
+        m_dbusPopupClient.reset(new DPL::DBus::Client(
                     WrtSecurity::SecurityDaemonConfig::OBJECT_PATH(),
                     WrtSecurity::SecurityDaemonConfig::SERVICE_NAME(),
                     WrtSecurity::PopupServerApi::INTERFACE_NAME()));
@@ -226,4 +226,4 @@ bool PopupInvoker::securityDaemonCall(bool allowed,
 
     return response;
 }
-} // Wrt
\ No newline at end of file
+} // Wrt
index 884ebf3..b3a4cc0 100644 (file)
 #include <PromptModel.h>
 
 #include <string>
+#include <memory>
+
 #include <dpl/named_input_pipe.h>
 #include <dpl/named_output_pipe.h>
 #include <dpl/dbus/dbus_client.h>
-#include <dpl/scoped_ptr.h>
 
 #include "popup_ace_data_types.h"
 
@@ -63,7 +64,7 @@ private:
     DPL::NamedOutputPipe m_output;
     const std::string m_inputName;
     const std::string m_outputName;
-    DPL::ScopedPtr<DPL::DBus::Client> m_dbusPopupClient;
+    std::unique_ptr<DPL::DBus::Client> m_dbusPopupClient;
 };
 } // Wrt
 
index e803555..481519a 100644 (file)
@@ -15,8 +15,8 @@
  */
 
 #include "PopupSerializer.h"
-#include <dpl/scoped_array.h>
 
+#include <memory>
 
 namespace Wrt {
 namespace PopupSerializer {
@@ -50,10 +50,10 @@ std::string getStringArg(DPL::BinaryQueue &buffer)
 {
     std::string::size_type size;
     buffer.FlattenConsume(&size, sizeof(size));
-    DPL::ScopedArray<char> str(new char[size]);
-    buffer.FlattenConsume(str.Get(), size);
-    return std::string(str.Get(), str.Get() + size);
+    std::unique_ptr<char[]> str(new char[size]);
+    buffer.FlattenConsume(str.get(), size);
+    return std::string(str.get(), str.get() + size);
 }
 
 }
-} // Wrt
\ No newline at end of file
+} // Wrt
index 5c65320..5024c74 100644 (file)
@@ -41,6 +41,11 @@ void AddProfilingMeasurment(const char* name,
                                                                        desc)
 #endif //__cplusplus
 
+// profiling script additional proceeds debug output if console debug is enabled
+//and if output is logged then addiional points will be added to graphs
+#define LOG_PROFILE_START(x) LogDebug(x << " " << "profiling##start");
+#define LOG_PROFILE_STOP(x) LogDebug(x << " " << "profiling##stop");
+
 #else //PROFILING_ENABLED
 
 #define ADD_PROFILING_POINT(name, ...) (void)1
index 5903479..c5f8730 100755 (executable)
@@ -25,16 +25,17 @@ my @WIDGETS = (
 my $WRT_CLIENT_LAUNCH = 'wrt-client -l {}';
 my $WRT_CLIENT_QUERY = 'wrt-launcher -l 2>/dev/null';
 my $WRT_CLIENT_INSTALL = 'wrt-installer -i {}';
-my $WRT_CLIENT_UNINSTALL = 'wrt-installer -u {}';
+my $WRT_CLIENT_UNINSTALL = 'wrt-installer -un {}';
 my $COLD_START_PREPARE_COMMAND = '/sbin/sysctl vm.drop_caches=3';
 my $OUTPUT_DIR = './OUTPUT';
 my $PRELOAD_LIBRARIES = './utils/wrt-preloader';
 
-##### CONFIGURATION end #####
+##### ONFIGURATION end #####
 
 
 use strict;
 use Time::HiRes;
+use Time::Local;
 use List::Util;
 
 
@@ -42,7 +43,7 @@ use List::Util;
 
 # $stream may be undef - then no output
 sub runWidget {
-  my $widgetHandle = shift;
+  my $widgetTizenId = shift;
   my $stream = shift;
   my $streamout = shift;
   my $fnameerr = shift;
@@ -53,8 +54,10 @@ sub runWidget {
 
   `mkdir -p $OUTPUT_DIR/tmp`;
 
+  my $fnameerr = "$OUTPUT_DIR/tmp/additional.tmp";
+
   my $command = $WRT_CLIENT_LAUNCH;
-  $command =~ s/\{\}/$widgetHandle/;
+  $command =~ s/\{\}/$widgetTizenId/;
   $command .= " 2>$fnameerr 3>$OUTPUT_DIR/tmp/prof.tmp & echo TEST-WIDGET-PID \$\!";
 
   print "$command\n";
@@ -66,6 +69,8 @@ sub runWidget {
 
   my $pid = undef;
 
+  my $extralines  = "";
+
   while (my $line = <$f>) {
     print "The line is: $line";
     if (defined $streamout) {
@@ -86,25 +91,44 @@ sub runWidget {
         }
         kill 9, $pid;
         print "killed\n";
+    } elsif ($line =~ /\[([0-9]*):([0-9]*):([0-9]*).([0-9]*)\][^)]*\(\): *([A-Za-z]*) *profiling##(start|stop)/) { #additionally take point from debug
+        my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time());
+        my $name = $5;
+        $hour = $1;
+        $min = $2;
+        $sec = $3;
+        my $msec = $4;
+        my $type = $6;
+        my $value = timelocal($sec,$min,$hour,$mday,$mon,$year);
+        my $value = $msec + 1000 * $value;
+        my $insert = "$type#$name#$value${msec}#[]\n";
+        $extralines = "$extralines$insert";
     }
-}
+  }
+
+  close $f;
 
-close $f;
+  #TODO: do it perl way
+  `cat $OUTPUT_DIR/tmp/prof.tmp | sort -k3,3 -t"#" -n > $OUTPUT_DIR/tmp/prof.tmp.new && mv $OUTPUT_DIR/tmp/prof.tmp.new $OUTPUT_DIR/tmp/prof.tmp`;
 
-open my $fin, "<", "$OUTPUT_DIR/tmp/prof.tmp";
-while (my $line = <$fin>) {
+  open my $fin, "<", "$OUTPUT_DIR/tmp/prof.tmp";
+  while (my $line = <$fin>) {
     chomp $line;
     if ($line =~ /^#Profiling_Started#/) {
         if (defined $stream) {
             printf $stream "#Profiling_Started#%d%06d#[]\n", $startSec, $startUSec;
         }
-    } else {
+    } elsif ($line =~ /###PROFILING###STOP###/) {
+        if (defined $stream) {
+            print $stream "$extralines###PROFILING###STOP###\n";
+        }
+       } else {
         if (defined $stream) {
             print $stream "$line\n";
         }
     }
-}
-close $fin;
+  }
+  close $fin;
 }
 
 # $mode:
@@ -121,7 +145,7 @@ close $fin;
 #       of useless data from disk to /dev/null, until `free' shows small
 #       enough free memory level
 sub runTest {
-    my $widgetHandle = shift;
+    my $widgetTizenId = shift;
     my $mode = shift;
     my $stream = shift;
     my $streamout = shift;
@@ -132,22 +156,22 @@ sub runTest {
     } elsif ($mode eq 'cold') {
         `$COLD_START_PREPARE_COMMAND`;
     } elsif ($mode eq 'warm') {
-        runWidget( $widgetHandle, undef, undef, undef );
+        runWidget( $widgetTizenId, undef, undef, undef );
     } elsif ($mode eq 'double-warm') {
-        runWidget( $widgetHandle, undef, undef, undef );
-        runWidget( $widgetHandle, undef, undef, undef );
+        runWidget( $widgetTizenId, undef, undef, undef );
+        runWidget( $widgetTizenId, undef, undef, undef );
     } elsif ($mode eq 'preload') {
         `$COLD_START_PREPARE_COMMAND`;
         `$PRELOAD_LIBRARIES`;
     } else {
         die;
     }
-    runWidget( $widgetHandle, $stream, $streamout, $fnameerr );
+    runWidget( $widgetTizenId, $stream, $streamout, $fnameerr );
 }
 
 ##### Widget installation
 
-# returns \% a map: name->handle
+# returns \% a map: name->tizenId
 sub dropAndInstallAll {
     my $pwidgets = shift;
 
@@ -155,10 +179,10 @@ sub dropAndInstallAll {
         print "Uninstalling all widgets\n";
         my @out = `$WRT_CLIENT_QUERY`;
         for my $line (@out) {
-            if (my ($handle) = $line =~ /^\s*\d+\s+(\d+)/) {
+            if (my ($tizenId) = $line =~ /^\s+\d+.*\s+([A-Za-z0-9]+)$/) {
                 my $command = $WRT_CLIENT_UNINSTALL;
-                $command =~ s/\{\}/$handle/g;
-                print "    uninstalling widget $handle [$command]\n";
+                $command =~ s/\{\}/$tizenId/g;
+                print "    uninstalling widget $tizenId [$command]\n";
                 `$command > /dev/null 2>/dev/null`;
             }
         }
@@ -167,7 +191,7 @@ sub dropAndInstallAll {
         print "Checking if widget list is empty\n";
         my @out = `$WRT_CLIENT_QUERY`;
         for my $line (@out) {
-            if (my ($handle) = $line =~ /^\s*\d+\s+(\d+)/) {
+            if (my ($tizenId) = $line =~ /^\s+\d+.*\s+([A-Za-z0-9]+)$/) {
                 print "WIDGET LIST NOT EMPTY!!!\n";
                 die;
             }
@@ -184,7 +208,7 @@ sub dropAndInstallAll {
         }
     }
     {
-        print "Checking if all widgets are installed, determining handles\n";
+        print "Checking if all widgets are installed, determining tizenIds\n";
         my %widgetMap = ();
         for my $pwidgetData (@$pwidgets) {
             my ($package, $name) = @$pwidgetData;
@@ -192,12 +216,9 @@ sub dropAndInstallAll {
         }
         my @out = `$WRT_CLIENT_QUERY`;
         for my $line (@out) {
-            if (my ($handle, $name) = $line =~ /^\s*\d+\s+(\d+)\s+(.*?)\s+\d/) {
-                print "    found $name (handle $handle)\n";
-                $widgetMap{$name} = $handle;
-            } elsif (my ($handle, $name) = $line =~ /^\s*\d+\s+(\d+)\s+(.*?)\s+http\:\/\//) {
-                print "    found $name (handle $handle)\n";
-                $widgetMap{$name} = $handle;
+            if (my ($name, $tizenId) = $line =~ /^\s*\d+\s+(([^ ]| [^ ])+)\s+.*\s+([A-Za-z0-9]+)$/) {
+                print "    found $name (tizenId $tizenId)\n";
+                $widgetMap{$name} = $tizenId;
             }
         }
         for my $name (keys %widgetMap) {
@@ -248,17 +269,17 @@ my $totalTestCount = @testList;
 for my $ptest (@testList) {
     # find test parameters
     my ($name, $mode) = @$ptest;
-    my $widgetHandle = $$pwidgetMap{$name};
-    my $runNo = $runNumbers{"$mode|$widgetHandle"};
+    my $widgetTizenId = $$pwidgetMap{$name};
+    my $runNo = $runNumbers{"$mode|$widgetTizenId"};
     print "next\n";
     if (defined $runNo)
     { $runNo += 1; }
     else
     { $runNo = 0; }
-    $runNumbers{"$mode|$widgetHandle"} = $runNo;
+    $runNumbers{"$mode|$widgetTizenId"} = $runNo;
     $globalTestNumber += 1;
     print "    Test $globalTestNumber of $totalTestCount: ".
-    "$name ($widgetHandle) run $runNo, $mode\n";
+    "$name ($widgetTizenId) run $runNo, $mode\n";
 
     # remove and create output dir
     my $prepName = $name;
@@ -271,7 +292,7 @@ for my $ptest (@testList) {
     open my $dumpOutFile, ">", "$dirName/dump-stdout" or die;
 
     # run test
-    runTest( $widgetHandle, $mode, $outFile, $dumpOutFile, "$dirName/dump-stderr" );
+    runTest( $widgetTizenId, $mode, $outFile, $dumpOutFile, "$dirName/dump-stderr" );
 
     # close output files
     close $outFile;
index 27b245d..2e63458 100644 (file)
@@ -23,8 +23,10 @@ PKG_CHECK_MODULES(VIEW_COMMON_DEP
     capi-appfw-app-manager
     capi-system-haptic
     capi-web-url-download
+    cert-svc-vcore
     dpl-efl
     dpl-event-efl
+    dpl-wrt-dao-ro
     eina
     elementary
     evas
@@ -33,13 +35,11 @@ PKG_CHECK_MODULES(VIEW_COMMON_DEP
     libpcrecpp
     libsoup-2.4
     notification    # native notifications
+    security-client
+    security-core
     secure-storage
     ui-gadget-1
-    vcore
     wrt-commons-auto-save-dao-rw
-    dpl-wrt-dao-ro
-    wrt-security
-    ace-client
     REQUIRED
 )
 
@@ -70,7 +70,6 @@ SET(VIEW_COMMON_SOURCES
 
 SET(VIEW_COMMON_INCLUDES
     ${PROJECT_SOURCE_DIR}/src/domain
-    ${PROJECT_SOURCE_DIR}/src/framework
     ${PROJECT_SOURCE_DIR}/src/global_logic
     ${PROJECT_SOURCE_DIR}/src/popup-process
     ${PROJECT_SOURCE_DIR}/src/profiling
index af6c11b..0e2441b 100644 (file)
@@ -158,7 +158,7 @@ void ApplicationLauncher::OnEventReceived(
 
         LogDebug("scheme: " << scheme);
         if (SCHEME_TYPE_YOUTUBE == scheme) {
-            YouTubeHD *youtube = new YouTubeHD(m_widgetHandle);
+            YouTubeHD *youtube = new YouTubeHD(m_tizenId);
             url = youtube->getYouTubeHD(uri.c_str());
             delete youtube;
         } else if (SCHEME_TYPE_RTSP == scheme ||
@@ -231,8 +231,8 @@ void ApplicationLauncher::OnEventReceived(
     }
 }
 
-void ApplicationLauncher::setWidgetHandle(const WidgetHandle widgetHandle)
+void ApplicationLauncher::setWidgetTizenId(const std::string& tizenId)
 {
-    LogDebug("widgetHandle: " << widgetHandle);
-    m_widgetHandle = widgetHandle;
+    LogDebug("tizen id: " << tizenId);
+    m_tizenId = tizenId;
 }
index 20629d5..d33c5e7 100644 (file)
@@ -60,7 +60,7 @@ class ApplicationLauncher :
   public:
     ApplicationLauncher();
     virtual ~ApplicationLauncher();
-    void setWidgetHandle(const WidgetHandle widgetHandle);
+    void setWidgetTizenId(const std::string& tizenId);
 
   protected:
     virtual void OnEventReceived(
@@ -71,7 +71,7 @@ class ApplicationLauncher :
             LaunchApplicationByAppService &event);
 
   private:
-    WidgetHandle m_widgetHandle;
+    std::string m_tizenId;
 };
 
 typedef DPL::Singleton<ApplicationLauncher> ApplicationLauncherSingleton;
index df25a2f..7f8585d 100644 (file)
 #ifndef WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H
 #define WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H
 
-#include <dpl/framework_efl.h>
-#include <dpl/assert.h>
-#include <dpl/shared_ptr.h>
-#include <dpl/foreach.h>
-#include <dpl/apply.h>
 #include <set>
 #include <string>
 #include <tuple>
 #include <utility>
+#include <memory>
+
+#include <dpl/framework_efl.h>
+#include <dpl/assert.h>
+#include <dpl/foreach.h>
+#include <dpl/apply.h>
+#include <dpl/noncopyable.h>
 
 class EvasObject
 {
     class EvasObjectShared;
-    typedef DPL::SharedPtr<EvasObjectShared> EvasObjectSharedPtr;
+    typedef std::shared_ptr<EvasObjectShared> EvasObjectSharedPtr;
 
   public:
     class IConnection
index 25741bb..5d7433e 100644 (file)
@@ -47,7 +47,7 @@ const char* KEEP_CONNECTION_WARNING =
 
 RoamingAgent::RoamingAgent()
 {
-    if (GlobalSettings::TestModeEnabled()) {
+    if (GlobalSettings::RoamingTestModeEnabled()) {
         return;
     }
     //setting say if we are using roaming network or home network
@@ -117,7 +117,7 @@ RoamingAgent::RoamingAgent()
 
 RoamingAgent::~RoamingAgent()
 {
-    if (GlobalSettings::TestModeEnabled()) {
+    if (GlobalSettings::RoamingTestModeEnabled()) {
         return;
     }
 
@@ -137,7 +137,7 @@ RoamingAgent::~RoamingAgent()
 
 bool RoamingAgent::CheckAccess()
 {
-    if (GlobalSettings::TestModeEnabled()) {
+    if (GlobalSettings::RoamingTestModeEnabled()) {
         return true;
     }
 
@@ -214,7 +214,7 @@ void RoamingAgent::HandleDisconnection()
 void RoamingAgent::NetworkAccessModeChanged(NetworkType networkType,
         GlobalModel::NetworkAccessMode mode)
 {
-    if (GlobalSettings::TestModeEnabled()) {
+    if (GlobalSettings::RoamingTestModeEnabled()) {
         return;
     }
     SaveNetworkAccessMode(networkType, mode);
@@ -225,7 +225,7 @@ void RoamingAgent::vConfChagedCallback(keynode_t *keyNode, void *data)
 {
     LogInfo("vConfChagedCallback ");
     RoamingAgent *roamAgent = static_cast<RoamingAgent *>(data);
-    if (GlobalSettings::TestModeEnabled()) {
+    if (GlobalSettings::RoamingTestModeEnabled()) {
         return;
     }
 
index 5de8ad6..b205b50 100644 (file)
 #include <pcrecpp.h>
 #include <memory>
 #include <curl/curl.h>
+#include "scheme_action_map_data.h"
 
 namespace ViewModule {
 
 namespace {
 
-enum UriAction {
-    URI_ACTION_WRT,       // load in WRT
-    URI_ACTION_APPSVC,    // launch in APPSVC
-    URI_ACTION_VIDEO,     // launch in VIDEO player
-    URI_ACTION_ERROR
-};
-
-/**
- * WS-1501 - No top-level window navigation outside the widget. Deafult browser
- *           should be used instead. Frames/iframes are allowed to navigate.
- *           This requirement can't be applied to tizen hosted app as in its
- *           case the whole widget is "outside".
- *
- * WS-1502 - When calling window.open() with scheme HTTP/HTTPS and target
- *           attribute set to "_blank" WRT should open default browser. At the
- *           moment we can't distinguish target attributes, therefore all new
- *           windows are opened in the browser regardless of the attribute (the
- *           value "_new" is also treated this way). Tizen won't satisfy this
- *           requirement. It should open new windows in WRT.
- *
- * Multiview - Not supported in WAC application. Therefore opening WIDGET scheme
- *           in new window will result in launching appssvc, which won't be able
- *           to handle it. The correct behaviour has to be defined. In case of
- *           Tizen, new window will be opened in WRT.
- *
- * Video - YOUTUBE and RSTP are handled by video player.
- *
- * File scheme - FILE scheme has to be handled by WRT with exception to new
- *           window in WAC application (no support for multiple views)
- *
- * WS-1510/20/30/40/50 - All remaining cases are always handled by appsvc
- */
-
-// TIZEN
-const UriAction g_tizenActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = {
-
-//  TOP_LEVEL           FRAME_LEVEL         NEW_WINDOW
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // FILE
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // SMS
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MMSTO
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MAILTO
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},   // DATA
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // TEL
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // HTTP
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // HTTPS
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // WIDGET
-    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO},    // YOUTUBE
-    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO}     // RTSP
-};
-
-// WAC
-const UriAction g_wacActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = {
-
-//  TOP_LEVEL           FRAME_LEVEL         NEW_WINDOW
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_APPSVC},   // FILE
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // SMS
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MMSTO
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MAILTO
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},   // DATA
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // TEL
-    {URI_ACTION_APPSVC, URI_ACTION_WRT,     URI_ACTION_APPSVC},   // HTTP
-    {URI_ACTION_APPSVC, URI_ACTION_WRT,     URI_ACTION_APPSVC},   // HTTPS
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_APPSVC},   // WIDGET
-    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO},    // YOUTUBE
-    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO}     // RTSP
-};
-
 /*
  * Lazy construction pattern.
  * TODO Make it more general. Use variadic template/tuples/lambdas or sth. Move
index 16eeef7..558693d 100644 (file)
 #ifndef SCHEME_ACTION_MAP_H_
 #define SCHEME_ACTION_MAP_H_
 
+#include "scheme_action_map_type.h"
 #include <dpl/wrt-dao-ro/common_dao_types.h>
 
 namespace ViewModule {
 
 namespace SchemeActionMap {
-    enum NavigationContext {
-        TOP_LEVEL = 0,
-        FRAME_LEVEL,
-        NEW_WINDOW,
-
-        COUNT
-    };
-
     bool HandleUri(const char* uri, NavigationContext context, WrtDB::AppType appType);
 };
 
diff --git a/src/view/common/scheme_action_map_data.h b/src/view/common/scheme_action_map_data.h
new file mode 100644 (file)
index 0000000..9224e3d
--- /dev/null
@@ -0,0 +1,98 @@
+/*\r
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ *    Licensed under the Apache License, Version 2.0 (the "License");\r
+ *    you may not use this file except in compliance with the License.\r
+ *    You may obtain a copy of the License at\r
+ *\r
+ *        http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *    Unless required by applicable law or agreed to in writing, software\r
+ *    distributed under the License is distributed on an "AS IS" BASIS,\r
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *    See the License for the specific language governing permissions and\r
+ *    limitations under the License.\r
+ */\r
+/*\r
+ * @file       scheme_action_map_data.h\r
+ * @author     Tae-Jeong Lee (taejeong.lee@samsung.com)\r
+ * @version    1.0\r
+ */\r
+\r
+#include "scheme_action_map.h"\r
+#include <scheme.h>\r
+\r
+namespace ViewModule {\r
+\r
+namespace {\r
+\r
+enum UriAction {\r
+    URI_ACTION_WRT,       // load in WRT\r
+    URI_ACTION_APPSVC,    // launch in APPSVC\r
+    URI_ACTION_VIDEO,     // launch in VIDEO player\r
+    URI_ACTION_ERROR\r
+};\r
+\r
+/**\r
+ * WS-1501 - No top-level window navigation outside the widget. Deafult browser\r
+ *           should be used instead. Frames/iframes are allowed to navigate.\r
+ *           This requirement can't be applied to tizen hosted app as in its\r
+ *           case the whole widget is "outside".\r
+ *\r
+ * WS-1502 - When calling window.open() with scheme HTTP/HTTPS and target\r
+ *           attribute set to "_blank" WRT should open default browser. At the\r
+ *           moment we can't distinguish target attributes, therefore all new\r
+ *           windows are opened in the browser regardless of the attribute (the\r
+ *           value "_new" is also treated this way). Tizen won't satisfy this\r
+ *           requirement. It should open new windows in WRT.\r
+ *\r
+ * Multiview - Not supported in WAC application. Therefore opening WIDGET scheme\r
+ *           in new window will result in launching appssvc, which won't be able\r
+ *           to handle it. The correct behaviour has to be defined. In case of\r
+ *           Tizen, new window will be opened in WRT.\r
+ *\r
+ * Video - YOUTUBE and RSTP are handled by video player.\r
+ *\r
+ * File scheme - FILE scheme has to be handled by WRT with exception to new\r
+ *           window in WAC application (no support for multiple views)\r
+ *\r
+ * WS-1510/20/30/40/50 - All remaining cases are always handled by appsvc\r
+ */\r
+\r
+// TIZEN\r
+const UriAction g_tizenActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = {\r
+\r
+//  TOP_LEVEL           FRAME_LEVEL         NEW_WINDOW\r
+    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // FILE\r
+    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // SMS\r
+    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MMSTO\r
+    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MAILTO\r
+    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},   // DATA\r
+    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // TEL\r
+    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // HTTP\r
+    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // HTTPS\r
+    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // WIDGET\r
+    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO},    // YOUTUBE\r
+    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO}     // RTSP\r
+};\r
+\r
+// WAC\r
+const UriAction g_wacActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = {\r
+\r
+//  TOP_LEVEL           FRAME_LEVEL         NEW_WINDOW\r
+    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_APPSVC},   // FILE\r
+    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // SMS\r
+    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MMSTO\r
+    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MAILTO\r
+    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},   // DATA\r
+    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // TEL\r
+    {URI_ACTION_APPSVC, URI_ACTION_WRT,     URI_ACTION_APPSVC},   // HTTP\r
+    {URI_ACTION_APPSVC, URI_ACTION_WRT,     URI_ACTION_APPSVC},   // HTTPS\r
+    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_APPSVC},   // WIDGET\r
+    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO},    // YOUTUBE\r
+    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO}     // RTSP\r
+};\r
+\r
+}\r
+\r
+}
\ No newline at end of file
diff --git a/src/view/common/scheme_action_map_type.h b/src/view/common/scheme_action_map_type.h
new file mode 100644 (file)
index 0000000..05e3bb7
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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       scheme_action_map_type.h
+ * @author     Tae-Jeong Lee (taejeong.lee@samsung.com)
+ * @version    1.0
+ */
+
+#ifndef SCHEME_ACTION_MAP_TYPE_H_
+#define SCHEME_ACTION_MAP_TYPE_H_
+
+namespace ViewModule {
+namespace SchemeActionMap {
+    enum NavigationContext {
+        TOP_LEVEL = 0,
+        FRAME_LEVEL,
+        NEW_WINDOW,
+
+        COUNT
+    };
+} // namespace SchemeActionMap
+} // namespace ViewModule
+#endif /* SCHEME_ACTION_MAP_TYPE_H_ */
index c828adc..a7985e9 100644 (file)
@@ -71,8 +71,8 @@ class AppsSupportImplementation
 
         ApplicationLauncherSingleton::Instance().Touch();
 
-        ApplicationLauncherSingleton::Instance().setWidgetHandle(
-            m_widgetModel->Handle.Get());
+        ApplicationLauncherSingleton::Instance().setWidgetTizenId(
+                DPL::ToUTF8String(m_widgetModel->TizenId.Get()));
 
         LogDebug("Initialized");
         m_initialized = true;
index 0827f3b..94ae908 100644 (file)
@@ -43,15 +43,13 @@ bool askUserForPermission()
         GEOLOCATION_ASK_MSG);
 }
 
-bool checkRequestedStateOfGeolocationFeature(WidgetHandle widgetHandle)
+bool checkRequestedStateOfGeolocationFeature(WrtDB::WidgetDAOReadOnlyPtr dao)
 {
-    WrtDB::WidgetDAOReadOnly dao(widgetHandle);
-
     WrtDB::DbWidgetFeature geolocationFeature;
     geolocationFeature.name = DPL::FromASCIIString(
         WrtDB::GlobalConfig::GetW3CGeolocationFeatureName() );
 
-    auto features = dao.getFeaturesList();
+    auto features = dao->getFeaturesList();
 
     auto it = features.find(geolocationFeature);
 
@@ -67,34 +65,35 @@ bool checkRequestedStateOfGeolocationFeature(WidgetHandle widgetHandle)
     return false;
 }
 
-bool getLocalizationState(WidgetHandle widgetHandle, bool enableHighAccuracy)
+bool getLocalizationState(const DPL::String& tizenId, bool enableHighAccuracy)
 {
     LogDebug ("Get localization state");
 
-    WrtDB::WidgetDAOReadOnly dao(widgetHandle);
+    WrtDB::WidgetDAOReadOnlyPtr dao(new WrtDB::WidgetDAOReadOnly(tizenId));
 
-    if (dao.getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP)
+    if (dao->getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP)
     {
         return askUserForPermission();
     }
 
-    return checkRequestedStateOfGeolocationFeature(widgetHandle) &&
-        ViewModule::SecuritySupport::geolocationACECheck(widgetHandle, enableHighAccuracy);
+    return checkRequestedStateOfGeolocationFeature(dao) &&
+        ViewModule::SecuritySupport::geolocationACECheck(dao->getHandle(),
+            enableHighAccuracy);
 }
 
-bool getGeolocationModuleState(WidgetHandle widgetHandle)
+bool getGeolocationModuleState(const DPL::String& tizenId)
 {
     LogDebug ("Get geolocation state");
 
-    WrtDB::WidgetDAOReadOnly dao(widgetHandle);
+    WrtDB::WidgetDAOReadOnlyPtr dao(new WrtDB::WidgetDAOReadOnly(tizenId));
 
-    if (dao.getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP)
+    if (dao->getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP)
     {
         LogInfo("Geolocation enable for tizen app");
         return true;
     }
 
-    return checkRequestedStateOfGeolocationFeature(widgetHandle);
+    return checkRequestedStateOfGeolocationFeature(dao);
 }
 
 } // namespace GeolocationSupport
index 29f1465..3802223 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef VIEW_LOGIC_GEOLOCATION_SUPPORT_H_
 #define VIEW_LOGIC_GEOLOCATION_SUPPORT_H_
 
-#include <dpl/wrt-dao-ro/wrt_db_types.h>
+#include <dpl/string.h>
 
 namespace ViewModule {
 namespace GeolocationSupport {
@@ -30,7 +30,7 @@ namespace GeolocationSupport {
  * @returns true if user allowed for share current position
  * @returns false otherwise
  */
-bool getLocalizationState(WidgetHandle widgetHandle, bool enableHighAccuracy);
+bool getLocalizationState(const DPL::String& tizenId, bool enableHighAccuracy);
 
 /*
  * The function returns requested state of geolocation module
@@ -38,7 +38,7 @@ bool getLocalizationState(WidgetHandle widgetHandle, bool enableHighAccuracy);
  * @returns true if geolocation module(navigator.geolocation object) should be enabled
  *          false if geolocation module(navigator.geolocation object) should be disabled
  */
-bool getGeolocationModuleState(WidgetHandle widgetHandle);
+bool getGeolocationModuleState(const DPL::String& tizenId);
 
 }
 } // namespace ViewModule
index a5a16c5..aa7b96f 100644 (file)
@@ -104,8 +104,8 @@ void submitClicked(std::string uri, Eina_Hash* data)
         return;
     }
 
-    DPL::ScopedPtr<iri_t> iri(iri_parse(uri.c_str()));
-    if (!iri.Get()) {
+    std::unique_ptr<iri_t> iri(iri_parse(uri.c_str()));
+    if (!iri.get()) {
         LogDebug("Fail to get iri");
         return;
     }
@@ -159,8 +159,8 @@ DPL::Optional<DPL::String> jsForAutoFillData(const char *uri)
     Assert(uri);
 
     // check uri is invalid
-    DPL::ScopedPtr<iri_t> iri(iri_parse(uri));
-    if (!iri.Get()) {
+    std::unique_ptr<iri_t> iri(iri_parse(uri));
+    if (!iri.get()) {
         LogDebug("Fail to get iri");
         return DPL::OptionalString::Null;
     }
@@ -210,7 +210,7 @@ DPL::Optional<DPL::String> jsForAutoFillData(const char *uri)
     }
 
     fseek(fd, 0, SEEK_END);
-    long int size = ftell(fd);
+    long size = ftell(fd);
     fseek(fd, 0, SEEK_SET);
 
     char* data = new char[size + 1];
@@ -220,8 +220,13 @@ DPL::Optional<DPL::String> jsForAutoFillData(const char *uri)
     }
 
     memset(data, 0, size + 1);
-    fread(data, 1, size, fd);
+    size_t ret = fread(data, 1, size, fd);
     fclose(fd);
+    if (static_cast<long>(ret) != size) {
+        LogError("Read size is mismatched");
+        delete data;
+        return DPL::OptionalString::Null;
+    }
 
     std::string dataStr = data;
     delete data;
index 09700aa..7aee710 100644 (file)
 #include <dpl/string.h>
 #include <dpl/log/log.h>
 #include <dpl/wrt-dao-ro/global_dao_read_only.h>
-#include <dpl/utils/wrt_global_settings.h>
 #include <ace_api_client.h>
-
-#include <widget_model.h>
-#include "roaming_agent.h"
+#include <dpl/utils/warp_iri.h>
+#include <widget_data_types.h>
 
 namespace ViewModule {
 namespace SecuritySupport {
@@ -82,22 +80,6 @@ bool simpleAceCheck(
 
 } //TODO copied from view_logic.cpp
 
-bool checkWARP(const char *url, WidgetModel *widgetModel)
-{
-    // ignore WARP in test mode
-    if (GlobalSettings::TestModeEnabled()) {
-        return true;
-    }
-
-    if (WarpIRI::isIRISchemaIgnored(url)) {
-        // scheme is not supported by WARP
-        return true;
-    }
-
-    return widgetModel->AccessList.Get().isRequiredIRI(
-        DPL::FromUTF8String(std::string(url)));
-}
-
 bool checkWhitelist(const char *url)
 {
     LogInfo("Check WhiteList");
@@ -111,74 +93,6 @@ bool checkWhitelist(const char *url)
     return whiteURIList.isRequiredIRI(DPL::FromUTF8String(std::string(url)));
 }
 
-bool checkUriRequiredNet(const std::string &uri)
-{
-    if (strstr(uri.c_str(), SCHEME_TYPE_HTTP) == uri.c_str() ||
-        strstr(uri.c_str(), SCHEME_TYPE_HTTPS) == uri.c_str())
-    {
-        return true;
-    } else {
-        return false;
-    }
-}
-
-bool checkACE(const char* url, bool xhr, WidgetModel* model)
-{
-    if (url) {
-        for (size_t i = 0; ACE_IGNORED_SCHEMA[i]; ++i) {
-            if (0 == strncmp(url,
-                             ACE_IGNORED_SCHEMA[i],
-                             strlen(ACE_IGNORED_SCHEMA[i])))
-            {
-                return true;
-            }
-        }
-    }
-
-    const char *devCapNamesMarkup = "externalNetworkAccess";
-    const char *devCapNamesXHR = "XMLHttpRequest";
-
-    ace_request_t aceRequest;
-
-    aceRequest.widget_handle = model->Handle.Get();
-
-    // TODO! We should get session id from somewhere (outside Widget Process)
-    const std::string session = "";
-    aceRequest.session_id = const_cast<ace_session_id_t>(session.c_str());
-    aceRequest.feature_list.count = 0;
-    aceRequest.dev_cap_list.count = 1;
-    aceRequest.dev_cap_list.items = new ace_dev_cap_t[1];
-
-    if (xhr) {
-        aceRequest.dev_cap_list.items[0].name =
-                const_cast<ace_string_t>(devCapNamesXHR);
-    } else {
-        aceRequest.dev_cap_list.items[0].name =
-                const_cast<ace_string_t>(devCapNamesMarkup);
-    }
-
-    aceRequest.dev_cap_list.items[0].param_list.count = 1;
-    aceRequest.dev_cap_list.items[0].param_list.items = new ace_param_t[1];
-    aceRequest.dev_cap_list.items[0].param_list.items[0].name =
-            const_cast<ace_string_t>(PARAM_URL);
-    aceRequest.dev_cap_list.items[0].param_list.items[0].value =
-            const_cast<ace_string_t>(url);
-
-
-    ace_bool_t result = ACE_FALSE;
-
-    LogDebug("Making ace check with new C-API");
-
-    ace_return_t ret = ace_check_access(&aceRequest, &result);
-
-    LogDebug("Result is: " << static_cast<int>(result));
-
-    delete [] aceRequest.dev_cap_list.items[0].param_list.items;
-    delete [] aceRequest.dev_cap_list.items;
-
-    return ACE_OK == ret && ACE_TRUE == result;
-}
-
 bool geolocationACECheck(WidgetHandle widgetHandle, bool highAccuracy) {
     const char *paramName = NULL;
     const char *paramValue = NULL;
@@ -193,49 +107,5 @@ bool geolocationACECheck(WidgetHandle widgetHandle, bool highAccuracy) {
         paramValue);
 }
 
-bool filterURIBySecurity(DPL::OptionalString &op_uri,
-                         bool is_xhr,
-                         WidgetModel *model)
-{
-    if (!op_uri)
-    {
-        return true; //accept empty uri
-    }
-
-    auto uri = DPL::ToUTF8String(*op_uri);
-    if (!checkWARP(uri.c_str(), model))
-    {
-        LogDebug("Request was blocked by WARP: " << uri);
-        return false;
-    }
-
-    if (!checkACE(uri.c_str(), is_xhr, model))
-    {
-        LogDebug("Request was blocked by ACE: " << uri);
-        return false;
-    }
-
-    return true;
-}
-
-bool filterURIByRoaming(DPL::OptionalString &opUri)
-{
-    if (opUri.IsNull())
-    {
-        return true; //accept empty uri
-    }
-
-    std::string uri = DPL::ToUTF8String(*opUri);
-    if (checkUriRequiredNet(uri))
-    {
-        if (!RoamingAgentSingleton::Instance().CheckAccess())
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
 } // namespace SecuritySupport
 } //namespace ViewModule
index aa6b330..7d7b272 100644 (file)
@@ -23,7 +23,6 @@
 #define VIEW_LOGIC_SECURITY_SUPPORT_H_
 
 #include <string>
-#include <dpl/optional_typedefs.h>
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
 
 //Forward declaration
@@ -32,24 +31,13 @@ class WidgetModel;
 namespace ViewModule {
 namespace SecuritySupport {
 
-char const * const WARP_ERROR_MSG =
-        "file:///usr/etc/wrt/warp_security_error.msg";
 char const * const ROAMING_ERROR_MSG = "file:///usr/etc/wrt/roaming_error.msg";
 char const * const PARAM_URL = "param:url";
-char const * const ACE_IGNORED_SCHEMA[] = { "file://", "widget://", "data:",
-    "tel:", "sms:", "mmsto:", "mailto:", 0 };
 
-bool checkWARP(const char *url, WidgetModel *widgetModel);
 bool checkWhitelist(const char *url);
 bool checkUriRequiredNet(const std::string &uri);
-bool checkACE(const char* url, bool xhr, WidgetModel* model);
 bool geolocationACECheck(WidgetHandle widgetHandle, bool highAccuracy);
 
-bool filterURIBySecurity(DPL::OptionalString &uri,
-                         bool is_xhr,
-                         WidgetModel *model);
-bool filterURIByRoaming(DPL::OptionalString &uri);
-
 } // namespace SecuritySupport
 } // namespace ViewModule
 
index bb2f7a7..e4fc832 100644 (file)
@@ -25,7 +25,7 @@
 #include <dpl/exception.h>
 #include <dpl/log/log.h>
 #include <dpl/string.h>
-#include <dpl/utils/file_utils.h>
+#include <dpl/utils/wrt_utility.h>
 #include <widget_model.h>
 
 namespace ViewModule {
@@ -42,16 +42,10 @@ void initializeStorage(WidgetModel *widgetModel)
     Assert(widgetModel && "Passed widgetModel is NULL!");
 
     // create temporary storage
-    Try
-    {
-        std::string path =
-        DPL::ToUTF8String(
-            widgetModel->TemporaryStoragePath.Get());
-        FileUtils::MakePath(path, TEMPORARY_STORAGE_MODE);
-    }
-    Catch(DPL::Exception)
-    {
-        ReThrowMsg(DPL::CommonException::InternalError,
+    std::string path =
+            DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
+    if(!WrtUtilMakeDir(path, TEMPORARY_STORAGE_MODE)){
+        ThrowMsg(DPL::CommonException::InternalError,
                    "Fail to initialize temporary storage");
     }
 }
@@ -62,16 +56,10 @@ void deinitializeStorage(WidgetModel *widgetModel)
     Assert(widgetModel && "Passed widgetModel is NULL!");
 
     // remove temporary storage
-    Try
-    {
-        std::string path =
-        DPL::ToUTF8String(
-            widgetModel->TemporaryStoragePath.Get());
-        FileUtils::RemoveDir(path);
-    }
-    Catch(DPL::Exception)
-    {
-        ReThrowMsg(DPL::CommonException::InternalError,
+    std::string path =
+            DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
+    if(!WrtUtilRemove(path)){
+        ThrowMsg(DPL::CommonException::InternalError,
                    "Fail to deinitialize temporary storage");
     }
 }
index 5ec3f23..92026d6 100644 (file)
@@ -35,6 +35,23 @@ namespace UriSupport {
 namespace {
 char const * const SCHEME_TYPE_FILE = "file";
 char const * const SCHEME_TYPE_WIDGET = "widget";
+
+std::string getSchemeType(std::string scheme)
+{
+    std::string type = "";
+    if (!scheme.empty())
+    {
+        const char *end = strstr(scheme.c_str(), ":");
+        if(!end)
+        {
+            LogError("Lack of scheme");
+        } else {
+            std::string schemeTmp(scheme.c_str(), end);
+            type = schemeTmp;
+        }
+    }
+    return type;
+}
 }
 
 std::string getAppServiceUri(bundle *bundle, WidgetModel *widgetModel)
@@ -54,18 +71,7 @@ std::string getAppServiceUri(bundle *bundle, WidgetModel *widgetModel)
     std::string mimeType = value ? value : "";
 
     // get scheme type from scheme uri
-    std::string schemeType = "";
-    if (!scheme.empty())
-    {
-        const char *end = strstr(scheme.c_str(), ":");
-        if(!end)
-        {
-            LogError("Lack of scheme");
-        } else {
-            std::string schemeTmp(scheme.c_str(), end);
-            schemeType = schemeTmp;
-        }
-    }
+    std::string schemeType = getSchemeType(scheme);
 
     LogDebug("operation : " << operation);
     LogDebug("schemeType : " << schemeType);
@@ -74,8 +80,11 @@ std::string getAppServiceUri(bundle *bundle, WidgetModel *widgetModel)
     WidgetApplicationServiceList appServiceList =
         widgetModel->AppServiceList.Get();
     FOREACH(appServiceIt, appServiceList) {
+        std::string appServiceSchemeType =
+            getSchemeType(DPL::ToUTF8String(appServiceIt->scheme));
+
         if (DPL::ToUTF8String(appServiceIt->operation) == operation &&
-            (DPL::ToUTF8String(appServiceIt->scheme) == schemeType ||
+            (appServiceSchemeType == schemeType ||
              DPL::ToUTF8String(appServiceIt->scheme) == "*/*") &&
             (DPL::ToUTF8String(appServiceIt->mime) == mimeType ||
              DPL::ToUTF8String(appServiceIt->mime) == "*/*"))
@@ -145,7 +154,6 @@ DPL::OptionalString localizeURI(const DPL::String& inputURI,
     DPL::Optional<DPL::String> found =
         W3CFileLocalization::getFilePathInWidgetPackageFromUrl(
             model->Handle.Get(),
-            model->LanguageTags.Get(),
             DPL::FromUTF8String(uri));
 
     if (found.IsNull()) {
index ab246cc..9d6dddc 100644 (file)
@@ -187,7 +187,7 @@ bool downloadImage(WebNotificationDataPtr notiData)
 
     Assert(notiData);
     // download path is
-    // /opt/apps/pkgname/data + '/' + filename
+    // /opt/apps/tizen_id/data + '/' + filename
     std::string downloadPath =
     DPL::ToUTF8String(
             notiData->m_widgetModel->PersistentStoragePath.Get()) +  "/";
index eb02fda..5837e5d 100644 (file)
@@ -22,9 +22,9 @@
 #ifndef VIEW_LOGIC_WEB_NOTIFICATION_SUPPORT_H_
 #define VIEW_LOGIC_WEB_NOTIFICATION_SUPPORT_H_
 
+#include <memory>
 #include <stdint.h>
 #include <dpl/exception.h>
-#include <dpl/shared_ptr.h>
 
 //Forward declarations
 class WidgetModel;
@@ -45,7 +45,7 @@ class WebNotificationData {
     std::string m_url;
 };
 
-typedef DPL::SharedPtr<WebNotificationData> WebNotificationDataPtr;
+typedef std::shared_ptr<WebNotificationData> WebNotificationDataPtr;
 
 class Exception {
   public:
index 869e298..676e7fa 100644 (file)
@@ -26,7 +26,7 @@
 #include <memory>
 #include <string>
 #include <common/evas_object.h>
-#include <ewk_context.h>
+#include <EWebKit2.h>
 #include <i_runnable_widget_object.h>
 
 class WidgetModel; //FORWARD DECLARATION
@@ -49,10 +49,12 @@ public:
     virtual void suspendWidget()= 0;
     virtual void resumeWidget() = 0;
     virtual void resetWidget() = 0;
-    virtual void goBack() = 0;
+    virtual void backward() = 0;
+    virtual void reload() = 0;
+    virtual void forward() = 0;
     virtual void reloadStartPage() = 0;
     virtual Evas_Object* getCurrentWebview() = 0;
-    virtual void setUserCallbacks(WRT::UserCallbacksPtr cbs, void *data) = 0;
+    virtual void setUserCallbacks(const WRT::UserDelegatesPtr& cbs) = 0;
 };
 
 typedef std::shared_ptr<IViewModule> IViewModulePtr;
@@ -61,7 +63,7 @@ typedef std::shared_ptr<IViewModule> IViewModulePtr;
  * \brief This is a function for retrieving View object. It returns a pointer
  * to IViewModule object.
  */
-IViewModulePtr getView();
+IViewModulePtr createView();
 
 } //namespace
 
index a597a55..2b9d00a 100644 (file)
 namespace ViewModule
 {
 
-static IViewModulePtr ptr;
-
-IViewModulePtr getView()
+IViewModulePtr createView()
 {
-    if(!ptr)
-        ptr.reset(new ViewLogic());
+    IViewModulePtr ptr(new ViewLogic());
     return ptr;
 }
 
index dcba05e..6b6ad87 100644 (file)
@@ -21,7 +21,7 @@
 include(FindPkgConfig)
 
 PKG_CHECK_MODULES(VIEW_MODULE_DEP
-    ace-client
+    security-client
     appsvc
     dpl-dbus-efl
     dpl-popup-efl
@@ -30,6 +30,7 @@ PKG_CHECK_MODULES(VIEW_MODULE_DEP
     eina
     ewebkit2
     wrt-plugin-js-overlay
+    security-core
     REQUIRED
 )
 
@@ -41,7 +42,6 @@ SET(VIEW_MODULE_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_scheme_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_geolocation_support_webkit2.cpp
-    ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_utils.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/bundles/plugin_module_support.cpp
     ${VIEW_MODULE_SOURCES}
 )
@@ -50,7 +50,6 @@ SET(VIEW_MODULE_INCLUDES
     ${PROJECT_SOURCE_DIR}/src/api_new
     ${PROJECT_SOURCE_DIR}/src/common
     ${PROJECT_SOURCE_DIR}/src/domain
-    ${PROJECT_SOURCE_DIR}/src/framework
     ${PROJECT_SOURCE_DIR}/src/global_logic
     ${PROJECT_SOURCE_DIR}/src/popup-process
     ${PROJECT_SOURCE_DIR}/src/profiling
index 3fed48b..15a0553 100644 (file)
 include(FindPkgConfig)
 
 PKG_CHECK_MODULES(BUNDLES_DEP
+    cert-svc-vcore
     dpl-efl
     dpl-utils-efl
     dpl-wrt-dao-ro
     dpl-encryption
-    vconf
     ewebkit2
-    vcore
+    vconf
     REQUIRED
 )
 
 SET(BUNDLES_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/webkit/bundles/wrt-wk2-bundle.cpp
+    ${PROJECT_SOURCE_DIR}/src/view/webkit/bundles/bundle_uri_handling.cpp
+    ${PROJECT_SOURCE_DIR}/src/view/common/scheme.cpp
 )
 
 SET(BUNDLES_INCLUDES
     ${BUNDLES_DEP_INCLUDE_DIRS}
     ${PROJECT_SOURCE_DIR}/src/plugin-service
+    ${PROJECT_SOURCE_DIR}/src/view/common
 )
 
 ADD_DEFINITIONS(${BUNDLES_DEP_CFLAGS})
@@ -50,6 +53,7 @@ ADD_LIBRARY(${TARGET_BUNDLES_LIB} SHARED
 TARGET_LINK_LIBRARIES(${TARGET_BUNDLES_LIB}
     ${BUNDLES_DEP_LIBRARIES}
     ${TARGET_PLUGIN_MODULE_LIB}
+    ${TARGET_CORE_MODULE_LIB}
 )
 
 SET_TARGET_PROPERTIES(${TARGET_BUNDLES_LIB} PROPERTIES
diff --git a/src/view/webkit/bundles/bundle_uri_handling.cpp b/src/view/webkit/bundles/bundle_uri_handling.cpp
new file mode 100644 (file)
index 0000000..e52db0b
--- /dev/null
@@ -0,0 +1,278 @@
+/*
+ * 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    bundle_uri_handling.cpp
+ * @author  Marcin Kaminski (marcin.ka@samsung.com)
+ * @version 1.0
+ */
+
+#include "bundle_uri_handling.h"
+#include <dpl/log/log.h>
+#include <string.h>
+#include <dpl/utils/wrt_global_settings.h>
+// For dao creation (widget info fetching)
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+// security checks for URI
+#include <ace-common/ace_api_common.h>
+#include <ace-client/ace_api_client.h>
+#include <dpl/utils/warp_iri.h>
+// Roaming checks
+#include <roaming_agent.h>
+// URI localization
+#include <dpl/localization/w3c_file_localization.h>
+// WARP check
+#include <widget_data_types.h>
+#include <dpl/wrt-dao-ro/common_dao_types.h>
+// WKBundle API (i.e. message sending)
+#include <WKBundle.h>
+#include <WKString.h>
+#include <WKType.h>
+
+namespace {
+
+char const * const SCHEME_TYPE_FILE = "file";
+char const * const SCHEME_TYPE_WIDGET = "widget";
+const char *SCHEME_TYPE_HTTP = "http";
+const char *SCHEME_TYPE_HTTPS = "https";
+
+char const * const WARP_ERROR_MSG =
+        "file:///usr/etc/wrt/warp_security_error.msg";
+char const * const ROAMING_ERROR_MSG = "file:///usr/etc/wrt/roaming_error.msg";
+char const * const PARAM_URL = "param:url";
+char const * const ACE_IGNORED_SCHEMA[] = { "file://", "widget://", "data:",
+    "tel:", "sms:", "mmsto:", "mailto:", 0 };
+
+WKStringRef block_message = WKStringCreateWithUTF8CString("uri_block_msg");
+
+
+bool checkWARP(const char *url, int whandle)
+{
+    // ignore WARP in test mode
+    if (GlobalSettings::WarpTestModeEnabled()) {
+        return true;
+    }
+
+    if (WarpIRI::isIRISchemaIgnored(url)) {
+        // scheme is not supported by WARP
+        return true;
+    }
+
+    WrtDB::WidgetDAOReadOnly dao = WrtDB::WidgetDAOReadOnly(whandle);
+    WrtDB::WidgetAccessInfoList widgetAccessInfoList;
+    dao.getWidgetAccessInfo(widgetAccessInfoList);
+
+    return (static_cast<WidgetAccessList>(widgetAccessInfoList)).isRequiredIRI(
+            DPL::FromUTF8String(std::string(url)));
+}
+
+bool checkACE(const char* url, bool xhr, int whandle)
+{
+    if (url) {
+        for (size_t i = 0; ACE_IGNORED_SCHEMA[i]; ++i) {
+            if (0 == strncmp(url,
+                             ACE_IGNORED_SCHEMA[i],
+                             strlen(ACE_IGNORED_SCHEMA[i])))
+            {
+                return true;
+            }
+        }
+    }
+
+    const char *devCapNamesMarkup = "externalNetworkAccess";
+    const char *devCapNamesXHR = "XMLHttpRequest";
+
+    ace_request_t aceRequest;
+
+    aceRequest.widget_handle = whandle;
+
+    // TODO! We should get session id from somewhere (outside Widget Process)
+    const std::string session = "";
+    aceRequest.session_id = const_cast<ace_session_id_t>(session.c_str());
+    aceRequest.feature_list.count = 0;
+    aceRequest.dev_cap_list.count = 1;
+    aceRequest.dev_cap_list.items = new ace_dev_cap_t[1];
+
+    if (xhr) {
+        aceRequest.dev_cap_list.items[0].name =
+                const_cast<ace_string_t>(devCapNamesXHR);
+    } else {
+        aceRequest.dev_cap_list.items[0].name =
+                const_cast<ace_string_t>(devCapNamesMarkup);
+    }
+
+    aceRequest.dev_cap_list.items[0].param_list.count = 1;
+    aceRequest.dev_cap_list.items[0].param_list.items = new ace_param_t[1];
+    aceRequest.dev_cap_list.items[0].param_list.items[0].name =
+            const_cast<ace_string_t>(PARAM_URL);
+    aceRequest.dev_cap_list.items[0].param_list.items[0].value =
+            const_cast<ace_string_t>(url);
+
+
+    ace_bool_t result = ACE_FALSE;
+
+    LogDebug("Making ace check with new C-API");
+
+    ace_return_t ret = ace_check_access(&aceRequest, &result);
+
+    LogDebug("Result is: " << static_cast<int>(result));
+
+    delete [] aceRequest.dev_cap_list.items[0].param_list.items;
+    delete [] aceRequest.dev_cap_list.items;
+
+    return ACE_OK == ret && ACE_TRUE == result;
+}
+
+
+bool filterURIBySecurity(DPL::OptionalString &op_uri,
+         bool is_xhr,
+         int whandle)
+{
+    if (!op_uri)
+    {
+        return true; //accept empty uri
+    }
+
+    auto uri = DPL::ToUTF8String(*op_uri);
+    if (!checkWARP(uri.c_str(), whandle))
+    {
+        LogDebug("Request was blocked by WARP: " << uri);
+        return false;
+    }
+
+    if (!checkACE(uri.c_str(), is_xhr, whandle))
+    {
+        LogDebug("Request was blocked by ACE: " << uri);
+        return false;
+    }
+
+    return true;
+}
+
+bool checkUriRequiredNet(const std::string &uri)
+{
+    if (strstr(uri.c_str(), SCHEME_TYPE_HTTP) == uri.c_str() ||
+        strstr(uri.c_str(), SCHEME_TYPE_HTTPS) == uri.c_str())
+    {
+        return true;
+    } else {
+        return false;
+    }
+}
+
+bool filterURIByRoaming(DPL::OptionalString &opUri)
+{
+    if (opUri.IsNull())
+    {
+        return true; //accept empty uri
+    }
+
+    std::string uri = DPL::ToUTF8String(*opUri);
+    if (checkUriRequiredNet(uri))
+    {
+        if (!RoamingAgentSingleton::Instance().CheckAccess())
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+} // namespace (anonymous)
+
+namespace BundleURIHandling {
+
+DPL::Optional<DPL::String> processURI(const DPL::String& inputURI,
+        bool is_xhr, int whandle, WKBundleRef bundle)
+{
+    DPL::Optional<DPL::String> uri =
+        localizeURI(inputURI, whandle);
+
+    if (uri.IsNull())
+    {
+        LogDebug("uri is empty");
+        return uri;
+    }
+
+    // check ACE, WARP
+    if (!filterURIBySecurity(uri, is_xhr, whandle))
+    {
+        WKStringRef urlStr = WKStringCreateWithUTF8CString(
+                DPL::ToUTF8String(*uri).c_str());
+        WKTypeRef retVal = NULL;
+        // Send information about blocked URI to view_logic
+        LogInfo("Sent blocked uri to open browser later : " << uri);
+        WKBundlePostSynchronousMessage(bundle, block_message,
+                urlStr, &retVal);
+        WKRelease(urlStr);
+        WKRelease(retVal);
+        return DPL::Optional<DPL::String>::Null;
+    }
+
+    // check roaming state for external scheme
+    WrtDB::WidgetDAOReadOnly dao = WrtDB::WidgetDAOReadOnly(whandle);
+    if (dao.getWidgetType().appType == WrtDB::APP_TYPE_TIZENWEBAPP)
+    {
+        LogInfo("TizenWebApp does not need to check roaming status!");
+    }
+    else if (!filterURIByRoaming(uri))
+    {
+        LogDebug("Request was blocked by roaming settings: " << uri);
+        return DPL::Optional<DPL::String>::Null;
+    }
+
+    return uri;
+}
+
+DPL::OptionalString localizeURI(const DPL::String& inputURI,
+        int whandle)
+{
+    auto uri = DPL::ToUTF8String(inputURI);
+    LogDebug("localizing url: " << uri);
+
+    auto urlcstr = uri.c_str();
+
+    const char *end = strstr(urlcstr, ":");
+    if (!end) {
+        LogDebug("no schema in link, return null");
+        // lack of schema
+        return DPL::Optional<DPL::String>::Null;
+    }
+
+    std::string scheme(urlcstr, end);
+    if (scheme != SCHEME_TYPE_WIDGET && scheme != SCHEME_TYPE_FILE) {
+        LogDebug("scheme doesn't need to localize");
+        return DPL::OptionalString(inputURI);
+    }
+
+    DPL::Optional<DPL::String> found =
+        W3CFileLocalization::getFilePathInWidgetPackageFromUrl(
+            whandle,
+            DPL::FromUTF8String(uri));
+
+    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);
+        LogDebug("Will load resource: " << uri);
+        LogDebug("finished");
+        return DPL::OptionalString(uri);
+    }
+}
+
+} // namespace BundleURIHandling
diff --git a/src/view/webkit/bundles/bundle_uri_handling.h b/src/view/webkit/bundles/bundle_uri_handling.h
new file mode 100644 (file)
index 0000000..8fa2974
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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    bundle_uri_handling.h
+ * @author  Marcin Kaminski (marcin.ka@samsung.com)
+ * @version 1.0
+ */
+#ifndef BUNDLE_URI_HANDLING_H_
+#define BUNDLE_URI_HANDLING_H_
+
+#include <dpl/string.h>
+#include <dpl/optional_typedefs.h>
+// WKBundleRef type
+#include <WKBundle.h>
+
+namespace BundleURIHandling {
+    DPL::Optional<DPL::String> processURI(const DPL::String& inputURI,
+            bool is_xhr, int whandle, WKBundleRef bundle);
+    DPL::OptionalString localizeURI(const DPL::String& inputURI,
+            int whandle);
+}
+
+
+#endif /* BUNDLE_URI_HANDLING_H_ */
index 14ae136..4eba0df 100644 (file)
@@ -23,7 +23,7 @@
 #include "messages_names.h"
 
 #include <sstream>
-#include <ewk_context.h>
+#include <EWebKit2.h>
 #include <dpl/wrt-dao-ro/wrt_db_types.h> // definition of WidgetHandle
 #include <js_overlay_types.h>
 
index 717f6f1..23cf7bc 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef WRT_SRC_VIEW_WEBKIT2_PLUGIN_MODULE_SUPPORT_H_
 #define WRT_SRC_VIEW_WEBKIT2_PLUGIN_MODULE_SUPPORT_H_
 
-#include <ewk_context.h>
+#include <EWebKit2.h>
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
 #include <js_overlay_types.h>
 
index 2f84ab2..7bd3143 100644 (file)
@@ -29,6 +29,7 @@
 #include <WKType.h>
 #include <WKURL.h>
 #include <WKError.h>
+#include <WKURLResponseEfl.h>
 
 #include <string>
 #include <cstdio>
 #include <dpl/string.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <dpl/utils/mime_type_utils.h>
+#include <dpl/localization/LanguageTagsProvider.h>
 
 #include <wrt_plugin_module.h>
+#include <profiling_util.h>
 
 #include <vconf.h>
 #include <appcore-efl.h>
 
 #include "messages_names.h"
 
+#include <scheme.h>
+#include <scheme_action_map_type.h>
+#include <scheme_action_map_data.h>
+
+// URI localization on WebProcess side
+#include "bundle_uri_handling.h"
+
 namespace {
-const char * const willSendMessageName = "will_send_msg";
 const char * const uriChangedMessageName = "uri_changed_msg";
 const char * const URICHANGE_PLUGIN_STOP_ONLY = "plugin_stop_only";
 const char * const URICHANGE_PLUGIN_RESTART = "plugin_restart";
@@ -72,19 +81,17 @@ const char * const BASE64_STRING = ";base64,";
 }
 
 Bundle::Bundle(WKBundleRef bundle) :
-    m_willSendMessage(0),
     m_bundle(bundle),
     m_widgetHandle(-1),
     m_scale(0),
     m_encodedBundle(""),
     m_theme(""),
     m_resDec(NULL),
-    m_encrypted(false)
+    m_encrypted(false),
+    m_widgetType(WrtDB::APP_TYPE_UNKNOWN)
 {
     WrtDB::WrtDatabase::attachToThreadRO();
-    m_willSendMessage = WKStringCreateWithUTF8CString(willSendMessageName);
     m_uriChangedMessage = WKStringCreateWithUTF8CString(uriChangedMessageName);
-    LogDebug("message will be named " << toString(m_willSendMessage).c_str());
 }
 
 Bundle::~Bundle()
@@ -96,7 +103,6 @@ Bundle::~Bundle()
         LogError("There are not closed pages!");
     }
 
-    WKRelease(m_willSendMessage);
     WKRelease(m_uriChangedMessage);
     WKRelease(m_bundle);
 }
@@ -187,7 +193,19 @@ void Bundle::didCreatePage(WKBundlePageRef page)
         0, /* shouldForceUniversalAccessFromLocalURL */
     };
     WKBundlePageSetPageLoaderClient(page, &loaderClient);
-}
+
+
+    WKBundlePagePolicyClient policyClient = {
+        kWKBundlePagePolicyClientCurrentVersion,        /* version */
+        this,                                           /* clientInfo */
+        pageDecidePolicyForNavigationActionCallback,    /* decidePolicyForNavigationAction */
+        0,                                              /* decidePolicyForNewWindowAction */
+        pageDecidePolicyForResponseCallback,            /* decidePolicyForResponse */
+        0,                                              /* unableToImplementPolicy */
+    };
+    WKBundlePageSetPolicyClient(page, &policyClient);
+
+};
 
 void Bundle::willDestroyPage(WKBundlePageRef page)
 {
@@ -250,6 +268,11 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
 
             m_theme = argTheme;
         }
+
+        WrtDB::WidgetDAOReadOnly dao(m_widgetHandle);
+        m_widgetType = dao.getWidgetType();
+        LogDebug("m_widgetType : " << m_widgetType.getApptypeToString() <<
+                 "(m_widgetHandle:" << m_widgetHandle << ")");
     }
     else if (WKStringIsEqualToUTF8CString(messageName,
                                           BundleMessages::SHUTDOWN))
@@ -455,6 +478,7 @@ void Bundle::didCommitLoadForFrameCallback(
         const void *clientInfo)
 {
     LogInfo("didCommitLoadForFrameCallback called");
+    LOG_PROFILE_START("didCommitLoadForFrameCallback");
     Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
 
     WKURLRef url = WKBundleFrameCopyURL(frame);
@@ -481,16 +505,24 @@ void Bundle::didCommitLoadForFrameCallback(
         return;
     }
 
-    WKStringRef urlStr = WKURLCopyString(url);
-    WKBundlePostSynchronousMessage(This->m_bundle,
-                                   This->m_uriChangedMessage,
-                                   urlStr,
-                                   &retVal);
-    WKRelease(url);
-    WKRelease(urlStr);
+    std::string scheme = getScheme(toString(url));
+    std::string result = URICHANGE_PLUGIN_RESTART;
+
+    if (scheme == SCHEME_HTTP || scheme == SCHEME_HTTPS)
+    {
+        WKStringRef urlStr = WKURLCopyString(url);
+        WKBundlePostSynchronousMessage(This->m_bundle,
+                                       This->m_uriChangedMessage,
+                                       urlStr,
+                                       &retVal);
+        WKRelease(url);
+        WKRelease(urlStr);
+
+        result = toString(static_cast<WKStringRef>(retVal));
+    }
 
-    std::string result = toString(static_cast<WKStringRef>(retVal));
     LogInfo("result from UI process : " << result);
+
     if (result == URICHANGE_PLUGIN_STOP_ONLY)
     {
         PluginModule::stop(context);
@@ -507,6 +539,55 @@ void Bundle::didCommitLoadForFrameCallback(
 
         PluginModule::loadFrame(context);
     }
+    LOG_PROFILE_STOP("didCommitLoadForFrameCallback");
+}
+
+WKBundlePagePolicyAction Bundle::pageDecidePolicyForNavigationActionCallback(
+        WKBundlePageRef             page,
+        WKBundleFrameRef            frame,
+        WKBundleNavigationActionRef navigationAction,
+        WKURLRequestRef             request,
+        WKTypeRef*                  userData,
+        const void*                 clientInfo)
+{
+    LogDebug("pageDecidePolicyForNavigationActionCallback called");
+
+    Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
+
+    return This->pageDecidePolicyForNavigationAction(page,
+                                                     frame,
+                                                     navigationAction,
+                                                     request,
+                                                     userData);
+}
+
+WKBundlePagePolicyAction Bundle::pageDecidePolicyForResponseCallback(
+        WKBundlePageRef     /* page */,
+        WKBundleFrameRef    /* frame */,
+        WKURLResponseRef    response,
+        WKURLRequestRef     /* request */,
+        WKTypeRef*          /* userData */,
+        const void*         /* clientInfo */)
+{
+    LogDebug("pageDecidePolicyForResponseCallback called");
+
+    char const * const HTML_MIME = "text/html";
+
+    Assert(response);
+    WKStringRef contentTypeRef = WKURLResponseEflCopyContentType(response);
+
+    std::string contentType = toString(contentTypeRef);
+    LogDebug("contentTypeRef : " << contentType);
+    WKRelease(contentTypeRef);
+
+    if (contentType == HTML_MIME)
+    {
+        LogDebug("Accepting HTML_MIME type");
+
+        return WKBundlePagePolicyActionUse;
+    }
+
+    return WKBundlePagePolicyActionPassThrough;
 }
 
 WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
@@ -515,19 +596,20 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
     WKURLRef url = WKURLRequestCopyURL(request);
     WKStringRef urlStr = WKURLCopyString(url);
     WKTypeRef retVal = NULL;
-    WKBundlePostSynchronousMessage(m_bundle,
-                                   m_willSendMessage,
-                                   urlStr,
-                                   &retVal);
+
+    bool is_xhr = true; // Webkit should inform if it's XHR
+    DPL::String dplurl = DPL::FromUTF8String(toString(urlStr));
     WKRelease(urlStr);
+    DPL::Optional<DPL::String> newurl = BundleURIHandling::processURI(dplurl,
+            is_xhr, m_widgetHandle, m_bundle);
 
-    if (NULL == retVal) {
-        LogDebug("uri is blocked");
+    if (newurl.IsNull()) {
+        LogDebug("URI is blocked");
         WKRelease(url);
         return NULL;
-    } else if (retVal && WKStringGetTypeID() == WKGetTypeID(retVal)) {
-        std::string tmpUrlStr = toString(static_cast<WKStringRef>(retVal));
-        WKRelease(retVal);
+    } else {
+        LogDebug("URI processing result: " << *newurl );
+        std::string tmpUrlStr = DPL::ToUTF8String(*newurl);
         if (tmpUrlStr.empty()) {
             LogDebug("uri is blocked");
             WKRelease(url);
@@ -585,11 +667,78 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
             LogDebug("return value " << toString(req).c_str());
             return req;
         }
-    } else {
-        Assert(false && "not common case need to check work flow");
     }
 }
 
+WKBundlePagePolicyAction Bundle::pageDecidePolicyForNavigationAction(
+       WKBundlePageRef             /* page */,
+       WKBundleFrameRef            frame,
+       WKBundleNavigationActionRef /* navigationAction */,
+       WKURLRequestRef             request,
+       WKTypeRef*                  /* userData */)
+{
+    using namespace ViewModule;
+    using namespace ViewModule::SchemeActionMap;
+
+    char const * const TIZEN_SCHEME = "tizen";
+
+    std::string request_uri = toString(request);
+
+    LogInfo("Uri being checked: " << request_uri);
+
+    // get scheme string
+    std::string request_scheme = getScheme(request_uri);
+
+    // is tizen schem?
+    if ( request_scheme == TIZEN_SCHEME )
+    {
+        return WKBundlePagePolicyActionPassThrough;
+    }
+
+    // scheme action
+    Scheme scheme(request_scheme);
+    LogDebug("Scheme: " << request_scheme);
+
+    Scheme::Type type = scheme.GetType();
+    if (type < Scheme::FILE || type >= Scheme::COUNT) {
+        LogError("Invalid scheme: " << request_scheme);
+        return WKBundlePagePolicyActionPassThrough;
+    }
+
+    bool mainFrame = WKBundleFrameIsMainFrame(frame);
+    NavigationContext ctx = mainFrame ? TOP_LEVEL : FRAME_LEVEL;
+
+    LogDebug("Scheme type: " << type);
+    LogDebug("Navigation context: " << ctx);
+    LogDebug("Application type: " << m_widgetType.getApptypeToString());
+
+    UriAction action;
+
+    if (m_widgetType == WrtDB::APP_TYPE_WAC20)
+    {
+        action = g_wacActionMap[type][ctx];
+    }
+    else if (m_widgetType == WrtDB::APP_TYPE_TIZENWEBAPP)
+    {
+        action = g_tizenActionMap[type][ctx];
+    }
+    else
+    {
+        LogError("Unsupported application type: " << type);
+        return WKBundlePagePolicyActionPassThrough;
+    }
+
+    LogDebug("Uri action: " << action);
+
+    if (action == URI_ACTION_WRT)
+    {
+        return WKBundlePagePolicyActionUse;
+    }
+
+    return WKBundlePagePolicyActionPassThrough;
+
+}
+
 std::string Bundle::toString(WKStringRef str)
 {
     if (WKStringIsEmpty(str)) {
@@ -627,6 +776,19 @@ std::string Bundle::toString(WKErrorRef err)
     return str;
 }
 
+std::string Bundle::getScheme(std::string uri)
+{
+    std::size_t found = uri.find(':');
+    std::string str;
+
+    if (found != std::string::npos)
+    {
+        str = uri.substr(0, found);
+    }
+
+    return str;
+}
+
 bool Bundle::isEncryptedResource(std::string Url, int &size)
 {
     std::string filePath;
@@ -717,19 +879,9 @@ std::string Bundle::DecryptResource(std::string resource, int size)
 namespace {
 static int LanguageChanged(void *)
 {
-    char* lang = vconf_get_str(VCONFKEY_LANGSET);
-    if (!lang) {
-        LogError("Cannot get locale settings from vconf");
-        return 0;
-    }
-    LogDebug("Language set to: " << lang);
-
-    LanguageTagsList list;
-    list.push_back(DPL::FromUTF8String(lang));
-    LocalizationUtils::SetSystemLanguageTags(list);
-
-    LogDebug("LanguageChanged to " << lang);
-
+    /* Language Tags reseting removed from this place
+     * as it's done in wrt-client before widget start page reload
+     * (see: languageChangedCallback() in wrt-client.cpp) */
     return 0;
 }
 
@@ -739,8 +891,6 @@ void Initialize()
         APPCORE_EVENT_LANG_CHANGE,
         &LanguageChanged,
         NULL);
-
-    LanguageChanged(NULL); // updating language for the first time
 }
 
 }
index 02ba37c..53dd8d1 100644 (file)
@@ -27,6 +27,7 @@
 #include <string>
 #include <WKBundle.h>
 #include <WKPageLoadTypes.h>
+#include <WKBundlePage.h>
 #include <dpl/string.h>
 #include <dpl/encryption/resource_decryption.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
@@ -56,7 +57,6 @@ class Bundle {
             const void *clientInfo);
 
   private:
-    WKStringRef m_willSendMessage;
     WKStringRef m_uriChangedMessage;
     WKBundleRef m_bundle;
 
@@ -75,6 +75,7 @@ class Bundle {
     bool m_encrypted;
     WRTDecryptor::ResourceDecryptor *m_resDec;
     WrtDB::EncryptedFileList m_encryptedFiles;
+    WrtDB::WidgetType m_widgetType;
 
     // WKBundlePageResourceLoadClient callback
     static WKURLRequestRef willSendRequestForFrameCallback(
@@ -111,6 +112,24 @@ class Bundle {
             WKTypeRef*,
             const void *clientInfo);
 
+    // WKBundlePageDecidePolicyForNavigationActionCallback
+    static WKBundlePagePolicyAction pageDecidePolicyForNavigationActionCallback(
+            WKBundlePageRef page,
+            WKBundleFrameRef frame,
+            WKBundleNavigationActionRef navigationAction,
+            WKURLRequestRef request,
+            WKTypeRef* userData,
+            const void* clientInfo);
+
+    // WKBundlePageDecidePolicyForResponseCallback
+    static WKBundlePagePolicyAction pageDecidePolicyForResponseCallback(
+        WKBundlePageRef page,
+        WKBundleFrameRef frame,
+        WKURLResponseRef response,
+        WKURLRequestRef request,
+        WKTypeRef* userData,
+        const void* clientInfo);
+
     // WKBundleClient
     void didCreatePage(WKBundlePageRef page);
     void willDestroyPage(WKBundlePageRef page);
@@ -120,12 +139,19 @@ class Bundle {
 
     // WKBundlePageResourceLoadClient
     WKURLRequestRef willSendRequestForFrame(WKURLRequestRef request);
+    WKBundlePagePolicyAction pageDecidePolicyForNavigationAction(
+        WKBundlePageRef             page,
+        WKBundleFrameRef            frame,
+        WKBundleNavigationActionRef navigationAction,
+        WKURLRequestRef             request,
+        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);
+    static std::string getScheme(std::string uri);
 
     bool isEncryptedResource(std::string Url, int &size);
     std::string DecryptResource(std::string resource, int size);
index 0a8fa97..f826247 100644 (file)
 #include <common/view_logic_web_notification_support.h>
 #include <view_logic_scheme_support.h>
 #include "view_logic_geolocation_support_webkit2.h"
-#include "view_logic_utils.h"
 #include "bundles/plugin_module_support.h"
 
-#include <ewk_context.h>
-#include <ewk_context_menu.h>
-#include <ewk_form_data.h>
-#include <ewk_network.h>
-#include <ewk_notification.h>
-#include <ewk_view.h>
-#include <ewk_setting.h>
-
-#include <WebKit2.h>
-#include <WKPage.h>
-#include <WKContextMenuItem.h>
-#include <WKURLResponseEfl.h>
-#include <WKURLRequestEfl.h>
+#include <EWebKit2.h>
 #include <js_overlay_types.h>
 #include <i_runnable_widget_object.h>
-
+#include <PopupInvoker.h>
+#include <profiling_util.h>
 
 namespace {
 const char * const bundlePath = "/usr/lib/wrt-wk2-bundles/libwrt-wk2-bundle.so";
-const char * const willSendMessageName = "will_send_msg";
+const char * const uriBlockedMessageName = "uri_block_msg";
 const char * const uriChangedMessageName = "uri_changed_msg";
 const char * const URICHANGE_PLUGIN_STOP_ONLY = "plugin_stop_only";
 const char * const URICHANGE_PLUGIN_RESTART = "plugin_restart";
@@ -81,20 +69,59 @@ const char * const URICHANGE_BLOCKED_URL = "null";
 const char* PATTERN_URI_CHANGE = "^(([^:/\\?#]+)://[^\\?#]*)";
 const int MAX_NUM_CONTEXT_MENU_ITEMS = 10;
 
-// ewk callback
+// WKPageLoaderClient
+const char * const EWK_LOAD_STARTED = "load,started";
+const char * const EWK_LOAD_FINISHED = "load,finished";
+const char * const EWK_TITLE_CHANGED = "title,changed";
+const char * const EWK_LOAD_PROGRESS = "load,progress";
+const char * const EWK_LOAD_PROGRESS_FINISHED = "load,progress,finished";
+const char * const EWK_PROCESS_CRASHED = "process,crashed";
+// WKPageUIClient
 const char * const EWK_CREATE_WINDOW = "create,window";
 const char * const EWK_CLOSE_WINDOW = "close,window";
+// WKPagePolicyClient
+const char * const EWK_POLICY_NAVIGATION_DECIDE = "policy,navigation,decide";
+const char * const EWK_POLICY_NEWWINDOW_DECIDE = "policy,newwindow,decide";
+const char * const EWK_POLICY_RESPONSE_DECIDE = "policy,response,decide";
+// WKPageContextMenuClient
 const char * const EWK_CONTEXTMENU_CUSTOMIZE = "contextmenu,customize";
+// WKPageFormClient
 const char * const EWK_FORM_SUBMIT = "form,submit";
+// EWK Geolocation Callback
 const char * const EWK_REQUEST_GEOLOCATION_PERMISSION =
     "request,geolocation,permission";
+// EWK Notification Callback
 const char * const EWK_NOTIFICATION_SHOW = "notification,show";
 const char * const EWK_NOTIFICATION_CANCEL = "notification,cancel";
 const char * const EWK_NOTIFICATION_PERMISSION_REQUEST =
     "notification,permission,request";
+// EWK Vibration Callback
 const char * const EWK_VIBRATION_VIBRATE = "vibration,vibrate";
 const char * const EWK_VIBRATION_CANCEL = "vibration,cancel";
 
+const char * const EWK_CONTEXT_EXCEEDED_QUOATA  = "database,quota,exceeded";
+const char * const EWK_CONTEXT_FILE_SYSTEM_PERMISSION = "filesystem,permission,request";
+const char * const EWK_FULLSCREEN_ENTER = "fullscreen,enterfullscreen";
+const char * const EWK_FULLSCREEN_EXIT = "fullscreen,exitfullscreen";
+
+// DataBase Use Ask Title
+const char * const DATABASE_USE_ASK_TITLE = "Increase Database Size?";
+const char * const FILESYSTEM_USE_ASK_TITLE = "Use FileSystem?";
+}
+
+ViewLogic::ViewLogic():
+    m_ewkContext(0),
+    m_currentEwkView(0),
+    m_window(NULL),
+    m_model(0),
+    m_cbs(new WRT::UserDelegates),
+    m_appsSupport(new ViewModule::AppsSupport()),
+    m_vibrationSupport(new ViewModule::VibrationSupport())
+{
+}
+
+ViewLogic::~ViewLogic ()
+{
 }
 
 void ViewLogic::createWebView(Ewk_Context* context,
@@ -155,33 +182,6 @@ void ViewLogic::prepareView(WidgetModel* m, const std::string &startUrl)
     initializePluginLoading();
 }
 
-void ViewLogic::initializePluginLoading()
-{
-    // inform wrt information for plugin loading to web process
-    PluginModuleSupport::start(
-        m_ewkContext,
-        m_model->Handle.Get(),
-        elm_config_scale_get(),
-        ApplicationDataSingleton::Instance().getEncodedBundle(),
-        m_theme.c_str(),
-        m_model->SettingList.Get().isEncrypted());
-}
-
-void ViewLogic::initializeSupport()
-{
-    // set local stroage database path
-    WrtDB::WidgetDAOReadOnly dao(m_model->Handle.Get());
-    ewk_context_web_storage_path_set(m_ewkContext,
-                                     dao.getPrivateLocalStoragePath().c_str());
-    m_schemeSupport.reset(new SchemeSupport(m_model->Type.Get().appType));
-    ViewModule::StorageSupport::initializeStorage(m_model);
-    m_appsSupport->initialize(m_model);
-    m_vibrationSupport->initialize();
-    ViewModule::GeolocationSupport::Webkit2::initialize(m_model->Handle.Get());
-    ViewModule::GeolocationSupport::Webkit2::
-        adjustGeolocationModuleState(m_currentEwkView);
-}
-
 void ViewLogic::showWidget()
 {
     LogDebug("showing widget");
@@ -198,17 +198,10 @@ void ViewLogic::showWidget()
                           &ViewLogic::disconnectNetworkConnectionsFunction));
 
     // load page
-    WKURLRef baseUrl = WKURLCreateWithUTF8CString(
-        m_currentUri.c_str());
-    if (!baseUrl) {
-        LogError("URL creation failed");
-        return;
-    }
-    WKPageLoadURL(ewk_view_WKPage_get(m_currentEwkView), baseUrl);
-    WKRelease(baseUrl);
+    ewk_view_uri_set(m_currentEwkView, m_currentUri.c_str());
 
-    if (m_cbs->bufferSet) {
-        m_cbs->bufferSet(m_currentEwkView, m_cbsData);
+    if (!m_cbs->bufferSet.empty()) {
+        m_cbs->bufferSet(m_currentEwkView);
     }
 }
 
@@ -240,8 +233,8 @@ void ViewLogic::suspendWidget()
     }
 
     // call user callback
-    if (m_cbs->suspend) {
-        m_cbs->suspend(true, m_cbsData);
+    if (!m_cbs->suspend.empty()) {
+        m_cbs->suspend(true);
     }
 };
 
@@ -260,8 +253,8 @@ void ViewLogic::resumeWidget()
     evas_object_focus_set(m_currentEwkView, EINA_TRUE);
 
     // call user callback
-    if (m_cbs->resume) {
-        m_cbs->resume(true, m_cbsData);
+    if (!m_cbs->resume.empty()) {
+        m_cbs->resume(true);
     }
 };
 
@@ -329,29 +322,22 @@ void ViewLogic::resetWidget()
         m_model->SettingList.Get().isEncrypted());
 
     // load page
-    WKURLRef baseUrl = WKURLCreateWithUTF8CString(
-        m_currentUri.c_str());
-    if (!baseUrl) {
-        LogError("URL creation failed");
-        return;
-    }
-    WKPageLoadURL(ewk_view_WKPage_get(m_currentEwkView), baseUrl);
-    WKRelease(baseUrl);
+    ewk_view_uri_set(m_currentEwkView, m_currentUri.c_str());
     resumeWebkit(m_currentEwkView);
 
     // call user callback
-    if (m_cbs->reset) {
-        m_cbs->reset(true, m_cbsData);
+    if (!m_cbs->reset.empty()) {
+        m_cbs->reset(true);
     }
-    if (m_cbs->bufferSet) {
-        m_cbs->bufferSet(m_currentEwkView, m_cbsData);
+    if (!m_cbs->bufferSet.empty()) {
+        m_cbs->bufferSet(m_currentEwkView);
     }
 }
 
-void ViewLogic::goBack()
+void ViewLogic::backward()
 {
-    if (WKPageCanGoBack(ewk_view_WKPage_get(m_currentEwkView))) {
-        WKPageGoBack(ewk_view_WKPage_get(m_currentEwkView));
+    if (ewk_view_back_possible(m_currentEwkView)) {
+        ewk_view_back(m_currentEwkView);
     } else {
         if (1 >= m_ewkViewList.size()) {
             // If there is no previous page, widget move to backgroud.
@@ -365,29 +351,35 @@ void ViewLogic::goBack()
     }
 }
 
+void ViewLogic::reload()
+{
+    ewk_view_reload(m_currentEwkView);
+}
+
+void ViewLogic::forward()
+{
+    if (ewk_view_forward_possible(m_currentEwkView)) {
+        ewk_view_forward(m_currentEwkView);
+    }
+}
+
 void ViewLogic::reloadStartPage()
 {
     LogInfo("Reload Start Page");
 
-    if (m_ewkViewList.size() == 0)
-    {
+    if (m_ewkViewList.size() == 0) {
         // create new webview
         createEwkView();
         ewkClientInit(m_currentEwkView);
-    }
-    else
-    {
+    } else {
         // close opened windows
-        while (m_ewkViewList.size() > 1)
-        {
-            if (m_cbs->bufferUnset) {
-                m_cbs->bufferUnset(m_currentEwkView, m_cbsData);
+        while (m_ewkViewList.size() > 1) {
+            if (!m_cbs->bufferUnset.empty()) {
+                m_cbs->bufferUnset(m_currentEwkView);
             }
             removeEwkView(m_currentEwkView);
-
             m_currentEwkView = m_ewkViewList.back();
         }
-
         LogInfo("Close ewkViews done : m_ewkViewList.size() = "
                 << m_ewkViewList.size());
     }
@@ -397,23 +389,12 @@ void ViewLogic::reloadStartPage()
     initializePluginLoading();
 
     // load page
-    WKURLRef baseUrl = WKURLCreateWithUTF8CString(m_currentUri.c_str());
-
-    if (!baseUrl)
-    {
-        LogError("URL creation failed");
-        return;
-    }
-
-    WKPageLoadURL(ewk_view_WKPage_get(m_currentEwkView), baseUrl);
-    WKRelease(baseUrl);
+    ewk_view_uri_set(m_currentEwkView, m_currentUri.c_str());
 
     // show ewkView
-    if (m_cbs->bufferSet)
-    {
-        m_cbs->bufferSet(m_currentEwkView, m_cbsData);
+    if (!m_cbs->bufferSet.empty()) {
+        m_cbs->bufferSet(m_currentEwkView);
     }
-
     LogInfo("Reloading Start Page is done!");
 }
 
@@ -423,10 +404,9 @@ Evas_Object* ViewLogic::getCurrentWebview()
     return m_currentEwkView;
 }
 
-void ViewLogic::setUserCallbacks(WRT::UserCallbacksPtr cbs, void *data)
+void ViewLogic::setUserCallbacks(const WRT::UserDelegatesPtr& cbs)
 {
     m_cbs = cbs;
-    m_cbsData = data;
 }
 
 void ViewLogic::initializeEwkContext(Ewk_Context* newEwkContext)
@@ -463,23 +443,7 @@ void ViewLogic::initializeEwkContext(Ewk_Context* newEwkContext)
         LogInfo("theme is " << m_theme);
     }
 
-    // set download callback
-    //WKContextDownloadClient downloadClient = {
-    //        kWKContextDownloadClientCurrentVersion,
-    //        ewkContext,
-    //        didStartDownload,
-    //        0, // didReceiveAuthenticationChallenge
-    //        0, // didReceiveResponse
-    //        0, // didReceiveData
-    //        0, // shouldDecodeSourceDataOfMIMEType
-    //        0, // decideDestinationWithSuggestedFilename
-    //        0, // didCreateDestination
-    //        0, // didFinish
-    //        0, // didFail
-    //        0, // didCancel
-    //        0 // processDidCrash
-    //    };
-    //    WKContextSetDownloadClient(newEwkContext, &downloadClient);
+    // Ewk download callback (WKContextDownloadClient)
     ewk_context_did_start_download_callback_set(
         newEwkContext,
         didStartDownloadCallback,
@@ -492,117 +456,79 @@ void ViewLogic::initializeEwkContext(Ewk_Context* newEwkContext)
 void ViewLogic::finalizeEwkContext()
 {
     LogInfo("finalizeEwkContext called");
-    ewk_context_delete(m_ewkContext);
-    m_ewkContext = 0;
+    ewk_context_message_from_injected_bundle_callback_set(
+            m_ewkContext,
+            NULL,
+            NULL);
+//    ewk_context_delete(m_ewkContext);
+//    m_ewkContext = 0;
 }
 
-
-ViewLogic::ViewLogic():
-    m_ewkContext(0),
-    m_currentEwkView(0),
-    m_model(0),
-    m_emptyView(false),
-    m_appsSupport(new ViewModule::AppsSupport()),
-    m_vibrationSupport(new ViewModule::VibrationSupport()),
-    m_window(NULL),
-    m_cbs(new WRT::UserCallbacks),
-    m_cbsData(NULL)
+void ViewLogic::initializeSupport()
 {
+    // set local stroage database path
+    WrtDB::WidgetDAOReadOnly dao(m_model->Handle.Get());
+    ewk_context_web_storage_path_set(m_ewkContext,
+                                     dao.getPrivateLocalStoragePath().c_str());
+    m_schemeSupport.reset(new SchemeSupport(m_model->Type.Get().appType));
+    ViewModule::StorageSupport::initializeStorage(m_model);
+    m_appsSupport->initialize(m_model);
+    m_vibrationSupport->initialize();
+    ViewModule::GeolocationSupport::Webkit2::initialize(m_model->TizenId.Get());
+    ViewModule::GeolocationSupport::Webkit2::
+        adjustGeolocationModuleState(m_currentEwkView);
 }
 
-ViewLogic::~ViewLogic ()
+void ViewLogic::initializePluginLoading()
 {
+    // inform wrt information for plugin loading to web process
+    PluginModuleSupport::start(
+        m_ewkContext,
+        m_model->Handle.Get(),
+        elm_config_scale_get(),
+        ApplicationDataSingleton::Instance().getEncodedBundle(),
+        m_theme.c_str(),
+        m_model->SettingList.Get().isEncrypted());
 }
 
 void ViewLogic::ewkClientInit(Evas_Object *wkView) {
     Assert(NULL != wkView && "ewk_view not created at this point");
-
     ViewModule::GeolocationSupport::Webkit2::
-        initialize(m_model->Handle.Get());
-
-    WKPageLoaderClient loaderClient = {
-        kWKPageLoaderClientCurrentVersion, /* version */
-        static_cast<void*>(this), /* clientinfo */
-        didStartProvisionalLoadForFrameCallback, /* didStartProvisionalLoadForFrame */
-        0, /* didReceiveServerRedirectForProvisionalLoadForFrame */
-        0, /* didFailProvisionalLoadWithErrorForFrame */
-        0, /* didCommitLoadForFrame */
-        0, /* didFinishDocumentLoadForFrame */
-        didFinishLoadForFrameCallback, /* didFinishLoadForFrame */
-        0, /* didFailLoadWithErrorForFrame */
-        0, /* didSameDocumentNavigationForFrame */
-        didReceiveTitleForFrameCallback, /* didReceiveTitleForFrame */
-        0, /* didFirstLayoutForFrame */
-        0, /* didFirstVisuallyNonEmptyLayoutForFrame */
-        0, /* didRemoveFrameFromHierarchy */
-        0, /* didDisplayInsecureContentForFrame */
-        0, /* didRunInsecureContentForFrame */
-        0, /* canAuthenticateAgainstProtectionSpaceInFrame */
-        0, /* didReceiveAuthenticationChallengeInFrame */
-        didStartProgressCallback, /* didStartProgressCallback */
-        didChangeProgressCallback, /* didChangeProgress */
-        didFinishProgressCallback, /* didFinishProgress */
-        0, /* processDidBecomeUnresponsive */
-        0, /* processDidBecomeResponsive */
-        processDidCrashCallback, /* processDidCrash */
-        0, /* didChangeBackForwardList */
-        0, /* shouldGoToBackForwardListItem */
-        0, /* didFailToInitializePlugin */
-        0, /* didDetectXSSForFrame */
-        0, /* didNewFirstVisuallyNonEmptyLayout */
-        0, /* willGoToBackForwardListItem */
-        0, /* interactionOccurredWhileProcessUnresponsive */
-        0, /* pluginDidFail */
-    };
-    WKPageSetPageLoaderClient(ewk_view_WKPage_get(wkView), &loaderClient);
-
-    //WKPageUIClient uiClient = {
-    //    kWKPageUIClientCurrentVersion, /* version */
-    //    static_cast<void*>(this), /* clientInfo */
-    //    0,  /* createNewPage_deprecatedForUseWithV0 */
-    //    0, /* showPage*/
-    //    closeCallback, /* close */
-    //    0, /* takeFocus */
-    //    0, /* focus */
-    //    0, /* unfocus */
-    //    0, /* runJavaScriptAlert */
-    //    0, /* runJavaScriptConfirm */
-    //    0, /* runJavaScriptPrompt */
-    //    0, /* setStatusText */
-    //    0, /* mouseDidMoveOverElement */
-    //    0, /* missingPluginButtonClicked */
-    //    0, /* didNotHandleKeyEvent */
-    //    0, /* didNotHandleWheelEvent */
-    //    0, /* toolbarsAreVisible */
-    //    0, /* setToolbarsAreVisible */
-    //    0, /* menuBarIsVisible */
-    //    0, /* setMenuBarIsVisible */
-    //    0, /* statusBarIsVisible */
-    //    0, /* setStatusBarIsVisible */
-    //    0, /* isResizable */
-    //    0, /* setIsResizable */
-    //    0, /* getWindowFrame */
-    //    0, /* setWindowFrame */
-    //    0, /* runBeforeUnloadConfirmPanel */
-    //    0, /* didDraw */
-    //    0, /* pageDidScroll */
-    //    0, /* exceededDatabaseQuota */
-    //    0, /* runOpenPanel */
-    //    decidePolicyForGeolocationPermissionRequestCallback, /* decidePolicyForGeolocationPermissionRequest */
-    //    0, /* headerHeight */
-    //    0, /* footerHeight */
-    //    0, /* drawHeader */
-    //    0, /* drawFooter */
-    //    0, /* printFrame */
-    //    0, /* runModal */
-    //    0, /* didCompleteRubberBandForMainFrame */
-    //    0, /* saveDataToFileInDownloadsFolder */
-    //    0, /* shouldInterruptJavaScript */
-    //    createNewPageCallback,  /* createNewPage */
-    //    0, /* mouseDidMoveOverElement */
-    //    decidePolicyForNotificationPermissionRequestCallback, /* decidePolicyForNotificationPermissionRequest */
-    //};
-    //WKPageSetPageUIClient(ewk_view_page_get(wkView), &uiClient);
+        initialize(m_model->TizenId.Get());
+
+    // WKPageLoaderClient
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_LOAD_STARTED,
+        loadStartedCallback,
+        this);
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_LOAD_FINISHED,
+        loadFinishedCallback,
+        this);
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_TITLE_CHANGED,
+        titleChangedCallback,
+        this);
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_LOAD_PROGRESS,
+        loadProgressCallback,
+        this);
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_LOAD_PROGRESS_FINISHED,
+        loadProgressFinishedCallback,
+        this);
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_PROCESS_CRASHED,
+        processCrashedCallback,
+        this);
+
+    // WKPageUIClient
     evas_object_smart_callback_add(
         wkView,
         EWK_CREATE_WINDOW,
@@ -614,40 +540,31 @@ void ViewLogic::ewkClientInit(Evas_Object *wkView) {
         closeWindowCallback,
         this);
 
-    WKPagePolicyClient policyClient = {
-        kWKPagePolicyClientCurrentVersion, /* version */
-        static_cast<void*>(this), /* clientInfo */
-        pageDecidePolicyForNavigationActionCallback, /* decidePolicyForNavigationAction */
-        pageDecidePolicyForNewWindowActionCallback, /* decidePolicyForNewWindowAction */
-        pageDecidePolicyForResponseCallback,
-        0,  /* unableToImplementPolicy */
-    };
-    WKPageSetPagePolicyClient(ewk_view_WKPage_get(wkView),
-                              &policyClient);
-
-    // EWK ContextMenu Callback
-    //WKPageContextMenuClient contextMenuClient = {
-    //    kWKPageContextMenuClientCurrentVersion, /* version */
-    //    static_cast<void*>(this), /* clientInfo */
-    //    0, /* getContextMenuFromProposedMenu_deprecatedForUseWithV0 */
-    //    0, /* customContextMenuItemSelected */
-    //    0, /* contextMenuDismissed */
-    //    pageContextMenuForGetMenuCallback /* getContextMenuFromProposedMenu */
-    //};
-    //WKPageSetPageContextMenuClient(ewk_view_page_get(wkView),
-    //                               &contextMenuClient);
+    // WKPagePolicyClient
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_POLICY_NAVIGATION_DECIDE,
+        policyNavigationDecideCallback,
+        this);
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_POLICY_NEWWINDOW_DECIDE,
+        policyNewWindowDecideCallback,
+        this);
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_POLICY_RESPONSE_DECIDE,
+        pageResponseDecideCallback,
+        this);
+
+    // WKPageContextMenuClient
     evas_object_smart_callback_add(
         wkView,
         EWK_CONTEXTMENU_CUSTOMIZE,
         contextmenuCustomizeCallback,
         this);
 
-    // WKPageFormClient formClient = {
-    //     kWKPageFormClientCurrentVersion, /* version */
-    //     static_cast<void*>(this), /* clientInfo */
-    //     willSubmitFormCallback, /* willSubmitForm */
-    // };
-    // WKPageSetPageFormClient(ewk_view_page_get(wkView), &formClient);
+    // WKPageFormClient
     evas_object_smart_callback_add(
         wkView,
         EWK_FORM_SUBMIT,
@@ -655,35 +572,13 @@ void ViewLogic::ewkClientInit(Evas_Object *wkView) {
         this);
 
     // EWK Geolocation Callback
-    //WKGeolocationProvider geolocation_provider = {
-    //    kWKGeolocationProviderCurrentVersion,
-    //    this,
-    //    startUpdatingCallback,
-    //    stopUpdatingCallback
-    //};
-    //WKGeolocationManagerRef geolocation_manager_ref
-    //    = WKContextGetGeolocationManager(m_wkctx);
-    //WKGeolocationManagerSetProvider(geolocation_manager_ref,
-    //        &geolocation_provider);
     evas_object_smart_callback_add(
         wkView,
         EWK_REQUEST_GEOLOCATION_PERMISSION,
         geolocationPermissionRequestCallback,
         this);
+
     // EWK Notification Callback
-    //WKNotificationProvider notificationProvider = {
-    //    kWKNotificationProviderCurrentVersion, /* version */
-    //    static_cast<void*>(this), /* clientinfo */
-    //    showNotificationCallback, /* show */
-    //    0, /* cancel */
-    //    0, /* didDestroyNotification */
-    //    0, /* addNotificationManager */
-    //    0, /* removeNotificationManager */
-    //    0, /* notificationPermissions */
-    //    0, /* clearNotifications */
-    //};
-    //WKNotificationManagerSetProvider(WKContextGetNotificationManager(m_wkctx),
-    //                                 &notificationProvider);
     evas_object_smart_callback_add(
         wkView,
         EWK_NOTIFICATION_SHOW,
@@ -699,6 +594,8 @@ void ViewLogic::ewkClientInit(Evas_Object *wkView) {
         EWK_NOTIFICATION_PERMISSION_REQUEST,
         notificationPermissionRequestCallback,
         this);
+
+    // EWK Vibration Callback
     evas_object_smart_callback_add(
         wkView,
         EWK_VIBRATION_VIBRATE,
@@ -709,104 +606,68 @@ void ViewLogic::ewkClientInit(Evas_Object *wkView) {
         EWK_VIBRATION_CANCEL,
         vibrationCancelCallback,
         this);
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_CONTEXT_EXCEEDED_QUOATA,
+        databaseUsagePermissionRequestCallback,
+        this);
+    // The followings are provisional comment for preventing popup
+    //evas_object_smart_callback_add(
+        //wkView,
+        //EWK_CONTEXT_FILE_SYSTEM_PERMISSION,
+        //fileSystemPermissionRequestCallback,
+        //this);
 
     // EWK Orientation Callback
     ewk_view_orientation_lock_callback_set(
         wkView,
         orientationLockCallback,
         this);
+
+    // Fullscreen API callbacks
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_FULLSCREEN_ENTER,
+        enterFullscreenCallback,
+        this);
+    evas_object_smart_callback_add(
+        wkView,
+        EWK_FULLSCREEN_EXIT,
+        exitFullscreenCallback,
+        this);
 }
 
 void ViewLogic::ewkClientDeinit(Evas_Object *wkView) {
     LogDebug("ewkClientDeinit");
     Assert(NULL != wkView && "ewk_view not created at this point");
 
-    // deinit WKPageLoaderClient
-    WKPageLoaderClient loaderClient = {
-        0, /* version */
-        0, /* clientinfo */
-        0, /* didStartProvisionalLoadForFrame */
-        0, /* didReceiveServerRedirectForProvisionalLoadForFrame */
-        0, /* didFailProvisionalLoadWithErrorForFrame */
-        0, /* didCommitLoadForFrame */
-        0, /* didFinishDocumentLoadForFrame */
-        0, /* didFinishLoadForFrame */
-        0, /* didFailLoadWithErrorForFrame */
-        0, /* didSameDocumentNavigationForFrame */
-        0, /* didReceiveTitleForFrame */
-        0, /* didFirstLayoutForFrame */
-        0, /* didFirstVisuallyNonEmptyLayoutForFrame */
-        0, /* didRemoveFrameFromHierarchy */
-        0, /* didDisplayInsecureContentForFrame */
-        0, /* didRunInsecureContentForFrame */
-        0, /* canAuthenticateAgainstProtectionSpaceInFrame */
-        0, /* didReceiveAuthenticationChallengeInFrame */
-        0, /* didStartProgressCallback */
-        0, /* didChangeProgress */
-        0, /* didFinishProgress */
-        0, /* processDidBecomeUnresponsive */
-        0, /* processDidBecomeResponsive */
-        0, /* processDidCrash */
-        0, /* didChangeBackForwardList */
-        0, /* shouldGoToBackForwardListItem */
-        0, /* didFailToInitializePlugin */
-        0, /* didDetectXSSForFrame */
-        0, /* didNewFirstVisuallyNonEmptyLayout */
-        0, /* willGoToBackForwardListItem */
-        0, /* interactionOccurredWhileProcessUnresponsive */
-        0, /* pluginDidFail */
-    };
-    WKPageSetPageLoaderClient(ewk_view_WKPage_get(wkView),
-                              &loaderClient);
-
-    // deinit WKPageUIClient
-    //WKPageUIClient uiClient = {
-    //    0, /* version */
-    //    0, /* clientInfo */
-    //    0,  /* createNewPage_deprecatedForUseWithV0 */
-    //    0, /* showPage*/
-    //    0, /* close */
-    //    0, /* takeFocus */
-    //    0, /* focus */
-    //    0, /* unfocus */
-    //    0, /* runJavaScriptAlert */
-    //    0, /* runJavaScriptConfirm */
-    //    0, /* runJavaScriptPrompt */
-    //    0, /* setStatusText */
-    //    0, /* mouseDidMoveOverElement */
-    //    0, /* missingPluginButtonClicked */
-    //    0, /* didNotHandleKeyEvent */
-    //    0, /* didNotHandleWheelEvent */
-    //    0, /* toolbarsAreVisible */
-    //    0, /* setToolbarsAreVisible */
-    //    0, /* menuBarIsVisible */
-    //    0, /* setMenuBarIsVisible */
-    //    0, /* statusBarIsVisible */
-    //    0, /* setStatusBarIsVisible */
-    //    0, /* isResizable */
-    //    0, /* setIsResizable */
-    //    0, /* getWindowFrame */
-    //    0, /* setWindowFrame */
-    //    0, /* runBeforeUnloadConfirmPanel */
-    //    0, /* didDraw */
-    //    0, /* pageDidScroll */
-    //    0, /* exceededDatabaseQuota */
-    //    0, /* runOpenPanel */
-    //    0, /* decidePolicyForGeolocationPermissionRequest */
-    //    0, /* headerHeight */
-    //    0, /* footerHeight */
-    //    0, /* drawHeader */
-    //    0, /* drawFooter */
-    //    0, /* printFrame */
-    //    0, /* runModal */
-    //    0, /* didCompleteRubberBandForMainFrame */
-    //    0, /* saveDataToFileInDownloadsFolder */
-    //    0, /* shouldInterruptJavaScript */
-    //    0,  /* createNewPage */
-    //    0, /* mouseDidMoveOverElement */
-    //    0, /* decidePolicyForNotificationPermissionRequest */
-    //};
-    //WKPageSetPageUIClient(ewk_view_page_get(wkView), &uiClient);
+    // WKPageLoaderClient
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_LOAD_STARTED,
+        loadStartedCallback);
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_LOAD_FINISHED,
+        loadFinishedCallback);
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_TITLE_CHANGED,
+        titleChangedCallback);
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_LOAD_PROGRESS,
+        loadProgressCallback);
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_LOAD_PROGRESS_FINISHED,
+        loadProgressFinishedCallback);
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_PROCESS_CRASHED,
+        loadProgressCallback);
+
+    // WKPageUIClient
     evas_object_smart_callback_del(
         wkView,
         EWK_CREATE_WINDOW,
@@ -816,40 +677,38 @@ void ViewLogic::ewkClientDeinit(Evas_Object *wkView) {
         EWK_CLOSE_WINDOW,
         closeWindowCallback);
 
+    // WKPagePolicyClient
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_POLICY_NAVIGATION_DECIDE,
+        policyNavigationDecideCallback);
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_POLICY_NEWWINDOW_DECIDE,
+        policyNewWindowDecideCallback);
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_POLICY_RESPONSE_DECIDE,
+        pageResponseDecideCallback);
 
-    // deinit WKPagePolicyClient
-    WKPagePolicyClient policyClient = {
-        0, /* version */
-        0, /* clientInfo */
-        0, /* decidePolicyForNavigationAction */
-        0, /* decidePolicyForNewWindowAction */
-        0, /* decidePolicyForResponse */
-        0,  /* unableToImplementPolicy */
-    };
-    WKPageSetPagePolicyClient(ewk_view_WKPage_get(wkView),
-                              &policyClient);
-
-    // EWK ContextMenu Callback
+    // WKPageContextMenuClient
     evas_object_smart_callback_del(
         wkView,
         EWK_CONTEXTMENU_CUSTOMIZE,
         contextmenuCustomizeCallback);
-    // deinit WKPageFormClient
-    // WKPageFormClient formClient = {
-    //     0, /* version */
-    //     0, /* clientInfo */
-    //     0, /* willSubmitForm */
-    // };
-    // WKPageSetPageFormClient(ewk_view_page_get(wkView), &formClient);
+
+    // WKPageFormClient
     evas_object_smart_callback_del(
         wkView,
         EWK_FORM_SUBMIT,
         formSubmitCallback);
+
     // EWK Geolocation Callback
     evas_object_smart_callback_del(
         wkView,
         EWK_REQUEST_GEOLOCATION_PERMISSION,
         geolocationPermissionRequestCallback);
+
     // EWK Notification Callback
     evas_object_smart_callback_del(
         wkView,
@@ -864,6 +723,7 @@ void ViewLogic::ewkClientDeinit(Evas_Object *wkView) {
         EWK_NOTIFICATION_PERMISSION_REQUEST,
         notificationPermissionRequestCallback);
 
+    // EWK Vibration Callback
     evas_object_smart_callback_del(
         wkView,
         EWK_VIBRATION_VIBRATE,
@@ -873,6 +733,16 @@ void ViewLogic::ewkClientDeinit(Evas_Object *wkView) {
         EWK_VIBRATION_CANCEL,
         vibrationCancelCallback);
 
+    evas_object_smart_callback_del(
+        wkView,
+        EWK_CONTEXT_EXCEEDED_QUOATA,
+        databaseUsagePermissionRequestCallback);
+    //The followings are provisional comment for preventing popup
+    //evas_object_smart_callback_del(
+        //wkView,
+        //EWK_CONTEXT_FILE_SYSTEM_PERMISSION,
+        //fileSystemPermissionRequestCallback);
+
     // EWK Orientation Callback
     ewk_view_orientation_lock_callback_set(
         wkView,
@@ -899,7 +769,6 @@ void ViewLogic::createEwkView()
 
     m_ewkViewList.push_back(newEwkView);
     m_currentEwkView = newEwkView;
-    m_emptyView = true;
 }
 
 void ViewLogic::setStartPage()
@@ -938,13 +807,8 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView)
                                    customHeaderString.c_str());
     }
 
-    // enable webkit plugins
-    WrtDB::WidgetDAOReadOnly dao(m_model->Handle.Get());
-    if (dao.getWebkitPluginsRequired()) {
-        ewk_setting_enable_plugins_set(setting, EINA_TRUE);
-    } else {
-        ewk_setting_enable_plugins_set(setting, EINA_FALSE);
-    }
+    // webkit NPAPI plugins is always on in wrt
+    ewk_setting_enable_plugins_set(setting, EINA_TRUE);
 
     // The followings are not implemeted yet by webkit2
     //      ewk_view_setting_accelerated_compositing_enable_set(EINA_TRUE);
@@ -1095,36 +959,33 @@ void ViewLogic::didStartDownloadCallback(
         NULL);
 }
 
-void ViewLogic::didStartProvisionalLoadForFrameCallback(
-        WKPageRef /*page*/,
-        WKFrameRef /*frame*/,
-        WKTypeRef /*userData*/,
-        const void *clientInfo)
+void ViewLogic::loadStartedCallback(
+        void* data,
+        Evas_Object* /*obj*/,
+        void* /*eventInfo*/)
 {
-    LogDebug("didStartProvisionalLoadForFrameCallback called");
-    Assert(clientInfo);
-    ViewLogic* This = static_cast<ViewLogic*>(const_cast<void*>(clientInfo));
+    LogDebug("loadStartedCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
     evas_object_focus_set(This->m_currentEwkView, EINA_TRUE);
 }
 
-void ViewLogic::didFinishLoadForFrameCallback(
-        WKPageRef /*page*/,
-        WKFrameRef frame,
-        WKTypeRef /*userData*/,
-        const void *clientInfo)
+void ViewLogic::loadFinishedCallback(
+        void* data,
+        Evas_Object* /*obj*/,
+        void* /*eventInfo*/)
 {
-    LogDebug("didFinishLoadForFrameCallback called");
-    Assert(clientInfo);
-    ViewLogic* This = static_cast<ViewLogic*>(const_cast<void*>(clientInfo));
+    LogDebug("loadFinishedCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
 
     // Fill id/password
-    DPL::OptionalString urlOptionalString = ViewModule::Utils::toString(frame);
-    if (urlOptionalString.IsNull()) {
+    const char* url = ewk_view_uri_get(This->m_currentEwkView);
+    if (NULL == url || strlen(url) == 0) {
         LogError("url is empty");
     } else {
-        std::string urlStr = DPL::ToUTF8String(*urlOptionalString).c_str();
         DPL::OptionalString jsOptionalString =
-            ViewModule::PasswordSupport::jsForAutoFillData(urlStr.c_str());
+            ViewModule::PasswordSupport::jsForAutoFillData(url);
         if (jsOptionalString.IsNull()) {
             LogError("Fail to get JS String");
         } else {
@@ -1138,8 +999,8 @@ void ViewLogic::didFinishLoadForFrameCallback(
     }
 
     // call loadFinish callback to wrt-client
-    if (This->m_cbs->loadFinish) {
-        This->m_cbs->loadFinish(true, This->m_cbsData);
+    if (!This->m_cbs->loadFinish.empty()) {
+        This->m_cbs->loadFinish(true);
     }
 
     // check if 'appsevice' event is registed at the current frames.
@@ -1149,54 +1010,65 @@ void ViewLogic::didFinishLoadForFrameCallback(
         WrtPlugins::W3C::ServiceCustomEvent);
 }
 
-void ViewLogic::didReceiveTitleForFrameCallback(
-        WKPageRef page,
-        WKStringRef title,
-        WKFrameRef /*frame*/,
-        WKTypeRef /*userData*/,
-        const void* clientInfo)
+void ViewLogic::titleChangedCallback(
+        void* data,
+        Evas_Object* /*obj*/,
+        void* eventInfo)
 {
-    LogDebug("didReceiveTitleForFrameCallback called");
-    Assert(clientInfo);
-    ViewLogic* This = static_cast<ViewLogic*>(const_cast<void*>(clientInfo));
+    LogDebug("titleChangedCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    Assert(eventInfo);
+    const char* title = static_cast<char*>(eventInfo);
 
-    DPL::OptionalString titleOptionalString =
-            ViewModule::Utils::toString(title);
-    if (titleOptionalString.IsNull()) {
+    if (0 == strlen(title)) {
         LogDebug("title data is empty");
         return;
     }
-
-    std::string titleStr = DPL::ToUTF8String(*titleOptionalString);
-    LogDebug("Title = [" << titleStr << "]");
-
-    This->m_schemeSupport->HandleTizenScheme(titleStr.c_str(),
+    LogDebug("Title = [" << title << "]");
+    This->m_schemeSupport->HandleTizenScheme(title,
                                              This->m_window,
-                                             page);
+                                             This->m_currentEwkView);
 }
 
-void ViewLogic::didStartProgressCallback(WKPageRef /*page*/,
-                                               const void* clientinfo)
+void ViewLogic::loadProgressCallback(
+        void* /*data*/,
+        Evas_Object* /*obj*/,
+        void* eventInfo)
 {
-    LogDebug("didStartProgressCallback");
-    Assert(clientinfo);
-    // TODO : Progress control
+    double* progress = static_cast<double*>(eventInfo);
+    LogDebug("didChangeProgressCallback progress = " << *progress);
 }
 
-void ViewLogic::didChangeProgressCallback(WKPageRef page,
-                                                const void* /*clientinfo*/)
+void ViewLogic::loadProgressFinishedCallback(
+        void* data,
+        Evas_Object* /*obj*/,
+        void* /*eventInfo*/)
 {
-    double progress = WKPageGetEstimatedProgress(page);
-    LogDebug("didChangeProgressCallback progress = " << progress);
+    LogDebug("didFinishProgressCallback");
+    Assert(data);
+    ViewLogic const * const view = static_cast<ViewLogic const * const>(data);
+    if (!view->m_cbs->progressFinish.empty()) {
+        view->m_cbs->progressFinish();
+    }
 }
 
-void ViewLogic::didFinishProgressCallback(WKPageRef /*page*/,
-                                                const void* clientinfo)
+void ViewLogic::processCrashedCallback(
+        void* /*data*/,
+        Evas_Object* /*obj*/,
+        void* eventInfo)
 {
-    LogDebug("didFinishProgressCallback");
-    ViewLogic const * const view = static_cast<ViewLogic const * const>(clientinfo);
-    if (view->m_cbs->progressFinish)
-        view->m_cbs->progressFinish(view->m_cbsData);
+    LogInfo("processCrashedCallback");
+    Assert(eventInfo);
+    ViewLogic const * const view =
+            static_cast<ViewLogic const * const>(eventInfo);
+    if (!view->m_cbs->webCrash.empty()) {
+        view->m_cbs->webCrash();
+    }
+    // This flag will be prevented exit() call in the Webkit side
+    if (NULL != eventInfo) {
+        *(static_cast<Eina_Bool*>(eventInfo)) = EINA_TRUE;
+    }
 }
 
 void ViewLogic::createWindowCallback(
@@ -1215,8 +1087,8 @@ void ViewLogic::createWindowCallback(
        then view should not be suspended*/
     //This->suspendEwkView(currentEwkView);
 
-    if (This->m_cbs->bufferUnset) {
-        This->m_cbs->bufferUnset(currentEwkView, This->m_cbsData);
+    if (!This->m_cbs->bufferUnset.empty()) {
+        This->m_cbs->bufferUnset(currentEwkView);
     }
 
     // create new ewkview
@@ -1230,8 +1102,8 @@ void ViewLogic::createWindowCallback(
     This->prepareEwkView(newEwkView);
 
     // show new ewkview
-    if (This->m_cbs->bufferUnset) {
-        This->m_cbs->bufferSet(newEwkView, This->m_cbsData);
+    if (!This->m_cbs->bufferUnset.empty()) {
+        This->m_cbs->bufferSet(newEwkView);
     }
     *(static_cast<Evas_Object **>(eventInfo)) = newEwkView;
 }
@@ -1245,105 +1117,30 @@ void ViewLogic::closeWindowCallback(
     ecore_idler_add(windowCloseIdlerCallback, data);
 }
 
-void ViewLogic::pageDecidePolicyForResponseCallback(
-        WKPageRef /*page*/,
-        WKFrameRef frame,
-        WKURLResponseRef response,
-        WKURLRequestRef request,
-        WKFramePolicyListenerRef listener,
-        WKTypeRef /*userData*/,
-        const void* clientInfo)
+void ViewLogic::policyNavigationDecideCallback(
+        void* data,
+        Evas_Object* /*obj*/,
+        void* eventInfo)
 {
-    Assert(clientInfo);
-    ViewLogic* This = static_cast<ViewLogic*>(const_cast<void*>(clientInfo));
-
-    Assert(response);
-    WKStringRef contentTypeRef = WKURLResponseEflCopyContentType(response);
-    Assert(contentTypeRef);
-    if (WKFrameCanShowMIMEType(frame, contentTypeRef)) {
-        LogDebug("Accepting this content type to be used by WK2");
-        WKFramePolicyListenerUse(listener);
-        WKRelease(contentTypeRef);
-        return;
-    }
-
-    Assert(request);
-    // get uri information
-    DPL::OptionalString requestOptionalStr =
-            ViewModule::Utils::toString(request);
-    if (requestOptionalStr.IsNull()) {
-        LogDebug("uri data is empty");
-        return;
-    }
-    std::string uriStr = DPL::ToUTF8String(*requestOptionalStr).c_str();
-    const char* uri = uriStr.c_str();
-    LogDebug("uri = [" << uri << "]");
-
-    // get content information
-    DPL::OptionalString contentOptionalStr =
-            ViewModule::Utils::toString(contentTypeRef);
-    std::string contentStr;
-    if (contentOptionalStr.IsNull()) {
-        LogDebug("content data is empty");
-    } else {
-        contentStr = DPL::ToUTF8String(*contentOptionalStr).c_str();
-    }
-    LogDebug("content type = [" << contentStr << "]");
-
-    // get cookie information
-    WKStringRef cookiesRef = WKURLRequestEflCopyCookies(request);
-    Assert(cookiesRef);
-    DPL::OptionalString cookiesOptionalStr =
-            ViewModule::Utils::toString(cookiesRef);
-    std::string cookieStr;
-    if (cookiesOptionalStr.IsNull()) {
-        LogDebug("cookies are empty");
-    } else {
-        cookieStr = DPL::ToUTF8String(*cookiesOptionalStr).c_str();
-    }
-    LogDebug("cookie = [" << cookieStr << "]");
-
-    LogDebug("Content not supported, will be opened in external app");
-    WKFramePolicyListenerIgnore(listener);
-    This->m_appsSupport->downloadRequest(
-        uri,
-        contentStr.empty() ? NULL : contentStr.c_str(),
-        cookieStr.empty() ? NULL : cookieStr.c_str());
-
-    WKRelease(contentTypeRef);
-    WKRelease(cookiesRef);
-}
-
-void ViewLogic::pageDecidePolicyForNavigationActionCallback(
-        WKPageRef page,
-        WKFrameRef frame,
-        WKFrameNavigationType /*navigationType*/,
-        WKEventModifiers /*modifiers*/,
-        WKEventMouseButton /*mouseButton*/,
-        WKURLRequestRef request,
-        WKFramePolicyListenerRef listener,
-        WKTypeRef /*userData*/,
-        const void* clientInfo)
-{
-    LogDebug("Accepting URL: " << ViewModule::Utils::toString(request));
-    Assert(clientInfo);
-
-    ViewLogic* This = static_cast<ViewLogic*>(const_cast<void*>(clientInfo));
+    LogDebug("policyNavigationDecideCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    Assert(eventInfo);
+    Ewk_Policy_Decision* policyDecision =
+        static_cast<Ewk_Policy_Decision*>(eventInfo);
 
-    if (This->m_schemeSupport->filterURIByScheme(page,
-                                                 frame,
-                                                 request,
+    if (This->m_schemeSupport->filterURIByScheme(policyDecision,
                                                  false,
                                                  This->m_model,
-                                                 This->m_window))
+                                                 This->m_window,
+                                                 This->m_currentEwkView))
     {
         LogDebug("use");
-        WKFramePolicyListenerUse(listener);
-    }
-    else
-    {
-        if(This->m_emptyView)
-        {
+        ewk_policy_decision_use(policyDecision);
+    } else {
+        // check whether this is new empty window
+        const char* activeUrl = ewk_view_uri_get(This->m_currentEwkView);
+        if(!activeUrl || 0 == strlen(activeUrl)) {
             /*
              * The view is empty and scheme has been handled externally. When
              * user gets back from the external application he'd see blank page
@@ -1365,41 +1162,88 @@ void ViewLogic::pageDecidePolicyForNavigationActionCallback(
                 ecore_idler_add(windowCloseIdlerCallback, This);
             }
         }
+
         LogDebug("ignore");
-        WKFramePolicyListenerIgnore(listener);
+        ewk_policy_decision_ignore(policyDecision);
     }
 }
 
-void ViewLogic::pageDecidePolicyForNewWindowActionCallback(
-        WKPageRef page,
-        WKFrameRef frame,
-        WKFrameNavigationType /*navigationType*/,
-        WKEventModifiers /*modifiers*/,
-        WKEventMouseButton /*mouseButton*/,
-        WKURLRequestRef request,
-        WKStringRef /*frameName*/,
-        WKFramePolicyListenerRef listener,
-        WKTypeRef /*userData*/,
-        const void* clientInfo)
+void ViewLogic::policyNewWindowDecideCallback(
+        void* data,
+        Evas_Object* /*obj*/,
+        void* eventInfo)
 {
-    LogDebug("Accepting URL: " << ViewModule::Utils::toString(request));
-    Assert(clientInfo);
-
-    ViewLogic* This = static_cast<ViewLogic*>(const_cast<void*>(clientInfo));
+    LogDebug("policyNewWindowDecideCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    Assert(eventInfo);
+    Ewk_Policy_Decision* policyDecision =
+        static_cast<Ewk_Policy_Decision*>(eventInfo);
 
-    if (This->m_schemeSupport->filterURIByScheme(page,
-                                                 frame,
-                                                 request,
+    if (This->m_schemeSupport->filterURIByScheme(policyDecision,
                                                  true,
                                                  This->m_model,
-                                                 This->m_window))
-    {
-        WKFramePolicyListenerUse(listener);
-    }
-    else
+                                                 This->m_window,
+                                                 This->m_currentEwkView))
     {
+        ewk_policy_decision_use(policyDecision);
+    } else {
         // scheme handled
-        WKFramePolicyListenerIgnore(listener);
+        ewk_policy_decision_ignore(policyDecision);
+    }
+}
+
+void ViewLogic::pageResponseDecideCallback(
+        void* data,
+        Evas_Object* /*obj*/,
+        void* eventInfo)
+{
+    LogDebug("pageResponseDecideCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    Assert(eventInfo);
+    Ewk_Policy_Decision* policyDecision =
+        static_cast<Ewk_Policy_Decision*>(eventInfo);
+    Ewk_Policy_Decision_Type policyDecisionType =
+        ewk_policy_decision_type_get(policyDecision);
+
+    if (policyDecisionType == EWK_POLICY_DECISION_USE) {
+        LogDebug("use");
+        ewk_policy_decision_use(policyDecision);
+    } else if (policyDecisionType == EWK_POLICY_DECISION_DOWNLOAD) {
+        LogDebug("download");
+        ewk_policy_decision_suspend(policyDecision);
+
+        // get uri information
+        const char* url =  ewk_policy_decision_url_get(policyDecision);
+        if (NULL == url || strlen(url) == 0) {
+            LogDebug("url data is empty");
+            ewk_policy_decision_use(policyDecision);
+            return;
+        }
+        LogDebug("url = [" << url << "]");
+
+        // get content information
+        const char* content =
+            ewk_policy_decision_response_mime_get(policyDecision);
+        LogDebug("content type = [" << content << "]");
+
+        // get cookie information
+        const char* cookie = ewk_policy_decision_cookie_get(policyDecision);
+        LogDebug("cookie = [" << cookie << "]");
+
+        LogDebug("Content not supported, will be opened in external app");
+        This->m_appsSupport->downloadRequest(
+            url,
+            content,
+            cookie);
+        ewk_policy_decision_ignore(policyDecision);
+    } else if (policyDecisionType == EWK_POLICY_DECISION_IGNORE) {
+        LogDebug("ignore");
+        ewk_policy_decision_ignore(policyDecision);
+    } else {
+        LogDebug("Type isn't handled");
+        ewk_policy_decision_ignore(policyDecision);
     }
 }
 
@@ -1431,11 +1275,11 @@ void ViewLogic::contextmenuCustomizeCallback(
             Ewk_Context_Menu_Item_Tag tag = ewk_context_menu_item_tag_get(item);
 
             switch (tag) {
-                case kWKContextMenuItemTagOpenImageInNewWindow:
+                case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW:
                     ewk_context_menu_item_remove(menu, item);
                     break;
 
-                case kWKContextMenuItemTagSearchWeb:
+                case EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB:
                     ewk_context_menu_item_remove(menu, item);
                     break;
 
@@ -1577,7 +1421,7 @@ void ViewLogic::vibrationCancelCallback(
 // EWK Orientation Callback
 Eina_Bool ViewLogic::orientationLockCallback(
         Evas_Object* obj,
-        Eina_Bool needLock,
+        Eina_Bool /*needLock*/,
         int orientation,
         void* data)
 {
@@ -1585,8 +1429,6 @@ Eina_Bool ViewLogic::orientationLockCallback(
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
 
-    // current implementation doesn't use lock value
-    needLock;
     if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) {
         LogDebug("orientation is portrait-primary");
         elm_win_rotation_with_resize_set(This->m_window, 0);
@@ -1610,39 +1452,42 @@ Eina_Bool ViewLogic::orientationLockCallback(
     return EINA_TRUE;
 }
 
-void ViewLogic::didRunJavaScriptCallback(
+
+// Fullscreen API callbacks
+void ViewLogic::enterFullscreenCallback(
+        void* data,
         Evas_Object* /*obj*/,
-        const char* result,
-        void* /*userData*/)
+        void* /*eventInfo*/)
 {
-    LogInfo("didRunJavaScriptCallback called");
-    LogInfo("result = " << result);
+    LogInfo("enterFullscreenCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    if (!This->m_cbs->toggleFullscreen.empty()) {
+        This->m_cbs->toggleFullscreen(true);
+    }
 }
-
-void ViewLogic::backButtonCallback(void* data,
-                                         Evas_Object * /*obj*/,
-                                         void * /*event_info*/)
+void ViewLogic::exitFullscreenCallback(
+        void* data,
+        Evas_Object* /*obj*/,
+        void* /*eventInfo*/)
 {
-    LogInfo("BackButtonCallback");
+    LogInfo("exitFullscreenCallback called");
     Assert(data);
-
     ViewLogic* This = static_cast<ViewLogic*>(data);
-
-    if (WKPageCanGoBack(ewk_view_WKPage_get(This->m_currentEwkView))) {
-        WKPageGoBack(ewk_view_WKPage_get(This->m_currentEwkView));
-    } else {
-        if (1 >= This->m_ewkViewList.size()) {
-            // If there is no previous page, widget move to backgroud.
-            LogInfo("Widget move to backgroud");
-            elm_win_lower(This->m_window);
-        } else {
-            // Back to previous webview
-            LogInfo("Widget move to previous webview");
-            ecore_idler_add(windowCloseIdlerCallback, This);
-        }
+    if (!This->m_cbs->toggleFullscreen.empty()) {
+        This->m_cbs->toggleFullscreen(false);
     }
 }
 
+void ViewLogic::didRunJavaScriptCallback(
+        Evas_Object* /*obj*/,
+        const char* result,
+        void* /*userData*/)
+{
+    LogInfo("didRunJavaScriptCallback called");
+    LogInfo("result = " << result);
+}
+
 Eina_Bool ViewLogic::windowCloseIdlerCallback(void* data)
 {
     LogDebug("closeIdlerCallback");
@@ -1651,18 +1496,6 @@ Eina_Bool ViewLogic::windowCloseIdlerCallback(void* data)
     return ECORE_CALLBACK_CANCEL;
 }
 
-void ViewLogic::processDidCrashCallback(WKPageRef /*page*/,
-                                        const void* clientInfo)
-{
-    LogInfo("processDidCrashCallback");
-
-    ViewLogic const * const view =
-            static_cast<ViewLogic const * const>(clientInfo);
-    if (view->m_cbs->webCrash) {
-        view->m_cbs->webCrash(view->m_cbsData);
-    }
-}
-
 int ViewLogic::appcoreLowMemoryCallback(void *data)
 {
     LogInfo("appcoreLowMemoryCallback");
@@ -1679,6 +1512,114 @@ int ViewLogic::appcoreLowMemoryCallback(void *data)
     return 0;
 }
 
+void ViewLogic::databaseUsagePermissionRequestCallback(
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
+{
+    LogDebug("databaseUsagePermissionRequestCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    This->databaseUsagePermissionRequest(eventInfo);
+    return;
+ }
+
+void ViewLogic::databaseUsagePermissionRequest(
+    void* eventInfo)
+{
+    LogDebug("databaseUsagePermissionRequest called");
+    Assert(eventInfo);
+    Ewk_Context_Exceeded_Quota* exceededQuota =
+        static_cast<Ewk_Context_Exceeded_Quota*>(eventInfo);
+
+    bool state = askUserForDatabaseExceedPermission(
+        exceededQuota);
+
+    if (true == state) {
+        LogDebug("permit");
+        ewk_context_web_database_exceeded_quota_new_quota_set(
+            exceededQuota,
+            ewk_context_web_database_exceeded_quota_expected_usage_get(
+                exceededQuota)
+            + 10*(1024*1024)); //10MB
+    } else {
+        LogDebug("deny");
+    }
+    return;
+ }
+
+bool ViewLogic::askUserForDatabaseExceedPermission(
+    Ewk_Context_Exceeded_Quota* exceededQuota)
+{
+    LogDebug("askUserForDatabaseExceedPermission called");
+    Ewk_Security_Origin* origin =
+        ewk_context_web_database_exceeded_quota_security_origin_get(
+        exceededQuota);
+    char databaseUseAskTitle[180];
+
+    snprintf(databaseUseAskTitle,
+        sizeof(databaseUseAskTitle),
+        "Do you want to allow %s to use up to %dMB of storage?",
+        ewk_security_origin_host_get(origin),
+        ewk_context_web_database_exceeded_quota_expected_usage_get(
+            exceededQuota)/(1024*1024));
+
+    return Wrt::PopupInvoker().askYesNo(
+        DATABASE_USE_ASK_TITLE,
+        databaseUseAskTitle);
+}
+
+void ViewLogic::fileSystemPermissionRequestCallback(
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
+{
+    LogDebug("filesystemPermissionRequestCallback called");
+    Assert(data);
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+    This->fileSystemPermissionRequest(eventInfo);
+    return;
+ }
+
+void ViewLogic::fileSystemPermissionRequest(
+    void* eventInfo)
+{
+    LogDebug("filesystemPermissionRequest called");
+    Assert(eventInfo);
+    Ewk_Context_File_System_Permission* fileSystemPermission =
+        static_cast<Ewk_Context_File_System_Permission*>(eventInfo);
+    bool state = askUserForFileSystemPermission(
+        fileSystemPermission);
+
+    if (true == state) {
+        LogDebug("permit");
+        ewk_context_file_system_permission_allow_set(
+            fileSystemPermission, EINA_TRUE);
+    } else {
+        LogDebug("deny");
+    }
+    return ;
+ }
+
+bool ViewLogic::askUserForFileSystemPermission(
+    Ewk_Context_File_System_Permission* fileSystemPermission)
+{
+    LogDebug("askUserForFileSystemPermission called");
+    Ewk_Security_Origin* origin =
+        ewk_context_file_system_permission_origin_get(
+        fileSystemPermission);
+
+    char fileSystemPermissionAskTitle[110];
+    snprintf(fileSystemPermissionAskTitle,
+        sizeof(fileSystemPermissionAskTitle),
+        "Do you want to allow %s to use persistent filesystem?",
+        ewk_security_origin_host_get(origin));
+
+    return Wrt::PopupInvoker().askYesNo(
+        FILESYSTEM_USE_ASK_TITLE,
+        fileSystemPermissionAskTitle);
+}
+
 void ViewLogic::didRecieveMessageFromInjectedBundle(
         const char* name,
         const char* /*body*/)
@@ -1700,19 +1641,14 @@ void ViewLogic::didReceiveSynchronousMessage(
         *returnData = NULL;
         return;
     }
-    if (!strcmp(name, willSendMessageName)) {
-        LogDebug("received : " << willSendMessageName);
-
-        bool is_xhr = true; //Webkit2 should inform if it is xhr
-        DPL::OptionalString ret =
-            requestWillSend(DPL::FromUTF8String(body), is_xhr);
-        if (ret.IsNull()) {
-            LogError("Wrong type received");
-            *returnData = NULL;
-        } else {
-            LogDebug("returning uri: " << ret);
-            *returnData = strdup(DPL::ToUTF8String(*ret).c_str());
-        }
+    if (!strcmp(name, uriBlockedMessageName)) {
+        LogDebug("received : " << uriBlockedMessageName);
+        // Currently WebProcess informs obly about blocked
+        // URI - URI localization and security chekcs are
+        // done by WebProcess itself (see: wrt-wk2-bundle.cpp
+        // and bundle_uri_handling.cpp)
+        rememberBlockedURI(DPL::FromUTF8String(body));
+        *returnData = NULL;
     } else if (!strcmp(name, uriChangedMessageName)) {
         LogDebug("received : " << uriChangedMessageName);
         std::string ret = requestUriChanged(DPL::FromUTF8String(body));
@@ -1720,40 +1656,11 @@ void ViewLogic::didReceiveSynchronousMessage(
     }
 }
 
-DPL::Optional<DPL::String> ViewLogic::requestWillSend(
-        const DPL::String& inputURI,
-        bool is_xhr)
+void ViewLogic::rememberBlockedURI(const DPL::String& inputURI)
 {
-    DPL::Optional<DPL::String> uri =
-        ViewModule::UriSupport::localizeURI(inputURI, m_model);
-
-    if (uri.IsNull())
-    {
-        LogDebug("uri is empty");
-        return uri;
-    }
-
-    // check ACE, WARP
-    if (!ViewModule::SecuritySupport::filterURIBySecurity(uri, is_xhr, m_model))
-    {
-        // set blocked uri to open browser later
-        m_blockedUri = DPL::ToUTF8String(*uri);
-        LogInfo("set blocked uri to open browser later : " << m_blockedUri);
-        return DPL::Optional<DPL::String>::Null;
-    }
-
-    // check roaming state for external scheme
-    if (m_model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP)
-    {
-        LogInfo("TizenWebApp does not need to check roaming status!");
-    }
-    else if (!ViewModule::SecuritySupport::filterURIByRoaming(uri))
-    {
-        LogDebug("Request was blocked by roaming settings: " << uri);
-        return DPL::Optional<DPL::String>::Null;
-    }
-
-    return uri;
+    m_blockedUri = DPL::ToUTF8String(inputURI);
+    LogInfo("set blocked uri to open browser later : " << m_blockedUri);
+    return;
 }
 
 std::string ViewLogic::requestUriChanged(const DPL::String& changedURL)
@@ -1762,7 +1669,6 @@ std::string ViewLogic::requestUriChanged(const DPL::String& changedURL)
 
     std::string url = DPL::ToUTF8String(changedURL);
     LogInfo("URL = [" << url << "]");
-    m_emptyView = false;
 
     // check WARP
     // If url is same to URICHANGE_BLOCKED_URL,
@@ -1789,10 +1695,10 @@ std::string ViewLogic::requestUriChanged(const DPL::String& changedURL)
             }
         }
         if (ewk_view_back_possible(m_currentEwkView)) {
-            // go back to previous WKPage
+            // go back to previous page
             ewk_view_back(m_currentEwkView);
         } else {
-            // stop current WKPage
+            // stop current page
             ewk_view_stop(m_currentEwkView);
             ecore_idler_add(windowCloseIdlerCallback, this);
         }
@@ -1837,10 +1743,7 @@ std::string ViewLogic::requestUriChanged(const DPL::String& changedURL)
 void ViewLogic::disconnectNetworkConnectionsFunction() {
     if (m_ewkContext) {
         LogDebug("disconnection network connections");
-        // API needs Ewk_context
-        // Re-open after merged below commit
-        // http://slp-info.sec.samsung.net/gerrit/#change,48358
-        // ewk_context_network_session_requests_cancel(m_ewkContext);
+        ewk_context_network_session_requests_cancel(m_ewkContext);
     }
 }
 
@@ -1849,29 +1752,24 @@ void ViewLogic::windowClose()
     LogDebug("windowClose");
 
     if (1 >= m_ewkViewList.size()) {
-        if (m_cbs->windowClose) {
-            m_cbs->windowClose(m_cbsData);
+        if (!m_cbs->windowClose.empty()) {
+            m_cbs->windowClose();
         }
     } else {
         // hide current ewkView
 
-        if (m_cbs->bufferUnset) {
-            m_cbs->bufferUnset(m_currentEwkView, m_cbsData);
+        if (!m_cbs->bufferUnset.empty()) {
+            m_cbs->bufferUnset(m_currentEwkView);
         }
         removeEwkView(m_currentEwkView);
 
         // get latest ewkView
         m_currentEwkView = m_ewkViewList.back();
-        WKPageRef page = ewk_view_WKPage_get(m_currentEwkView);
-        WKFrameRef frame = WKPageGetMainFrame(page);
-
-        DPL::OptionalString frameURL = ViewModule::Utils::toString(frame);
-        if (frameURL.IsNull()) {
+        const char* uri = ewk_view_uri_get(m_currentEwkView);
+        if (NULL == uri || 0 == strlen(uri)) {
             m_currentUri.clear();
-            m_emptyView = true;
         } else {
-            m_currentUri = DPL::ToUTF8String(*frameURL);
-            m_emptyView = false;
+            m_currentUri = uri;
         }
 
         // resume ewkView
@@ -1880,8 +1778,9 @@ void ViewLogic::windowClose()
         //resumeEwkView(m_currentEwkView);
 
         // show ewkView
-        if (m_cbs->bufferSet) {
-            m_cbs->bufferSet(m_currentEwkView, m_cbsData);
+        if (!m_cbs->bufferSet.empty()) {
+            m_cbs->bufferSet(m_currentEwkView);
         }
     }
 }
+
index 43bbcd6..166bc2f 100644 (file)
@@ -23,9 +23,6 @@
 #define VIEW_LOGIC_H_
 
 #include <i_view_module.h>
-
-//#include "view_logic.h"
-
 #include <memory>
 #include <dpl/log/log.h>
 #include <dpl/assert.h>
@@ -35,7 +32,6 @@
 #include <common/view_logic_apps_support.h>
 #include <common/view_logic_vibration_support.h>
 
-#include <WebKit2.h>
 #include <EWebKit2.h>
 
 class SchemeSupport;
@@ -43,6 +39,9 @@ class SchemeSupport;
 class ViewLogic : public ViewModule::IViewModule
 {
   public:
+    ViewLogic();
+    virtual ~ViewLogic();
+
     void createWebView(Ewk_Context* context,
                        Evas_Object* window);
     void destroyWebView();
@@ -54,16 +53,16 @@ class ViewLogic : public ViewModule::IViewModule
     void suspendWidget();
     void resumeWidget();
     void resetWidget();
-    void goBack();
+    void backward();
+    void reload();
+    void forward();
     void reloadStartPage();
     Evas_Object* getCurrentWebview();
-    void setUserCallbacks(WRT::UserCallbacksPtr cbs, void *data);
+    void setUserCallbacks(const WRT::UserDelegatesPtr& cbs);
 
     // Ewk_Context operations
     void initializeEwkContext(Ewk_Context* context);
     void finalizeEwkContext();
-    ViewLogic();
-    virtual ~ViewLogic();
 
   private:
     void initializeSupport();
@@ -93,32 +92,31 @@ class ViewLogic : public ViewModule::IViewModule
             const char* downloadUrl,
             void* data);
 
-    // WKPageLoaderClient Callback
-    static void didStartProvisionalLoadForFrameCallback(
-            WKPageRef page,
-            WKFrameRef frame,
-            WKTypeRef userData,
-            const void *clientInfo);
-    static void didFinishLoadForFrameCallback(
-            WKPageRef page,
-            WKFrameRef frame,
-            WKTypeRef userData,
-            const void *clientInfo);
-    static void didReceiveTitleForFrameCallback(
-            WKPageRef page,
-            WKStringRef title,
-            WKFrameRef frame,
-            WKTypeRef userData,
-            const void* clientinfo);
-    static void didStartProgressCallback(
-            WKPageRef page,
-            const void* clientinfo);
-    static void didChangeProgressCallback(
-            WKPageRef page,
-            const void* clientinfo);
-    static void didFinishProgressCallback(
-            WKPageRef page,
-            const void* clientinfo);
+    // WKPageLoaderClient
+    static void loadStartedCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
+    static void loadFinishedCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
+    static void titleChangedCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
+    static void loadProgressCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
+    static void loadProgressFinishedCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
+    static void processCrashedCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
 
     // EWK Callback
     static void createWindowCallback(
@@ -130,36 +128,19 @@ class ViewLogic : public ViewModule::IViewModule
             Evas_Object* obj,
             void* eventInfo);
 
-    // WKPagePolicyClient Callback
-    static void pageDecidePolicyForNavigationActionCallback(
-            WKPageRef page,
-            WKFrameRef frame,
-            WKFrameNavigationType navigationType,
-            WKEventModifiers modifiers,
-            WKEventMouseButton mouseButton,
-            WKURLRequestRef request,
-            WKFramePolicyListenerRef listener,
-            WKTypeRef userData,
-            const void* clientinfo);
-    static void pageDecidePolicyForResponseCallback(
-            WKPageRef page,
-            WKFrameRef frame,
-            WKURLResponseRef response,
-            WKURLRequestRef request,
-            WKFramePolicyListenerRef listener,
-            WKTypeRef userData,
-            const void* clientinfo);
-    static void pageDecidePolicyForNewWindowActionCallback(
-            WKPageRef page,
-            WKFrameRef frame,
-            WKFrameNavigationType navigationType,
-            WKEventModifiers modifiers,
-            WKEventMouseButton mouseButton,
-            WKURLRequestRef request,
-            WKStringRef frameName,
-            WKFramePolicyListenerRef listener,
-            WKTypeRef userData,
-            const void* clientInfo);
+    // EWK PolicyDecide Callback
+    static void policyNavigationDecideCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
+    static void policyNewWindowDecideCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
+    static void pageResponseDecideCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
 
     // EWK ContextMenu Callback
     static void contextmenuCustomizeCallback(
@@ -210,26 +191,46 @@ class ViewLogic : public ViewModule::IViewModule
             int orientation,
             void* data);
 
+    // EWK Fullscreen API callbacks
+    static void enterFullscreenCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
+    static void exitFullscreenCallback(
+            void* data,
+            Evas_Object* obj,
+            void* eventInfo);
+
     // JS execute callback
     static void didRunJavaScriptCallback(
             Evas_Object* obj,
             const char* result,
             void* userData);
 
-    // UI callback
-    static void backButtonCallback(void* data,
-                                   Evas_Object* obj,
-                                   void* event_info);
-
     // idler callback
     static Eina_Bool windowCloseIdlerCallback(void *data);
 
-    // process crash callback
-    static void processDidCrashCallback(WKPageRef page,
-                                        const void* clientInfo);
-
     // appcore event callback
     static int appcoreLowMemoryCallback(void *data);
+    // database usage permission request callback
+    static void databaseUsagePermissionRequestCallback(
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
+    void databaseUsagePermissionRequest(
+           void* eventInfo);
+    bool askUserForDatabaseExceedPermission(
+        Ewk_Context_Exceeded_Quota* exceededQuota);
+
+    // file System Permission Request Callback
+    static void fileSystemPermissionRequestCallback(
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
+    void fileSystemPermissionRequest(
+           void* eventInfo);
+    bool askUserForFileSystemPermission(
+        Ewk_Context_File_System_Permission* fileSystemPermission);
 
     //bundle
     void didRecieveMessageFromInjectedBundle(
@@ -241,8 +242,7 @@ class ViewLogic : public ViewModule::IViewModule
             char** returnData);
 
     // security
-    DPL::Optional<DPL::String> requestWillSend(const DPL::String& str,
-                                               bool is_xhr);
+    void rememberBlockedURI(const DPL::String& str);
     std::string requestUriChanged(const DPL::String& changedURL);
     void disconnectNetworkConnectionsFunction();
 
@@ -257,11 +257,9 @@ class ViewLogic : public ViewModule::IViewModule
     WidgetModel* m_model;
     std::string m_currentUri;
     std::string m_blockedUri;
-    bool m_emptyView;
     std::string m_theme;
     std::string m_startUrl;
-    WRT::UserCallbacksPtr m_cbs;
-    void* m_cbsData;
+    WRT::UserDelegatesPtr m_cbs;
 
     std::unique_ptr<SchemeSupport> m_schemeSupport;
     std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
index 8afd780..8087c8a 100644 (file)
 #include <dpl/log/log.h>
 #include <dpl/assert.h>
 #include <common/view_logic_geolocation_support.h>
-#include <ewk_setting.h>
-#include <ewk_view.h>
-
+#include <EWebKit2.h>
 
 namespace {
-WidgetHandle s_widgetHandle = WrtDB::INVALID_WIDGET_HANDLE;
+DPL::String s_tizenId;
 const double GEOLOCATION_POSITION_ACCURACY = 0.0;
 Eina_Bool g_is_location_manager_valid = EINA_FALSE;
-
-
-
 } // anonymous namespace
 
 namespace ViewModule {
 namespace GeolocationSupport {
 namespace Webkit2 {
 
-void initialize(WidgetHandle widgetHandle)
+void initialize(const DPL::String& tizenId)
 {
-    s_widgetHandle = widgetHandle;
+    s_tizenId = tizenId;
 }
 
 void geolocationPermissionRequest(void* data)
 {
     LogDebug("geolocationPermissionRequest called");
-    Assert(s_widgetHandle != WrtDB::INVALID_WIDGET_HANDLE);
+    Assert(s_tizenId.length() > 0);
     Assert(data);
 
     bool state = ViewModule::GeolocationSupport::
-        getLocalizationState(s_widgetHandle, false);
+        getLocalizationState(s_tizenId, false);
 
     Ewk_Geolocation_Permission_Data* permissionRequest =
         static_cast<Ewk_Geolocation_Permission_Data*>(data);
@@ -75,7 +70,7 @@ void geolocationPermissionRequest(void* data)
 
 void adjustGeolocationModuleState(const void* wkView)
 {
-    bool state = getGeolocationModuleState(s_widgetHandle);
+    bool state = getGeolocationModuleState(s_tizenId);
     LogDebug("Geolocation state: " << state);
     Ewk_Setting* setting = ewk_view_setting_get((Evas_Object*)wkView);
     Assert(setting);
index c53d380..5afa6a7 100644 (file)
 #ifndef VIEW_LOGIC_GEOLOCATION_SUPPORT_WEBKIT2_H_
 #define VIEW_LOGIC_GEOLOCATION_SUPPORT_WEBKIT2_H_
 
-#include <dpl/wrt-dao-ro/wrt_db_types.h>
-#include <ewk_geolocation.h>
+#include <dpl/string.h>
+
+#include <EWebKit2.h>
 
 namespace ViewModule {
 namespace GeolocationSupport {
 namespace Webkit2 {
 
-void initialize(WidgetHandle WidgetHandle);
+void initialize(const DPL::String& tizenId);
 void geolocationPermissionRequest(void* data);
 
 //initializeModule must be invoked before below callback is invoked
index 686f04f..a2d2462 100644 (file)
 
 #include <appcore-common.h>
 #include <dpl/log/log.h>
-
 #include <widget_model.h>
-
 #include <common/scheme_action_map.h>
-
-#include <ewk_view.h>
-#include <WKString.h>
-#include <WKType.h>
-#include "view_logic_utils.h"
+#include <EWebKit2.h>
 
 namespace {
 char const * const TIZEN_SCHEME = "tizen";
@@ -50,8 +44,7 @@ static Eina_Bool exitAppIdlerCallback(void* /*data*/)
 {
     // webapp termination
     elm_exit();
-    return ECORE_CALLBACK_CANCEL;
-}
+    return ECORE_CALLBACK_CANCEL;}
 
 } // namespace
 
@@ -66,7 +59,7 @@ bool SchemeSupport::HandleUri(
 
 bool SchemeSupport::HandleTizenScheme(const char* uri,
                                       Evas_Object* window,
-                                      WKPageRef page)
+                                      Evas_Object* wkView)
 {
     LogInfo("HandleTizenScheme called");
     if (!uri) {
@@ -117,38 +110,35 @@ bool SchemeSupport::HandleTizenScheme(const char* uri,
             LogDebug("UA string is NULL");
         } else {
             LogDebug("Setting custom user agent as: " << userAgentString);
-            WKStringRef userAgentStringRef =
-                WKStringCreateWithUTF8CString(userAgentString);
-            WKPageSetCustomUserAgent(page, userAgentStringRef);
-            WKRelease(userAgentStringRef);
+            ewk_view_user_agent_set(wkView, userAgentString);
         }
         return true;
     }
     return false;
 }
 
-bool SchemeSupport::filterURIByScheme(WKPageRef page,
-                                      WKFrameRef frame,
-                                      WKURLRequestRef request,
+bool SchemeSupport::filterURIByScheme(Ewk_Policy_Decision* policyDecision,
                                       bool newWindow,
-                                      WidgetModel *model,
-                                      Evas_Object* window)
+                                      WidgetModel* model,
+                                      Evas_Object* window,
+                                      Evas_Object* wkView)
 {
     LogDebug("filterURIByScheme called");
+    Assert(policyDecision);
+    Assert(model);
 
-    DPL::OptionalString requestOptionalString =
-            ViewModule::Utils::toString(request);
-    if (requestOptionalString.IsNull()) {
+    const char* url = ewk_policy_decision_url_get(policyDecision);
+    if (NULL == url) {
         // URI is null
         // There is no reason, security by scheme block null uri
         return true;
     }
 
-    std::string url = DPL::ToUTF8String(*requestOptionalString);
-    bool mainFrame = WKFrameIsMainFrame(frame);
+    bool mainFrame =
+        ewk_frame_is_main_frame(ewk_policy_decision_frame_get(policyDecision));
 
     using namespace ViewModule::SchemeActionMap;
-    if (HandleTizenScheme(url.c_str(), window, page))
+    if (HandleTizenScheme(url, window, wkView))
     {
         LogDebug("Scheme is tizen scheme");
         return false;
@@ -176,6 +166,6 @@ bool SchemeSupport::filterURIByScheme(WKPageRef page,
         }
     }
 
-    return HandleUri(url.c_str(), ctx);
+    return HandleUri(url, ctx);
 }
 
index bfd2953..0072c0b 100644 (file)
 #define SCHEME_SUPPORT_H_
 
 #include <dpl/wrt-dao-ro/common_dao_types.h>
-
 #include <common/scheme_action_map.h>
 #include <common/evas_object.h>
-
-#include <WKPage.h>
-#include <WKFrame.h>
-#include <WKURLRequest.h>
+#include <EWebKit2.h>
 
 class WindowData;
 class WidgetModel;
@@ -39,16 +35,15 @@ class SchemeSupport {
     explicit SchemeSupport(WrtDB::AppType type) : m_type(type) {}
     bool HandleTizenScheme(const char* uri,
                            Evas_Object* window,
-                           WKPageRef page);
+                           Evas_Object* wkView);
     bool HandleUri(const char* uri,
                    ViewModule::SchemeActionMap::NavigationContext context);
 
-    bool filterURIByScheme(WKPageRef page,
-                           WKFrameRef frame,
-                           WKURLRequestRef request,
+    bool filterURIByScheme(Ewk_Policy_Decision* policyDecision,
                            bool newWindow,
-                           WidgetModel *model,
-                           Evas_Object* window);
+                           WidgetModel* model,
+                           Evas_Object* window,
+                           Evas_Object* wkView);
   private:
     WrtDB::AppType m_type;
 };
index ea1f048..25994fb 100644 (file)
@@ -22,6 +22,7 @@ SET(WRT_CLIENT_SRCS
 )
 
 PKG_CHECK_MODULES(CLIENT_DEP
+    dpl-wrt-dao-ro
     libprivilege-control
     REQUIRED
 )
index 5051291..f1ac9e4 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "splash_screen_support.h"
 #include <dpl/log/log.h>
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <Elementary.h>
 
 
@@ -42,15 +41,13 @@ SplashScreenSupport::~SplashScreenSupport()
     LogDebug("enter");
 }
 
-bool SplashScreenSupport::createSplashScreen(const WidgetHandle handle)
+bool SplashScreenSupport::createSplashScreen(const DPL::OptionalString imagePath)
 {
     LogDebug("initializing splash screen");
 
     bool result = false;
-    WrtDB::WidgetDAOReadOnly dao(handle);
-    DPL::OptionalString img_path(dao.getSplashImgSrc());
-    if (!img_path.IsNull()) {
-        setSplashImagePath((DPL::ToUTF8String(*img_path)).c_str());
+    if (!imagePath.IsNull()) {
+        setSplashImagePath((DPL::ToUTF8String(*imagePath)).c_str());
         result = true;
     } else {
         result = false;
index f62c9b6..9a4d548 100644 (file)
@@ -22,7 +22,8 @@
 #ifndef WRT_SPLASH_SCREEN_SUPPORT_H
 #define WRT_SPLASH_SCREEN_SUPPORT_H
 
-#include <dpl/wrt-dao-ro/wrt_db_types.h>
+#include <dpl/optional.h>
+#include <dpl/optional_typedefs.h>
 #include <Evas.h>
 #include <memory>
 
@@ -33,7 +34,7 @@ class SplashScreenSupport
     SplashScreenSupport(Evas_Object* parent);
     ~SplashScreenSupport();
 
-    bool createSplashScreen(const WidgetHandle handle);
+    bool createSplashScreen(const DPL::OptionalString imagePath);
     void startSplashScreen();
     void stopSplashScreen();
   private:
index b82345b..20ed0a6 100755 (executable)
 #include <dpl/log/log.h>
 
 namespace {
+char const* const PLATFORM_EDJ_PATH = "/usr/share/edje/wrt/Platform.edj";
 char const* const DAEMON_EDJ_PATH = "/usr/share/edje/wrt/Daemon.edj";
 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_TOOLBAR = "elm.swallow.toolbar";
+char const* const ELM_RECT_HIDDENOPTION = "elm.rect.hiddenOption";
+
+const char *EDJE_SHOW_TOOLBAR_SIGNAL = "show,toolbar,signal";
+const char *EDJE_HIDE_TOOLBAR_SIGNAL = "hide,toolbar,signal";
+const char *EDJE_SHOW_HIDDENOPTION_SIGNAL = "show,hiddenOption,signal";
+const char *EDJE_HIDE_HIDDENOPTION_SIGNAL = "hide,hiddenOption,signal";
+
 char const* const ELM = "elm";
 char const* const LAYOUT = "layout";
 char const* const APPLICATION = "application";
 char const* const INDICATOR = "indicator";
 char const* const NOINDICATOR = "noindicator";
-char const* const LIST_PROCESS = "list_process";
 char const* const INTERNAL_LAYOUT = "internal_layout";
 char const* const FLOATBACKWARD_BUTTON_STYLE = "wrt/backward";
-const double PROGRESS_POSITION_X = 0.5;
-const double PROGRESS_POSITION_Y = 0.5;
-const int PROGRESS_SIZE_RATIO = 12;     //ResolutionWidth / ProgressWidth = 12
-const int PROGRESS_COLOR_R = 153;
-const int PROGRESS_COLOR_G = 153;
-const int PROGRESS_COLOR_B = 153;
-const int PROGRESS_COLOR_A = 255;
-
 } // anonymous namespace
 
 WindowData::WindowData(unsigned long pid, bool manualInit) :
-    m_naviBackButton(NULL), m_win(NULL)
+    m_win(NULL), m_naviBackButton(NULL),
+    m_toolbarTimer(NULL),
+    m_debugMode(false)
 {
     m_win = createWindow(pid);
 
@@ -69,7 +71,6 @@ void WindowData::init()
 {
     Assert(m_win != NULL && "m_win is null");
 
-    int result;
     // import button theme
     elm_theme_overlay_add(NULL, THEME_EDJ_PATH);
 
@@ -81,18 +82,6 @@ void WindowData::init()
     evas_object_show(m_user_layout);
     m_conformant = createConformant(m_user_layout);
     evas_object_show(m_conformant);
-    m_progress = createProgress(m_user_layout);
-
-    result = ug_init(
-        static_cast<Display*>(ecore_x_display_get()),
-        elm_win_xwindow_get(m_win),
-        m_win,
-        UG_OPT_INDICATOR_ENABLE);
-
-    if (result != 0) {
-        LogError("Gadget creation failed for window: " << m_win);
-        Assert(false && "UI Gadget creation failed");
-    }
 }
 
 void WindowData::setEvasObjectForLayout(Evas_Object* evas_object)
@@ -105,95 +94,258 @@ void WindowData::unsetEvasObjectForLayout()
     elm_object_content_unset(m_conformant);
 }
 
-void WindowData::loadingOn()
-{
-    LogInfo("loadingOn");
-
-    alignProgressPosition();
-    elm_progressbar_pulse(m_progress, EINA_TRUE);
-    evas_object_show(m_progress);
-}
-
-void WindowData::loadingOff()
-{
-    LogInfo("loadingOff");
-
-    elm_progressbar_pulse(m_progress, EINA_FALSE);
-    evas_object_hide(m_progress);
-}
-
-void WindowData::moveProgress()
-{
-    LogInfo("moveProgress");
-
-    if (evas_object_visible_get(m_progress) == EINA_TRUE) {
-        alignProgressPosition();
-    } else {
-        LogInfo("Progress is hide");
-    }
-}
-
-void WindowData::setViewModeFullScreen(bool indicator, bool backbutton)
+void WindowData::toggleIndicator(bool indicator)
 {
-    LogDebug("indicator: " << indicator << ", backbutton: " << backbutton);
+    LogDebug(__PRETTY_FUNCTION__);
     if (indicator) {
         elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_SHOW);
         elm_layout_theme_set(m_platform_layout,
-                             LAYOUT,
-                             APPLICATION,
-                             INDICATOR);
+                LAYOUT,
+                APPLICATION,
+                INDICATOR);
     } else {
         elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_HIDE);
         elm_layout_theme_set(m_platform_layout,
-                             LAYOUT,
-                             APPLICATION,
-                             NOINDICATOR);
-    }
-    if (backbutton) {
-        createFloatBackButton();
+                LAYOUT,
+                APPLICATION,
+                NOINDICATOR);
     }
 }
 
-void WindowData::setViewModeMaximized(
+void WindowData::setViewMode(
         const char *title,
+        bool fullscreen,
         bool indicator,
-        bool backbutton)
+        bool backbutton,
+        CtxMenuItems ctxMenuItems)
 {
-    LogDebug("indicator: " << indicator << ", backbutton: " << backbutton);
-    if (indicator) {
-        elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_SHOW);
-        elm_layout_theme_set(m_platform_layout,
-                             LAYOUT,
-                             APPLICATION,
-                             INDICATOR);
-    } else {
-        elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_HIDE);
-        elm_layout_theme_set(m_platform_layout,
-                             LAYOUT,
-                             APPLICATION,
-                             NOINDICATOR);
-    }
-    createTitle(title);
+    LogDebug("setViewMode " <<m_debugMode);
+    LogDebug("fullscreen: " << fullscreen << ", indicator: " << indicator);
+
+    m_indicator = indicator;
+    m_fullscreen = fullscreen;
+
+    toggleIndicator(indicator);
+
     if (backbutton) {
         createFloatBackButton();
     }
+
+    m_title = title;
+    m_ctxMenuItems = ctxMenuItems;
+
+    if(m_debugMode) {
+        if(fullscreen)
+            showHiddenOption(m_user_layout);
+        else
+            createTitle(m_title.c_str(), m_ctxMenuItems);
+
+        createToolbar(m_ctxMenuItems);
+    }
+    else
+        if(!fullscreen)
+            createTitle(m_title.c_str(), m_ctxMenuItems);
 }
 
-void WindowData::createTitle(const char* data)
+void WindowData::createTitle(const char *data, CtxMenuItems ctxMenuItems)
 {
     LogDebug("createTitle");
+    showTitle(data);
+    if(m_debugMode) {
+        createMoreButton();
+        createTitleToolbar(ctxMenuItems);
+    }
+}
+
+void WindowData::showTitle(const char *data)
+{
+    LogInfo("showTitle");
+
     Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
     elm_naviframe_item_title_visible_set(naviIt, EINA_TRUE);
     elm_object_item_text_set(naviIt, data);
 }
 
-void WindowData::removeTitle()
+void WindowData::hideTitle()
 {
+    LogInfo("hideTitle");
+
     Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
-    elm_object_item_text_set(naviIt, "");
+    elm_object_item_signal_emit(naviIt, "elm,state,optionheader,instant_close", "");
+    optionheaderClose = FALSE;
+
     elm_naviframe_item_title_visible_set(naviIt, EINA_FALSE);
 }
 
+void WindowData::createMoreButton()
+{
+    Evas_Object *btn = elm_button_add(m_navigation);
+    if (!btn)
+        return;
+    Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
+    elm_object_style_set(btn, "naviframe/more/default");
+    evas_object_smart_callback_add(btn, "clicked", moreButtonCallback, this);
+    elm_object_item_part_content_set(naviIt, "title_more_btn", btn);
+    evas_object_show(btn);
+
+}
+
+void WindowData::createTitleToolbar(CtxMenuItems ctxMenuItems)
+{
+    Elm_Object_Item *toolbarIt;
+    Evas_Object *toolbarButton;
+    Elm_Object_Item *naviIt = elm_naviframe_top_item_get(m_navigation);
+
+    Evas_Object *toolbar = elm_toolbar_add(m_navigation);
+    if (!toolbar)
+        return;
+    elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
+
+    elm_object_style_set(toolbar, "naviframe");
+
+    toolbarButton = elm_button_add(m_navigation);
+    if (!toolbarButton)
+        return;
+
+    std::list<CtxMenuItem>::iterator itor;
+    for (itor = ctxMenuItems.begin(); itor != ctxMenuItems.end(); ++itor) {
+        toolbarButton = elm_button_add(toolbar);
+        elm_object_style_set(toolbarButton, "naviframe_contrl/default");
+        evas_object_size_hint_align_set(toolbarButton,
+                EVAS_HINT_FILL,
+                EVAS_HINT_FILL);
+        elm_object_text_set(toolbarButton, ((*itor).label).c_str());
+        evas_object_smart_callback_add(toolbarButton,
+                "clicked",
+                (*itor).callback,
+                (*itor).data);
+        toolbarIt = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
+        elm_object_item_part_content_set(toolbarIt, "object", toolbarButton);
+    }
+
+    toolbarButton = elm_button_add(toolbar);
+    elm_object_style_set(toolbarButton, "naviframe_contrl/default");
+    evas_object_size_hint_align_set(toolbarButton,
+            EVAS_HINT_FILL,
+            EVAS_HINT_FILL);
+    elm_object_text_set(toolbarButton, WRT_OPTION_LABEL_FULLVIEW);
+    evas_object_smart_callback_add(toolbarButton,
+            "clicked",
+            changeViewModeCallback,
+            this);
+    toolbarIt = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
+    elm_object_item_part_content_set(toolbarIt, "object", toolbarButton);
+
+    elm_object_item_part_content_set(naviIt, "optionheader", toolbar);
+    elm_object_item_signal_emit(naviIt,
+            "elm,state,optionheader,instant_close",
+            "");
+    optionheaderClose = TRUE;
+}
+
+void WindowData::createToolbar(CtxMenuItems ctxMenuItems)
+{
+    Elm_Object_Item *toolbarIt;
+    Evas_Object *toolbarButton;
+    Evas_Object *toolbar;
+    char buf[100];
+
+    toolbar = elm_toolbar_add(m_user_layout);
+    if (!toolbar)
+        return;
+
+    elm_object_style_set(toolbar, "naviframe");
+    elm_object_part_content_set(m_user_layout,
+            ELM_SWALLOW_TOOLBAR,
+            toolbar);
+
+    std::list<CtxMenuItem>::iterator itor;
+    for (itor = ctxMenuItems.begin(); itor != ctxMenuItems.end(); ++itor) {
+        toolbarButton = elm_button_add(toolbar);
+        if (!toolbarButton)
+            return;
+
+        evas_object_size_hint_align_set(toolbarButton,
+                EVAS_HINT_FILL,
+                EVAS_HINT_FILL);
+        evas_object_size_hint_weight_set(toolbarButton,
+                EVAS_HINT_EXPAND,
+                EVAS_HINT_EXPAND);
+
+        Evas_Object *ic = elm_icon_add(toolbar);
+         snprintf(buf, sizeof(buf), (*itor).icon.c_str());
+         elm_icon_file_set(ic, buf, NULL);
+        evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+        elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
+        elm_object_part_content_set(toolbarButton, "icon", ic);
+
+        evas_object_smart_callback_add(toolbarButton,
+                "clicked",
+                (*itor).callback,
+                (*itor).data);
+        toolbarIt = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
+        elm_object_item_part_content_set(toolbarIt, "object", toolbarButton);
+
+        //for margin button between buttons
+        toolbarButton = elm_button_add(toolbar);
+        if (!toolbarButton)
+            return;
+        evas_object_color_set(
+                toolbarButton,
+                255,
+                255,
+                255,
+                0);
+        toolbarIt = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
+        elm_object_item_part_content_set(toolbarIt, "object", toolbarButton);
+    }
+
+    toolbarButton = elm_button_add(toolbar);
+    if (!toolbarButton)
+        return;
+
+    Evas_Object *ic = elm_icon_add(toolbar);
+    snprintf(buf, sizeof(buf), WRT_OPTION_ICON_WINDOWVIEW);
+    elm_icon_file_set(ic, buf, NULL);
+    evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+    elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
+    elm_object_part_content_set(toolbarButton, "icon", ic);
+
+    evas_object_size_hint_align_set(toolbarButton,
+            EVAS_HINT_FILL,
+            EVAS_HINT_FILL);
+    evas_object_size_hint_weight_set(toolbarButton,
+            EVAS_HINT_EXPAND,
+            EVAS_HINT_EXPAND);
+    evas_object_smart_callback_add(toolbarButton,
+            "clicked",
+            changeViewModeCallback,
+            this);
+    toolbarIt = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
+    elm_object_item_part_content_set(toolbarIt, "object", toolbarButton);
+
+    optionheaderClose = TRUE;
+
+    elm_object_part_content_set(m_user_layout,
+            ELM_SWALLOW_TOOLBAR,
+            toolbar);
+}
+
+void WindowData::showToolbar()
+{
+    emitSignalForUserLayout(EDJE_SHOW_TOOLBAR_SIGNAL, "");
+    m_toolbarTimer = ecore_timer_add(10.0, hideToolbarCallback, this);
+}
+
+void WindowData::hideToolbar()
+{
+    emitSignalForUserLayout(EDJE_HIDE_TOOLBAR_SIGNAL, "");
+    if(m_toolbarTimer) {
+        ecore_timer_del(m_toolbarTimer);
+        m_toolbarTimer = NULL;
+    }
+}
+
 void WindowData::createTitleButton()
 {
     // Add left button for back action
@@ -201,8 +353,7 @@ void WindowData::createTitleButton()
     elm_object_style_set(m_naviBackButton, "navigationbar_backbutton/default");
 
     Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
-    elm_object_item_part_content_set(naviIt, "prev_btn",
-                                     m_naviBackButton);
+    elm_object_item_part_content_set(naviIt, "prev_btn", m_naviBackButton);
 }
 
 void WindowData::createFloatBackButton()
@@ -244,11 +395,16 @@ Evas_Object* WindowData::createWindow(unsigned long pid)
 Evas_Object* WindowData::createPlatformLayout(Evas_Object* parent)
 {
     Evas_Object*  platform_layout = elm_layout_add(parent);
-    elm_layout_theme_set(platform_layout, LAYOUT, APPLICATION, NOINDICATOR);
+
+    if (!elm_layout_file_set(platform_layout, PLATFORM_EDJ_PATH, "platformlayout"))
+        elm_layout_theme_set(platform_layout, LAYOUT, APPLICATION, NOINDICATOR);
+
     evas_object_size_hint_expand_set(platform_layout,
                                      EVAS_HINT_EXPAND,
                                      EVAS_HINT_EXPAND);
-    elm_win_resize_object_add(m_win, platform_layout);
+
+    elm_win_resize_object_add(parent, platform_layout);
+
     edje_object_signal_emit(
             elm_layout_edje_get(platform_layout), ELM_STATE_SHOW_CONTENT, ELM);
     return platform_layout;
@@ -261,6 +417,9 @@ Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
     elm_layout_file_set(layout, DAEMON_EDJ_PATH, "client");
     evas_object_size_hint_weight_set(
             layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+    elm_win_resize_object_add(parent, layout);
+
     Elm_Object_Item* naviIt = elm_naviframe_item_push(
         /* Evas_Object *obj */
         parent,
@@ -276,6 +435,7 @@ Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
         NULL);
 
     elm_naviframe_item_title_visible_set(naviIt, EINA_FALSE);
+
     return layout;
 }
 
@@ -300,49 +460,35 @@ Evas_Object* WindowData::createNavigationBar(Evas_Object* parent)
     return navigation;
 }
 
-Evas_Object* WindowData::createProgress(Evas_Object* parent)
-{
-    Assert(parent != NULL && "Parent for progress is null");
-    Evas_Object* progress = elm_progressbar_add(parent);
-    progress = elm_progressbar_add(parent);
-    elm_object_style_set(progress, LIST_PROCESS);
-    evas_object_color_set(
-        progress,
-        PROGRESS_COLOR_R,
-        PROGRESS_COLOR_G,
-        PROGRESS_COLOR_B,
-        PROGRESS_COLOR_A);
-    Evas_Coord x, y, w, h;
-    int progressW, progressH;
-    evas_object_geometry_get(m_win, &x, &y, &w, &h);
-    progressW = w / static_cast<Evas_Coord>(PROGRESS_SIZE_RATIO);
-    progressH = progressW;
-
-    evas_object_resize(progress, progressW, progressH);
-    return progress;
-}
-
-void WindowData::alignProgressPosition()
-{
-    Evas_Coord layOutX, layOutY, layOutW, layOutH;
-    Evas_Coord progressX, progressY, progressW, progressH;
-    Evas_Coord alignedX, alignedY;
-
-    evas_object_geometry_get(
-        m_user_layout,
-        &layOutX,
-        &layOutY,
-        &layOutW,
-        &layOutH);
-    evas_object_geometry_get(
-        m_progress,
-        &progressX,
-        &progressY,
-        &progressW,
-        &progressH);
-    alignedX = (layOutW - progressW) * PROGRESS_POSITION_X + layOutX;
-    alignedY = (layOutH - progressH) * PROGRESS_POSITION_Y + layOutY;
-    evas_object_move(m_progress, alignedX, alignedY);
+void WindowData::showHiddenOption(Evas_Object* parent)
+{
+    Assert(parent != NULL && "Parent for Hiden Option");
+
+    emitSignalForUserLayout(EDJE_SHOW_HIDDENOPTION_SIGNAL, "");
+
+    edje_object_signal_callback_add(elm_layout_edje_get(parent),
+            "mouse,clicked,1",
+            "elm.rect.hiddenOption",
+            controlHiddenOptionCallback,
+            this);
+}
+
+void WindowData::hideHiddenOption(Evas_Object* parent)
+{
+    Assert(parent != NULL && "Parent for Hiden Option");
+
+    emitSignalForUserLayout(EDJE_HIDE_HIDDENOPTION_SIGNAL, "");
+
+    edje_object_signal_callback_del(elm_layout_edje_get(parent),
+            "mouse,clicked,1",
+            "elm.rect.hiddenOption",
+            controlHiddenOptionCallback);
+}
+
+void WindowData::initFullViewMode ()
+{
+    hideToolbar();
+    showHiddenOption(m_user_layout);
 }
 
 void WindowData::addNaviBackButtonCallback(
@@ -407,3 +553,92 @@ void WindowData::emitSignalForUserLayout(
     edje_object_signal_emit(
             elm_layout_edje_get(m_user_layout), emission, source);
 }
+
+void WindowData::moreButtonCallback(void *data,
+        Evas_Object */*obj*/,
+        void */*event_info*/)
+{
+    WindowData* This = static_cast<WindowData*>(data);
+    Elm_Object_Item *naviIt = elm_naviframe_top_item_get(This->m_navigation);
+
+    if (This->optionheaderClose)
+        elm_object_item_signal_emit(naviIt, "elm,state,optionheader,open", "");
+    else
+        elm_object_item_signal_emit(naviIt, "elm,state,optionheader,close", "");
+
+    This->optionheaderClose = !This->optionheaderClose;
+}
+
+
+void WindowData::changeViewModeCallback(void *data,
+        Evas_Object */*obj*/,
+        void */*event_info*/)
+{
+    WindowData* This = static_cast<WindowData*>(data);
+    Elm_Object_Item *naviIt = elm_naviframe_top_item_get(This->m_navigation);
+
+    if(elm_naviframe_item_title_visible_get(naviIt)) {
+        This->hideTitle();
+        This->showHiddenOption(This->m_user_layout);
+
+    } else {
+        This->createTitle(This->m_title.c_str(), This->m_ctxMenuItems);
+        This ->hideToolbar();
+    }
+}
+
+void WindowData::controlHiddenOptionCallback(void *data,
+        Evas_Object */*obj*/,
+        const char */*emission*/,
+        const char */*source*/)
+{
+    LogDebug("controlHiddenOptionCallback");
+    WindowData* This = static_cast<WindowData *>(data);
+    Elm_Object_Item *naviIt = elm_naviframe_top_item_get(This->m_navigation);
+
+    if(!elm_naviframe_item_title_visible_get(naviIt)) {
+        const char* state = edje_object_part_state_get(
+                elm_layout_edje_get(This->m_user_layout),
+                "elm.swallow.toolbar",
+                NULL);
+
+        if (state && !strncmp(state, "default", strlen("default"))) {
+            This->showToolbar();
+            This->hideHiddenOption(This->m_user_layout);
+        }
+        else {
+            This->initFullViewMode();
+        }
+
+    }
+}
+
+Eina_Bool WindowData::hideToolbarCallback(void *data)
+{
+    WindowData *This = static_cast<WindowData *>(data);
+
+    This->initFullViewMode();
+    return TRUE;
+}
+
+void WindowData::toggleFullscreen(bool fullscreen)
+{
+    LogDebug(__PRETTY_FUNCTION__);
+
+    static bool alreadyFullscreen = false;
+
+    if (alreadyFullscreen == 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 the title bar.
+        fullscreen ? hideTitle() : showTitle(m_title.c_str());
+
+    if (m_indicator) //If indicator is shown by default, toggle it.
+        toggleIndicator(!fullscreen);
+
+    alreadyFullscreen = !alreadyFullscreen;
+}
index 262df32..818b037 100755 (executable)
@@ -28,6 +28,7 @@
 #include <vector>
 #include <string>
 #include <dpl/noncopyable.h>
+#include <list>
 
 /*
  * Current layout structure
  *                  widget_area (elm_webview)
  *
  */
+namespace {
+const char *const WRT_OPTION_LABEL_BACKWARD = "Backward";
+const char *const WRT_OPTION_LABEL_FORWARD = "Forward";
+const char *const WRT_OPTION_LABEL_RELOAD = "Reload";
+const char *const WRT_OPTION_LABEL_FULLVIEW = "Full view";
+
+const char *const WRT_OPTION_ICON_BACKWARD = "/usr/etc/wrt/icon_left_arrow.png";
+const char *const WRT_OPTION_ICON_FORWARD = "/usr/etc/wrt/icon_right_arrow.png";
+const char *const WRT_OPTION_ICON_RELOAD  = "/usr/etc/wrt/icon_refresh.png";
+const char *const WRT_OPTION_ICON_WINDOWVIEW = "/usr/etc/wrt/mp_stop.png";
+}
 
 class WindowData : private DPL::Noncopyable
 {
@@ -47,6 +59,7 @@ 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);
+
     struct EventWithFunction
     {
         CallbackType function;
@@ -63,6 +76,16 @@ class WindowData : private DPL::Noncopyable
   public:
     Evas_Object* m_win;
     Evas_Object* m_conformant;
+    bool m_debugMode;
+
+    struct CtxMenuItem
+    {
+        std::string label;
+        std::string icon;
+        Evas_Smart_Cb callback;
+        void* data;
+    };
+    typedef std::list<CtxMenuItem> CtxMenuItems;
 
     explicit WindowData(unsigned long pid, bool manualInit=false);
     virtual ~WindowData();
@@ -70,14 +93,6 @@ class WindowData : private DPL::Noncopyable
     void init();
     void setEvasObjectForLayout(Evas_Object* evas_object);
     void unsetEvasObjectForLayout();
-    void loadingOn();
-    void loadingOff();
-    void moveProgress();
-    void setViewModeFullScreen(bool indicator, bool backbutton);
-    void setViewModeMaximized(
-            const char *title,
-            bool indicator,
-            bool backbutton);
     void addNaviBackButtonCallback(
             const char* event,
             CallbackType callback,
@@ -103,13 +118,46 @@ class WindowData : private DPL::Noncopyable
             const char* emission,
             const char* source);
 
+    void changeViewMode();
+    void createTitleToolbar(CtxMenuItems ctxMenuItems);
+    void createToolbar(CtxMenuItems ctxMenuItems);
+    void showToolbar();
+    void hideToolbar();
+    void createOptionButton();
+    void destroyOptionButton();
+    void setViewMode(
+            const char *title,
+            bool fullscreen,
+            bool indicator,
+            bool backbutton,
+            CtxMenuItems ctxMenuItems);
+    void initFullViewMode();
+
+    static void moreButtonCallback(void *data,
+            Evas_Object *obj,
+            void *event_info);
+    static void changeViewModeCallback(void *data,
+            Evas_Object *obj,
+            void *event_info);
+    static void controlHiddenOptionCallback(void *data,
+            Evas_Object *obj,
+            const char *emission,
+            const char *source);
+    static Eina_Bool hideToolbarCallback(void *data);
+    void toggleFullscreen(bool fullscreen);
+
   protected:
     Evas_Object* m_platform_layout;
     Evas_Object* m_user_layout;
     Evas_Object* m_navigation;
     Evas_Object* m_naviBackButton;
     Evas_Object* m_floatBackButton;
-    Evas_Object* m_progress;
+    bool optionheaderClose;
+    std::string m_title;
+    CtxMenuItems m_ctxMenuItems;
+    Ecore_Timer *m_toolbarTimer;
+    bool m_indicator;
+    bool m_fullscreen;
 
     Evas_Object* createWindow(unsigned long pid);
     Evas_Object* createPlatformLayout(Evas_Object* parent);
@@ -117,12 +165,18 @@ class WindowData : private DPL::Noncopyable
     Evas_Object* createUserLayout(Evas_Object* parent);
     Evas_Object* createConformant(Evas_Object* parent);
     Evas_Object* createProgress(Evas_Object* parent);
+    void showHiddenOption(Evas_Object* parent);
+    void hideHiddenOption(Evas_Object* parent);
+
     void alignProgressPosition();
-    void createTitle(const char* data);
-    void removeTitle();
+    void createTitle(const char* data, CtxMenuItems ctxMenuItems);
+    void showTitle(const char* data);
+    void hideTitle();
+    void createMoreButton();
     void createTitleButton();
     void createFloatBackButton();
     void updateTitleButton(const bool display);
+    void toggleIndicator(bool indicator);
 };
 
 #endif /* WINDOW_INITIALIZE_H_ */
index daf05a1..14f7d4d 100644 (file)
@@ -28,6 +28,8 @@
 #include <widget_deserialize_model.h>
 #include <launch_user_data.h>
 #include <EWebKit2.h>
+#include <dpl/localization/w3c_file_localization.h>
+#include <dpl/localization/LanguageTagsProvider.h>
 
 //W3C PACKAGING enviroment variable name
 #define W3C_DEBUG_ENV_VARIABLE "DEBUG_LOAD_FINISH"
@@ -40,7 +42,6 @@ const std::string VIEWMODE_TYPE_MAXIMIZED = "maximized";
 WrtClient::WrtClient(int argc, char **argv) :
     Application(argc, argv, "wrt-client", false),
     DPL::TaskDecl<WrtClient>(this),
-    m_handle(-1),
     m_launched(false),
     m_initializing(false),
     m_initialized(false),
@@ -95,6 +96,7 @@ void WrtClient::OnPause()
         return;
     }
     m_widget->Suspend();
+    evas_object_focus_set(m_widget->GetCurrentWebview(), EINA_FALSE);
     m_widgetState = WidgetState_Suspended;
 }
 
@@ -145,7 +147,9 @@ void WrtClient::showHelpAndQuit()
            "options too.\n"
            "  -h,    --help                                 show this help\n"
            "  -l,    --launch                               "
-           "launch widget with given ID\n"
+           "launch widget with given tizen ID\n"
+           "  -t,    --tizen                                "
+           "launch widget with given tizen ID\n"
            "\n");
 
     Quit();
@@ -172,11 +176,12 @@ bool WrtClient::checkArgument()
         if (arg == "-h" || arg == "--help") {
             // Just show help
             return false;
-        } else if (arg == "-l" || arg == "--launch") {
+        } else if (arg == "-l" || arg == "--launch" ||
+                arg == "-t" || arg == "--tizen") {
             if (m_argc != 3) {
                 return false;
             }
-            m_handle = atoi(m_argv[2]);
+            m_tizenId = std::string(m_argv[2]);
         } else {
             return false;
         }
@@ -188,12 +193,8 @@ bool WrtClient::checkArgument()
         }
 
         // Launch widget based on application basename
-        if (sscanf(arg.c_str(), "%i", &m_handle) != 1) {
-            printf("failed: invalid widget handle\n");
-            return false;
-        }
-
-        LogDebug("Widget Id: " << m_handle << " (" << arg << ")");
+        m_tizenId = arg;
+        LogDebug("Tizen id: " << m_tizenId);
     }
 
     return true;
@@ -234,10 +235,10 @@ void WrtClient::setSdkLauncherDebugData()
     }
 }
 
-bool WrtClient::checkDebugMode(WidgetModel* model, SDKDebugData* debugData)
+bool WrtClient::checkDebugMode(SDKDebugData* debugData)
 {
     LogError("Checking for debug mode");
-    Assert(model && "Passed widget model is NULL!");
+    Assert(m_dao);
 
     bool debugMode = debugData->debugMode;
 
@@ -249,8 +250,7 @@ bool WrtClient::checkDebugMode(WidgetModel* model, SDKDebugData* debugData)
         // In WAC widget, only test widgets can use web inspector.
         // In TIZEN widget,
         // every launched widgets as debug mode can use it.
-        if (model->Type.Get().appType ==
-            WrtDB::APP_TYPE_WAC20)
+        if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_WAC20)
         {
             bool developerMode =
                 GlobalLogicSingleton::Instance().GetGlobalModel()
@@ -287,24 +287,12 @@ void WrtClient::initStep()
         m_returnStatus = ReturnStatus::Failed;
         SwitchToStep(&WrtClient::shutdownStep);
     }
-    DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
-            NextStepEvent());
-}
 
-void WrtClient::localizeWidgetModel() {
-    Assert(!!m_widget);
-    WRT::WidgetModelPtr model = m_widget->GetModel();
-    Assert(!!model);
-    Domain::localizeWidgetModel(model);
-    model->RunningName.Set(model->Name.Get());
-    model->RunningIcon.Set(model->Icon.Get());
-    model->RunningStartURL.Set(model->StartURL.Get());
-    model->RunningShortName.Set(model->ShortName.Get());
-    model->RunningDescription.Set(model->Description.Get());
-    model->RunningLicense.Set(model->License.Get());
-    model->RunningLicenseHref.Set(model->LicenseHref.Get());
-    model->RunningStartFileInfo.Set(
-        model->StartFileInfo.Get());
+    // 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);
 }
 
 bool WrtClient::checkWACTestCertififedWidget()
@@ -316,14 +304,12 @@ bool WrtClient::checkWACTestCertififedWidget()
     // i.e. the functions must not be usable for normal WAC widgets, even when
     // a WAC test widget is executing.
     ADD_PROFILING_POINT("DeveloperModeCheck", "start");
-    Assert(!!m_widget);
-    WRT::WidgetModelPtr model = m_widget->GetModel();
-    Assert(!!model);
+    Assert(!!m_dao);
     // WAC test widget
     // A widget signed with a WAC-issued test certificate as described in
     // Developer Mode.
 
-    bool developerWidget = model->IsTestWidget.Get();
+    bool developerWidget = m_dao->isTestWidget();
     bool developerMode =
         GlobalLogicSingleton::Instance().GetGlobalModel()->DeveloperMode.Get();
 
@@ -346,11 +332,11 @@ bool WrtClient::checkWACTestCertififedWidget()
     return true;
 }
 
-void WrtClient::loadFinishCallback(bool success, void* data)
+void WrtClient::loadFinishCallback(bool success)
 {
-    WrtClient* wrtClient = static_cast<WrtClient*>(data);
+    ADD_PROFILING_POINT("loadFinishCallback", "start");
     SDKDebugData* debug = new SDKDebugData;
-    debug->debugMode = wrtClient->m_debugMode;
+    debug->debugMode = m_debugMode;
     debug->pid = new unsigned long(getpid());
 
     LogInfo("Post result of launch");
@@ -358,12 +344,10 @@ void WrtClient::loadFinishCallback(bool success, void* data)
     // Start inspector server, if current mode is debugger mode.
     // In the WK2 case, ewk_view_inspector_server_start should
     // be called after WebProcess is created.
-    if (wrtClient->checkDebugMode(
-                wrtClient->m_widget->GetModel().get(), debug))
+    if (checkDebugMode(debug))
     {
         debug->portnum =
-            ewk_view_inspector_server_start(
-                    wrtClient->m_widget->GetCurrentWebview(), 0);
+            ewk_view_inspector_server_start(m_widget->GetCurrentWebview(), 0);
         if (debug->portnum == 0) {
             LogWarning("Failed to get portnum");
         } else {
@@ -386,24 +370,25 @@ void WrtClient::loadFinishCallback(bool success, void* data)
     if (success) {
         LogDebug("Launch succesfull");
 
-        wrtClient->m_launched = true;
-        wrtClient->m_initializing = false;
+        m_launched = true;
+        m_initializing = false;
         setlinebuf(stdout);
+        ADD_PROFILING_POINT("loadFinishCallback", "stop");
         printf("launched\n");
         fflush(stdout);
     } else {
         printf("failed\n");
 
-        wrtClient->m_returnStatus = ReturnStatus::Failed;
+        m_returnStatus = ReturnStatus::Failed;
         //shutdownStep
-        wrtClient->DPL::Event::ControllerEventHandler<NextStepEvent>::
+        DPL::Event::ControllerEventHandler<NextStepEvent>::
                 PostEvent(NextStepEvent());
     }
 
     if(debug->debugMode)
     {
         LogDebug("Send RT signal to wrt-launcher(pid: "
-                << wrtClient->m_sdkLauncherPid << ", status: " << success);
+                << m_sdkLauncherPid << ", status: " << success);
         union sigval sv;
         /* send real time signal with result to wrt-launcher */
         if(success)
@@ -415,7 +400,7 @@ void WrtClient::loadFinishCallback(bool success, void* data)
         {
            sv.sival_int = -1;
         }
-        sigqueue(wrtClient->m_sdkLauncherPid, SIGRTMIN, sv);
+        sigqueue(m_sdkLauncherPid, SIGRTMIN, sv);
     }
 
     ApplicationDataSingleton::Instance().freeBundle();
@@ -425,36 +410,35 @@ void WrtClient::loadFinishCallback(bool success, void* data)
     delete debug;
 }
 
-void WrtClient::progressFinishCallback(void* data)
+void WrtClient::progressFinishCallback()
 {
-    WrtClient* wrtClient = static_cast<WrtClient*>(data);
-    wrtClient->m_splashScreen->stopSplashScreen();
+    m_splashScreen->stopSplashScreen();
 }
 
-void WrtClient::windowCloseCallback(void* data)
+void WrtClient::windowCloseCallback()
 {
     LogDebug("window close called, terminating app");
-    WrtClient* wrtClient = static_cast<WrtClient*>(data);
-    wrtClient->SwitchToStep(&WrtClient::shutdownStep);
-    wrtClient->DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
+    SwitchToStep(&WrtClient::shutdownStep);
+    DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
             NextStepEvent());
 }
 
-void WrtClient::webCrashCallback(void* data)
+void WrtClient::webCrashCallback()
 {
     LogDebug("webProcess crashed");
-    WrtClient* wrtClient = static_cast<WrtClient*>(data);
-    wrtClient->SwitchToStep(&WrtClient::shutdownStep);
-    wrtClient->DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
+    SwitchToStep(&WrtClient::shutdownStep);
+    DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
             NextStepEvent());
 }
 
+
 void WrtClient::launchStep()
 {
+    ADD_PROFILING_POINT("launchStep", "start");
     LogDebug("Launching widget ...");
 
-    m_widget =
-        WRT::CoreModuleSingleton::Instance().getRunnableWidgetObject(m_handle);
+    m_widget = WRT::CoreModuleSingleton::Instance()
+                    .getRunnableWidgetObject(m_tizenId);
     if (!m_widget) {
         LogError("RunnableWidgetObject is NULL, stop launchStep");
         DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
@@ -476,8 +460,8 @@ void WrtClient::launchStep()
         return;
     }
 
-    // Widget is not running, localized data can be updated
-    localizeWidgetModel();
+    m_dao.reset(new WrtDB::WidgetDAOReadOnly(DPL::FromASCIIString(m_tizenId)));
+    Domain::localizeWidgetModel(m_dao->getDefaultlocale());
     LocalizationSetting::SetLanguageChangedCallback(
             languageChangedCallback, this);
 
@@ -485,14 +469,14 @@ void WrtClient::launchStep()
     m_windowData.reset(new WindowData(static_cast<unsigned long>(getpid())));
     ADD_PROFILING_POINT("CreateWindow", "stop");
 
-    WRT::UserCallbacksPtr cbs(new WRT::UserCallbacks);
+    WRT::UserDelegatesPtr cbs(new WRT::UserDelegates);
     m_splashScreen.reset(
             new SplashScreenSupport(m_windowData->m_win));
-    if (m_splashScreen->createSplashScreen(m_handle)) {
+    if (m_splashScreen->createSplashScreen(m_dao->getSplashImgSrc())) {
         m_splashScreen->startSplashScreen();
-        cbs->progressFinish = progressFinishCallback;
+        cbs->progressFinish = DPL::MakeDelegate(this, &WrtClient::progressFinishCallback);
     }
-    DPL::OptionalString startUrl = m_widget->GetModel()->RunningStartURL.Get();
+    DPL::OptionalString startUrl = W3CFileLocalization::getStartFile(m_dao);
     m_widget->PrepareView(DPL::ToUTF8String(*startUrl),
             m_windowData->m_win);
     //you can't show window with splash screen before PrepareView
@@ -517,23 +501,24 @@ void WrtClient::launchStep()
     LogInfo("Widget launch accepted. Entering running state");
     m_widgetState = WidgetState_Running;
 
-    cbs->loadFinish = loadFinishCallback;
-    cbs->bufferSet = setLayout;
-    cbs->bufferUnset = unsetLayout;
-    cbs->windowClose = windowCloseCallback;
-    cbs->webCrash = webCrashCallback;
+    cbs->loadFinish = DPL::MakeDelegate(this, &WrtClient::loadFinishCallback);
+    cbs->bufferSet = DPL::MakeDelegate(this, &WrtClient::setLayout);
+    cbs->bufferUnset = DPL::MakeDelegate(this, &WrtClient::unsetLayout);
+    cbs->windowClose = DPL::MakeDelegate(this, &WrtClient::windowCloseCallback);
+    cbs->webCrash = DPL::MakeDelegate(this, &WrtClient::webCrashCallback);
+    cbs->toggleFullscreen = DPL::MakeDelegate(m_windowData.get(), &WindowData::toggleFullscreen);
 
-    m_widget->SetUserCallbacks(cbs, this);
+    m_widget->SetUserDelegates(cbs);
     m_widget->Show();
     m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
+    ADD_PROFILING_POINT("launchStep", "stop");
 }
 
 void WrtClient::initializeWindowModes()
 {
     Assert(m_windowData);
-    WRT::WidgetModelPtr model = m_widget->GetModel();
-    Assert(model);
-    auto windowModes = model->WindowModes.Get();
+    Assert(m_dao);
+    auto windowModes = m_dao->getWindowModes();
     bool fullscreen = false;
     FOREACH(it, windowModes)
     {
@@ -547,26 +532,57 @@ void WrtClient::initializeWindowModes()
     }
     bool indicator = true;
     bool backbutton = false;
-    if (model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
-        indicator
-        = (model->SettingList.Get().getIndicatorPresence()
-           == Indicator_Enable);
-        backbutton
-        = (model->SettingList.Get().getBackButtonPresence()
-           == BackButton_Enable);
+    if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
+        WidgetSettings widgetSettings;
+        m_dao->getWidgetSettings(widgetSettings);
+        WidgetSettingList settings(widgetSettings);
+        indicator = (settings.getIndicatorPresence()
+                == Indicator_Enable);
+        backbutton = (settings.getBackButtonPresence()
+                == BackButton_Enable);
     }
 
-    if (!fullscreen) {
-        std::string name = "";
-        if (!(model->Name.Get().IsNull())) {
-            name = DPL::ToUTF8String(*(model->Name.Get()));
-        }
-        m_windowData->setViewModeMaximized(
-            name.c_str(), indicator, backbutton);
-    } else {
-        m_windowData->setViewModeFullScreen(
-            indicator, backbutton);
+    WrtDB::WidgetLocalizedInfo localizedInfo =
+            W3CFileLocalization::getLocalizedInfo(m_dao);
+    std::string name = "";
+    if (!(localizedInfo.name.IsNull())) {
+        name = DPL::ToUTF8String(*(localizedInfo.name));
+    }
+    LogInfo("initializeWindowModes " << m_debugMode);
+
+    SDKDebugData* debug = new SDKDebugData;
+    if(m_debugMode) {
+        m_windowData->m_debugMode = TRUE;
+    }
+    else {
+        m_windowData->m_debugMode = FALSE;
     }
+
+    WindowData::CtxMenuItems ctxMenuItems;
+
+    WindowData::CtxMenuItem ctxMenuBackword;
+    ctxMenuBackword.label = WRT_OPTION_LABEL_BACKWARD;
+    ctxMenuBackword.icon = WRT_OPTION_ICON_BACKWARD;
+    ctxMenuBackword.callback = backwardCallback;
+    ctxMenuBackword.data = this;
+    ctxMenuItems.push_back(ctxMenuBackword);
+
+    WindowData::CtxMenuItem ctxMenuReload;
+    ctxMenuReload.label = WRT_OPTION_LABEL_RELOAD;
+    ctxMenuReload.icon = WRT_OPTION_ICON_RELOAD;
+    ctxMenuReload.callback = reloadCallback;
+    ctxMenuReload.data = this;
+    ctxMenuItems.push_back(ctxMenuReload);
+
+    WindowData::CtxMenuItem ctxMenuForward;
+    ctxMenuForward.label = WRT_OPTION_LABEL_FORWARD;
+    ctxMenuForward.icon = WRT_OPTION_ICON_FORWARD;
+    ctxMenuForward.callback = forwardCallback;
+    ctxMenuForward.data = this;
+    ctxMenuItems.push_back(ctxMenuForward);
+
+    m_windowData->setViewMode(name.c_str(), fullscreen, indicator, backbutton, ctxMenuItems);
+
 }
 
 void WrtClient::backButtonCallback(void* data,
@@ -578,16 +594,56 @@ void WrtClient::backButtonCallback(void* data,
 
     WrtClient* This = static_cast<WrtClient*>(data);
 
-    This->m_widget->GoBack();
+    This->m_widget->Backward();
 }
 
+void WrtClient::backwardCallback(void *data,
+        Evas_Object */*obj*/,
+        void */*event_info*/)
+{
+    LogInfo("BackButtonCallback");
+    Assert(data);
+
+    WrtClient* This = static_cast<WrtClient*>(data);
+
+    This->m_widget->Backward();
+    This->m_windowData->initFullViewMode();
+}
+
+void WrtClient::reloadCallback(void *data,
+        Evas_Object */*obj*/,
+        void */*event_info*/)
+{
+    LogInfo("reloadCallback");
+
+    WrtClient* This = static_cast<WrtClient*>(data);
+
+    This->m_widget->Reload();
+    This->m_windowData->initFullViewMode();
+}
+
+void WrtClient::forwardCallback(void *data,
+        Evas_Object */*obj*/,
+        void */*event_info*/)
+{
+    LogInfo("forwardCallback");
+
+    WrtClient* This = static_cast<WrtClient*>(data);
+
+    This->m_widget->Forward();
+    This->m_windowData->initFullViewMode();
+}
+
+
 void WrtClient::connectElmCallback()
 {
     Assert(m_windowData);
-    WRT::WidgetModelPtr model = m_widget->GetModel();
-    Assert(model);
-    if (model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
-        if (model->SettingList.Get().getBackButtonPresence() ==
+    Assert(m_dao);
+    if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
+        WidgetSettings widgetSettings;
+        m_dao->getWidgetSettings(widgetSettings);
+        WidgetSettingList settings(widgetSettings);
+        if (settings.getBackButtonPresence() ==
                 BackButton_Enable)
         {
             m_windowData->addFloatBackButtonCallback(
@@ -596,8 +652,7 @@ void WrtClient::connectElmCallback()
                 this);
         }
 
-        WidgetSettingScreenLock rotationValue =
-                model->SettingList.Get().getRotationValue();
+        WidgetSettingScreenLock rotationValue = settings.getRotationValue();
         if (rotationValue == Screen_Portrait) {
             elm_win_rotation_with_resize_set(m_windowData->m_win, 0);
         } else if (rotationValue == Screen_Landscape) {
@@ -608,23 +663,19 @@ void WrtClient::connectElmCallback()
     }
 }
 
-void WrtClient::setLayout(Evas_Object* newBuffer, void* data) {
+void WrtClient::setLayout(Evas_Object* newBuffer) {
     LogDebug("add new webkit buffer to window");
-    Assert(data);
     Assert(newBuffer);
-    WrtClient* wrtClient = static_cast<WrtClient*>(data);
-    elm_object_content_set(wrtClient->m_windowData->m_conformant, newBuffer);
+    elm_object_content_set(m_windowData->m_conformant, newBuffer);
     evas_object_show(newBuffer);
     evas_object_focus_set(newBuffer, EINA_TRUE);
 }
 
-void WrtClient::unsetLayout(Evas_Object* currentBuffer, void* data) {
+void WrtClient::unsetLayout(Evas_Object* currentBuffer) {
     LogDebug("remove current webkit buffer from window");
-    Assert(data);
     Assert(currentBuffer);
-    WrtClient* wrtClient = static_cast<WrtClient*>(data);
     evas_object_hide(currentBuffer);
-    elm_object_content_unset(wrtClient->m_windowData->m_conformant);
+    elm_object_content_unset(m_windowData->m_conformant);
 }
 
 void WrtClient::shutdownStep()
@@ -645,14 +696,16 @@ int WrtClient::languageChangedCallback(void *data)
 {
     LogDebug("Language Changed");
     WrtClient* wrtClient = static_cast<WrtClient*>(data);
-    WRT::WidgetModelPtr model = wrtClient->m_widget->GetModel();
 
-    LocalizationSetting::SetLocalization();
+    LanguageTags oldtags = LanguageTagsProviderSingleton::Instance().getLanguageTags();
+    // reset function fetches system locales and recreates language tags
+    LanguageTagsProviderSingleton::Instance().resetLanguageTags();
+    LanguageTags newtags = LanguageTagsProviderSingleton::Instance().getLanguageTags();
 
-    LanguageTagsList tags = LocalizationUtils::GetUserAgentLanguageTags();
-    if (model->LanguageTags.Get() != tags) {
+    // check whether LanguageTags changed or not
+    if (oldtags != newtags) {
         // update localized data
-        wrtClient->localizeWidgetModel();
+        Domain::localizeWidgetModel(wrtClient->m_dao->getDefaultlocale());
 
         if (true == wrtClient->m_launched &&
                 wrtClient->m_widgetState != WidgetState_Stopped) {
@@ -681,6 +734,8 @@ int main(int argc,
                 LogDebug("Enable backend");
         }
     }
+    setenv("CAIRO_GL_COMPOSITOR", "msaa", 1);
+    setenv("CAIRO_GL_LAZY_FLUSHING", "yes", 1);
     // Set log tagging
     DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-CLIENT");
 
index 1f97871..d666d5f 100644 (file)
@@ -23,6 +23,8 @@
 #include <dpl/task.h>
 #include <bundle.h>
 #include <i_runnable_widget_object.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/wrt-dao-ro/common_dao_types.h>
 #include "widget_state.h"
 #include <common_error.h>
 #include <launch_user_data.h>
@@ -55,47 +57,55 @@ class WrtClient :
     ReturnStatus::Type   getReturnStatus() const;
 
   protected:
-    virtual void         OnStop();
-    virtual void         OnCreate();
-    virtual void         OnResume();
-    virtual void         OnPause();
-    virtual void         OnReset(bundle *b);
-    virtual void         OnTerminate();
+    virtual void OnStop();
+    virtual void OnCreate();
+    virtual void OnResume();
+    virtual void OnPause();
+    virtual void OnReset(bundle *b);
+    virtual void OnTerminate();
 
-    void                 setStep();
+    void setStep();
 
   private:
-    void                 showHelpAndQuit();
-    bool                 checkArgument();
-    void                 setSdkLauncherDebugData();
-    bool                 checkDebugMode(
-                            WidgetModel* model, 
-                            SDKDebugData* debugData);
-    bool                 checkWACTestCertififedWidget();
-    void                 localizeWidgetModel();
-    void                 connectElmCallback();
-    void                 initializeWindowModes();
+    void showHelpAndQuit();
+    bool checkArgument();
+    void setSdkLauncherDebugData();
+    bool checkDebugMode(SDKDebugData* debugData);
+    bool checkWACTestCertififedWidget();
+    void connectElmCallback();
+    void initializeWindowModes();
 
     // Events
-    virtual void         OnEventReceived(const NextStepEvent& event);
+    virtual void OnEventReceived(const NextStepEvent& event);
+
     // UI callback
-    static void          backButtonCallback(void* data,
+    static void backButtonCallback(void* data,
                                    Evas_Object* obj,
                                    void* event_info);
+    static void backwardCallback(void* data,
+            Evas_Object* obj,
+            void* event_info);
+    static void reloadCallback(void* data,
+            Evas_Object* obj,
+            void* event_info);
+    static void forwardCallback(void* data,
+            Evas_Object* obj,
+            void* event_info);
 
     // launching steps
-    void                 initStep();
-    void                 launchStep();
-    void                 shutdownStep();
-    static int           languageChangedCallback(void *data);
-    static void          loadFinishCallback(bool success, void* data);
-    static void          progressFinishCallback(void* data);
-    static void          windowCloseCallback(void* data);
-    static void          webCrashCallback(void* data);
-    static void          setLayout(Evas_Object* newBuffer, void* data);
-    static void          unsetLayout(Evas_Object* currentBuffer, void* data);
+    void initStep();
+    void launchStep();
+    void shutdownStep();
+    static int languageChangedCallback(void *data);
+    void loadFinishCallback(bool success);
+    void progressFinishCallback();
+    void windowCloseCallback();
+    void webCrashCallback();
+    void setLayout(Evas_Object* newBuffer);
+    void unsetLayout(Evas_Object* currentBuffer);
+
     // Private data
-    int m_handle;
+    std::string m_tizenId;
     bool m_launched;
     bool m_initializing;
     bool m_initialized;
@@ -105,6 +115,7 @@ class WrtClient :
     unsigned short m_debuggerPort;
     ReturnStatus::Type m_returnStatus;
     WRT::RunnableWidgetObjectPtr m_widget;
+    WrtDB::WidgetDAOReadOnlyPtr m_dao;
     WidgetState m_widgetState;
     std::unique_ptr<WindowData> m_windowData;
     std::unique_ptr<SplashScreenSupport> m_splashScreen;
index 93568fb..d3cf750 100644 (file)
@@ -56,7 +56,7 @@ class DBConnection
     }
 };
 
-static DPL::ScopedPtr<DBConnection> g_dbConnection;
+static std::unique_ptr<DBConnection> g_dbConnection;
 
 typedef struct
 {
@@ -90,9 +90,9 @@ static char* new_strdup(const char *str)
 
 static bool display_widget_info()
 {
-    if (NULL == g_dbConnection) {
+    if (NULL == g_dbConnection.get()) {
         Try {
-            g_dbConnection.Reset(new DBConnection());
+            g_dbConnection.reset(new DBConnection());
             g_dbConnection->AttachDatabase();
         }
         Catch (DPL::DB::SqlConnection::Exception::Base) {
@@ -101,32 +101,32 @@ static bool display_widget_info()
         }
     }
 
-    WidgetHandleList widgetList = WrtDB::WidgetDAOReadOnly::getHandleList();
+    WidgetDAOReadOnlyList widgetList =
+            WrtDB::WidgetDAOReadOnly::getWidgetList();
 
-    printf("%3s%12s%32s%16s%64s%32s\n",
-           "No", "ID", "Name", "Version", "GUID", "Package Name");
-    printf("%3s%12s%32s%16s%64s%32s\n",
-           "--", "--", "----", "-------", "----", "------------");
+    printf("%3s %32s %16s %64s %16s\n",
+           "No", "Name", "Version", "GUID", "Package Name");
+    printf("%3s %32s %16s %64s %16s\n",
+           "--", "--", "----", "-------", "----");
 
     int number = 1;
-    FOREACH(iterator, widgetList) {
+    FOREACH(dao, widgetList) {
         widget_info *info = new widget_info;
         memset(info, 0x00, sizeof(widget_info));
 
-        WrtDB::WidgetDAOReadOnly dao(*iterator);
-        WrtDB::WidgetGUID guid = dao.getGUID();
-        DPL::Optional<DPL::String> version = dao.getVersion();
-        DPL::Optional<DPL::String> package_name = dao.getPkgname();
+        WrtDB::WidgetGUID guid = (*dao)->getGUID();
+        DPL::Optional<DPL::String> version = (*dao)->getVersion();
+        DPL::Optional<DPL::String> package_name = (*dao)->getPkgname();
 
         /*get WidgetName*/
         DPL::Optional<DPL::String> widget_name;
-        DPL::OptionalString dl = dao.getDefaultlocale();
+        DPL::OptionalString dl = (*dao)->getDefaultlocale();
         WrtDB::WidgetLocalizedInfo localizedInfo;
         if (dl.IsNull()) {
             DPL::String languageTag(L"");
-            localizedInfo = dao.getLocalizedInfo(languageTag);
+            localizedInfo = (*dao)->getLocalizedInfo(languageTag);
         } else {
-            localizedInfo = dao.getLocalizedInfo(*dl);
+            localizedInfo = (*dao)->getLocalizedInfo(*dl);
         }
 
         widget_name = localizedInfo.name;
@@ -149,9 +149,9 @@ static bool display_widget_info()
             info->pkg_name =
                 new_strdup(DPL::ToUTF8String(*package_name).c_str());
         }
-        printf("%3i%12i%32s%16s%64s%32s\n",
+
+        printf("%3i %32s %16s %64s %16s\n",
                number++,
-               *iterator,
                !info->name ? "[NULL]" : info->name,
                !info->version ? "[NULL]" : info->version,
                !info->guid ? "[NULL]" : info->guid,
@@ -168,7 +168,7 @@ static void print_help(FILE *stream, int /*exit_code*/)
     fprintf(stream, "Usage : %s [ ... ]\n", program);
     fprintf(stream,
             "   -h                       --help              Display this usage information.\n"
-            "   -l                       --list              Display installed widgets handle and name list\n"
+            "   -l                       --list              Display installed widgets list\n"
             "   -s [GUID]or[PkgName]     --start             Launch widget with package name or GUID\n"
             "   -k [GUID]or[PkgName]     --kill              Kill widget with package name or GUID\n"
             "   -d                       --debug             Activate debug mode\n"
@@ -295,9 +295,9 @@ int main(int argc, char* argv[])
 
         case 'v':
             strncpy(temp_arg, optarg, strlen(optarg));
-            if (NULL == g_dbConnection) {
+            if (NULL == g_dbConnection.get()) {
                 Try {
-                    g_dbConnection.Reset(new DBConnection());
+                    g_dbConnection.reset(new DBConnection());
                     g_dbConnection->AttachDatabase();
                 }
                 Catch (DPL::DB::SqlConnection::Exception::Base) {
@@ -313,9 +313,9 @@ int main(int argc, char* argv[])
             break;
         case 'c':
             strncpy(temp_arg, optarg, strlen(optarg));
-            if (NULL == g_dbConnection) {
+            if (NULL == g_dbConnection.get()) {
                 Try {
-                    g_dbConnection.Reset(new DBConnection());
+                    g_dbConnection.reset(new DBConnection());
                     g_dbConnection->AttachDatabase();
                 }
                 Catch (DPL::DB::SqlConnection::Exception::Base) {
@@ -331,9 +331,9 @@ int main(int argc, char* argv[])
             break;
         case 'i':
             strncpy(temp_arg, optarg, strlen(optarg));
-            if (NULL == g_dbConnection) {
+            if (NULL == g_dbConnection.get()) {
                 Try {
-                    g_dbConnection.Reset(new DBConnection());
+                    g_dbConnection.reset(new DBConnection());
                     g_dbConnection->AttachDatabase();
                 }
                 Catch (DPL::DB::SqlConnection::Exception::Base) {
@@ -345,9 +345,9 @@ int main(int argc, char* argv[])
             break;
         case 'm':
             strncpy(temp_arg, optarg, strlen(optarg));
-            if (NULL == g_dbConnection) {
+            if (NULL == g_dbConnection.get()) {
                 Try {
-                    g_dbConnection.Reset(new DBConnection());
+                    g_dbConnection.reset(new DBConnection());
                     g_dbConnection->AttachDatabase();
                 }
                 Catch (DPL::DB::SqlConnection::Exception::Base) {
@@ -370,9 +370,9 @@ int main(int argc, char* argv[])
     if ((op == 's') || (op == 'k')) {
         const char *temp = NULL;
 
-        if (NULL == g_dbConnection) {
+        if (NULL == g_dbConnection.get()) {
             Try {
-                g_dbConnection.Reset(new DBConnection());
+                g_dbConnection.reset(new DBConnection());
                 g_dbConnection->AttachDatabase();
             }
             Catch (DPL::DB::SqlConnection::Exception::Base) {
@@ -381,20 +381,20 @@ int main(int argc, char* argv[])
             }
         }
 
-        WidgetHandleList widgetList = WrtDB::WidgetDAOReadOnly::getHandleList();
-        FOREACH(iterator, widgetList) {
-            WrtDB::WidgetDAOReadOnly dao(*iterator);
-            WrtDB::WidgetGUID d_guid = dao.getGUID();
-            DPL::OptionalString d_pkgname = dao.getPkgname();
+        WidgetDAOReadOnlyList widgetList =
+                WrtDB::WidgetDAOReadOnly::getWidgetList();
+        FOREACH(dao, widgetList) {
+            WrtDB::WidgetGUID d_guid = (*dao)->getGUID();
+            DPL::OptionalString d_pkgname = (*dao)->getPkgname();
             if (!d_guid.IsNull() &&
                 !strcmp(DPL::ToUTF8String(*d_guid).c_str(), temp_arg))
             {
-                DPL::Optional<DPL::String> package_name = dao.getPkgname();
+                DPL::Optional<DPL::String> package_name = (*dao)->getPkgname();
                 temp = DPL::ToUTF8String(*package_name).c_str();
                 break;
             }
             if (!strcmp(DPL::ToUTF8String(*d_pkgname).c_str(), temp_arg)) {
-                DPL::Optional<DPL::String> package_name = dao.getPkgname();
+                DPL::Optional<DPL::String> package_name = (*dao)->getPkgname();
                 temp = DPL::ToUTF8String(*package_name).c_str();
                 break;
             }
diff --git a/wrt.manifest b/wrt.manifest
new file mode 100644 (file)
index 0000000..1babf21
--- /dev/null
@@ -0,0 +1,12 @@
+<manifest>
+  <define>
+    <domain name="wrt" />
+    <provide>
+      <label name="wrt::wrt-client" />
+      <label name="wrt::wrt-launcher" />
+    </provide>
+  </define>
+  <request>
+    <domain name="_"/>
+  </request>
+</manifest>