From 70072ace7a88fce714ba703d07bf495a5ad84205 Mon Sep 17 00:00:00 2001 From: Kim Kibum Date: Sun, 29 Apr 2012 17:04:34 +0900 Subject: [PATCH] upload tizen1.0 source --- CMakeLists.txt | 34 +- LICENSE | 203 ++++++++ debian/changelog | 187 +++++++- debian/control | 6 +- debian/rules | 42 +- packaging/wrt-installer.spec | 69 +++ src/CMakeLists.txt | 19 +- src/config_generator/config_generator.cpp | 85 ++-- .../WidgetConfigurationManager.cpp | 4 + src/configuration_parser/parser_runner.cpp | 18 +- src/configuration_parser/powder_parser.cpp | 521 --------------------- src/configuration_parser/powder_parser.h | 81 ---- src/configuration_parser/widget_parser.cpp | 200 +------- src/configuration_parser/widget_parser.h | 6 +- src/jobs/plugin_install/plugin_install_task.cpp | 32 ++ src/jobs/plugin_install/plugin_metafile_reader.cpp | 1 + src/jobs/widget_install/job_widget_install.cpp | 202 ++++---- src/jobs/widget_install/job_widget_install.h | 14 +- src/jobs/widget_install/task_ace_check.cpp | 46 +- src/jobs/widget_install/task_ace_check.h | 2 +- src/jobs/widget_install/task_certify.cpp | 8 + src/jobs/widget_install/task_commons.cpp | 124 +++++ src/jobs/widget_install/task_commons.h | 40 ++ src/jobs/widget_install/task_db_update.cpp | 17 +- src/jobs/widget_install/task_desktop_file.cpp | 126 +++-- src/jobs/widget_install/task_parental_mode.cpp | 52 -- src/jobs/widget_install/task_prepare_files.cpp | 226 +++++++++ .../{task_parental_mode.h => task_prepare_files.h} | 43 +- src/jobs/widget_install/task_smack.cpp | 13 +- src/jobs/widget_install/task_smack.h | 2 +- src/jobs/widget_install/task_unzip.cpp | 101 +--- src/jobs/widget_install/task_widget_config.cpp | 217 ++++----- src/jobs/widget_install/task_widget_config.h | 18 +- src/jobs/widget_install/view_mode.h | 40 ++ src/jobs/widget_install/widget_install_context.h | 26 +- src/jobs/widget_install/widget_install_errors.h | 6 +- src/jobs/widget_uninstall/task_smack.cpp | 4 + src/jobs/widget_uninstall/uninstaller_context.h | 4 +- src/logic/installer_controller.cpp | 15 + src/logic/installer_controller.h | 15 +- src/logic/installer_logic.cpp | 20 +- src/logic/installer_logic.h | 5 + src/misc/feature_logic.cpp | 6 +- src/misc/feature_logic.h | 13 +- src/misc/wrt_powder_info_util.cpp | 67 --- src/misc/wrt_powder_info_util.h | 56 --- src/pkg-manager/backendlib.cpp | 6 +- src/security/ace_settings_logic.cpp | 10 +- src/security/ace_settings_logic.h | 2 +- src/security/attribute_facade.cpp | 5 +- src/security/attribute_facade.h | 2 +- src/security/i_ace_permissions.h | 2 +- src/security/i_ace_settings_client.h | 2 +- src/security/security_controller.cpp | 6 +- src/security/security_controller.h | 6 +- src/security/security_logic.cpp | 2 +- src/security/security_logic.h | 10 +- src/wrt-installer/installer_main_thread.cpp | 8 +- src/wrt-installer/wrt_installer.cpp | 145 ++++-- src/wrt-installer/wrt_installer.h | 1 + src/wrt-installer/wrt_installer_api.cpp | 40 +- src/wrt-installer/wrt_installer_api.h | 45 ++ tests/config_generator/xml/test001_basic.xml | 2 +- tests/config_generator/xml/test002_basic.xml | 2 +- tests/config_generator/xml/test003_name.xml | 2 +- tests/config_generator/xml/test004_description.xml | 2 +- tests/config_generator/xml/test005_author.xml | 2 +- tests/config_generator/xml/test006_license.xml | 2 +- tests/config_generator/xml/test007_icon.xml | 2 +- tests/config_generator/xml/test008_content.xml | 2 +- tests/config_generator/xml/test009_feature.xml | 2 +- tests/config_generator/xml/test010_preference.xml | 2 +- tests/config_generator/xml/test011_access.xml | 2 +- .../config_generator/xml/test012_tizen_setting.xml | 4 +- 74 files changed, 1791 insertions(+), 1563 deletions(-) create mode 100644 LICENSE create mode 100644 packaging/wrt-installer.spec delete mode 100644 src/configuration_parser/powder_parser.cpp delete mode 100644 src/configuration_parser/powder_parser.h create mode 100644 src/jobs/widget_install/task_commons.cpp create mode 100644 src/jobs/widget_install/task_commons.h delete mode 100644 src/jobs/widget_install/task_parental_mode.cpp create mode 100644 src/jobs/widget_install/task_prepare_files.cpp rename src/jobs/widget_install/{task_parental_mode.h => task_prepare_files.h} (50%) create mode 100644 src/jobs/widget_install/view_mode.h delete mode 100644 src/misc/wrt_powder_info_util.cpp delete mode 100644 src/misc/wrt_powder_info_util.h mode change 100755 => 100644 src/pkg-manager/backendlib.cpp mode change 100755 => 100644 src/wrt-installer/installer_main_thread.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d97a407..169d293 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,6 @@ ############################# Check minimum CMake version ##################### CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(CMAKE_EDIT_COMMAND vim) PROJECT("wrt-installer") ############################# cmake packages ################################## @@ -40,12 +39,19 @@ SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++0x -g") SET(CMAKE_C_FLAGS_RELEASE "-O2 -g") SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++0x -g") +OPTION(DPL_LOG "DPL logs status" ON) +IF(DPL_LOG) + MESSAGE(STATUS "Logging enabled for DPL") + ADD_DEFINITIONS("-DDPL_LOGS_ENABLED") +ELSE(DPL_LOG) + MESSAGE(STATUS "Logging disabled for DPL") +ENDIF(DPL_LOG) + # If supported for the target machine, emit position-independent code,suitable # for dynamic linking and avoiding any limit on the size of the global offset # table. This option makes a difference on the m68k, PowerPC and SPARC. # (BJ: our ARM too?) ADD_DEFINITIONS("-fPIC") - ADD_DEFINITIONS("-DSEPARATED_SINGLETON_IMPLEMENTATION") # Set the default ELF image symbol visibility to hidden - all symbols will be @@ -53,21 +59,13 @@ ADD_DEFINITIONS("-DSEPARATED_SINGLETON_IMPLEMENTATION") #ADD_DEFINITIONS("-fvisibility=hidden") # Set compiler warning flags -#ADD_DEFINITIONS("-Werror") # Make all warnings into errors. -ADD_DEFINITIONS("-Wall") # Generate all warnings -ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings -ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM) -ADD_DEFINITIONS("-Wno-deprecated") # No warnings about deprecated features -ADD_DEFINITIONS("-std=c++0x") # No warnings about deprecated features - -# Set Logs -OPTION(DPL_LOG "DPL logs status" ON) -IF(DPL_LOG) - MESSAGE(STATUS "Logging enabled for DPL") - ADD_DEFINITIONS("-DDPL_LOGS_ENABLED") -ELSE(DPL_LOG) - MESSAGE(STATUS "Logging disabled for DPL") -ENDIF(DPL_LOG) +#ADD_DEFINITIONS("-Werror") # Make all warnings into errors. +ADD_DEFINITIONS("-Wall") # Generate all warnings +ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings +ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM) +ADD_DEFINITIONS("-Wno-deprecated") # No warnings about deprecated features +ADD_DEFINITIONS("-std=c++0x") # No warnings about deprecated features +#ADD_DEFINITIONS("-DWRT_SMACK_ENABLED") ############################# Targets names ################################### @@ -79,4 +77,4 @@ SET(TARGET_CONFIG_GEN_LIB "wrt-config-generator") ############################# subdirectories ################################## ADD_SUBDIRECTORY(src) -ADD_SUBDIRECTORY(tests) \ No newline at end of file +ADD_SUBDIRECTORY(tests) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..247c97d --- /dev/null +++ b/LICENSE @@ -0,0 +1,203 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/debian/changelog b/debian/changelog index 87600b7..45a50a0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,26 +1,197 @@ +wrt-installer (0.0.19) unstable; urgency=low + + * Fixed N_SE-871 #2 + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.19 + + -- Jihoon Chung Mon, 23 Apr 2012 19:41:07 +0900 + +wrt-installer (0.0.18) unstable; urgency=low + + * Fixed N_SE-871 + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.18 + + -- Jihoon Chung Mon, 23 Apr 2012 17:35:20 +0900 + +wrt-installer (0.0.17-1) unstable; urgency=low + + * Apply changed EFL APIs + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.17-1 + + -- Yunchan Cho Wed, 14 Mar 2012 10:14:34 +0900 + +wrt-installer (0.0.17) unstable; urgency=low + + * Support OBS, SMACK + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.17 + + -- Yunchan Cho Tue, 13 Mar 2012 20:02:25 +0900 + +wrt-installer (0.0.16) unstable; urgency=low + + * Package adjusted to wrt-security + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.16 + + -- Grzegorz Krawczyk Thu, 08 Feb 2012 11:53:20 +0100 + +wrt-installer (0.0.15) unstable; urgency=low + + * Implemented WebInstaller + * Support for plugins without libraries (geolocation case) + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.15 + + -- Grzegorz Krawczyk Mon, 05 Feb 2012 15:53:10 +0100 + +wrt-installer (0.0.14) unstable; urgency=low + + * Adjusted to new wrt-commons + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.14 + + -- Grzegorz Krawczyk Tue, 28 Feb 2012 17:43:10 +0100 + +wrt-installer (0.0.13) unstable; urgency=low + + * Adjusted to new wrt-security + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.13 + + -- Grzegorz Krawczyk Fri, 24 Feb 2012 18:20:20 +0100 + +wrt-installer (0.0.12) unstable; urgency=low + + * Debianize 0.0.12 + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.12 + + -- Hoseon LEE Fri, 24 Feb 2012 09:40:54 +0100 + +wrt-installer (0.0.11) unstable; urgency=low + + * WAC compliance test WL-3240 fix. + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.11 + + -- Zbigniew Kostrzewa Wed, 22 Feb 2012 09:40:54 +0100 + wrt-installer (0.0.10) unstable; urgency=low - * Boilerplate update + * Fixed static dev cap setting. - * Git : tizen2/pkgs/w/wrt-installer + * Git : slp/pkgs/w/wrt-installer * Tag : wrt-installer_0.0.10 - -- Tae-Jeong Lee Thu, 23 Feb 2012 16:14:18 +0900 + -- Zbigniew Kostrzewa Wed, 22 Feb 2012 08:18:15 +0100 wrt-installer (0.0.9) unstable; urgency=low - * debianize + * WAC policy test suite bugfix - * Git : tizen2/pkgs/w/wrt-installer + * Git : slp/pkgs/w/wrt-installer * Tag : wrt-installer_0.0.9 - -- Yunchan Cho Wed, 22 Feb 2012 16:55:58 +0900 + -- Grzegorz Krawczyk Mon, 20 Feb 2012 16:30:20 +0100 wrt-installer (0.0.8) unstable; urgency=low - * Init changelog + * Add prefix for debian + * Remove -j option - * Git : tizen2/pkgs/w/wrt-installer + * Git : slp/pkgs/w/wrt-installer * Tag : wrt-installer_0.0.8 -- Jihoon Chung Wed, 15 Feb 2012 13:40:40 +0900 + +wrt-installer (0.0.7) unstable; urgency=low + + * Fixed progress bar for plugins installation + * Fixed install fail with No ID widget + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.7 + + -- Jihoon Chung Tue, 14 Feb 2012 16:35:31 +0900 + +wrt-installer (0.0.6) unstable; urgency=low + + * code regarding installation from browser + * add X-SLP-PackageID to desktop file + * remove sensitive string + * remove plugin service + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.6 + + -- Yunchan Cho Tue, 14 Feb 2012 09:53:56 +0900 + +wrt-installer (0.0.5) unstable; urgency=low + + * Remove assert code in the callback + * ACE bugfix: handling undetermined attributes + * change owner of private directory. + * Removing unnecessary include + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.5 + + -- Pawel Sikorski Wed, 08 Feb 2012 18:14:02 +0100 + +wrt-installer (0.0.4) unstable; urgency=low + + * Fixed postinst + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.4 + + -- Soyoung Kim Thu, 02 Feb 2012 16:41:15 +0900 + +wrt-installer (0.0.3) unstable; urgency=low + + * Clean up and Add wrt-installer option + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.3 + + -- Soyoung Kim Thu, 02 Feb 2012 16:41:15 +0900 + +wrt-installer (0.0.2) unstable; urgency=low + + * Debianized wrt-installer_0.0.2 + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.2 + + -- Soyoung Kim Wed, 01 Feb 2012 16:49:07 +0900 + +wrt-installer (0.0.1) unstable; urgency=low + + * Debianized wrt-installer_0.0.1 + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.1 + + -- Soyoung Kim Wed, 01 Feb 2012 16:49:07 +0900 + +wrt-installer (0.0.0) unstable; urgency=low + + * create new repository + + * Git : slp/pkgs/w/wrt-installer + * Tag : wrt-installer_0.0.0 + + -- Soyoung Kim Mon, 23 Jan 2012 13:54:11 +0900 diff --git a/debian/control b/debian/control index a606c26..4ce346b 100644 --- a/debian/control +++ b/debian/control @@ -3,13 +3,13 @@ Section: devel Priority: extra Maintainer: Krzysztof Jackiewicz, Bartlomiej Grzelewski, jihoon Chung , yunchan Cho Uploaders: Lukasz Wrzosek , Grzegorz Krawczyk , Soyoung Kim ,Pawel Sikorski , Zbigniew Kostrzewa -Build-Depends: debhelper (>= 5), libglib2.0-dev, libsqlite3-dev, libwebkit-engine-dev, libelm-webview-dev, libxml2-dev, libdbus-1-dev, libefreet-dev, libappcore-efl-dev, openssl (>= 0.9.7), libcert-svc-dev, wrt-commons-dev (>= 0.2.15), 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 +Build-Depends: debhelper (>= 5), libglib2.0-dev, libsqlite3-dev, libwebkit-engine-dev, libelm-webview-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, wrt-security-dev(>= 0.0.13) Standards-Version: 0.0.1 Package: wrt-installer Architecture: any Section: libs -Depends: ${shlibs:Depends}, ${misc:Depends}, openssl, libug-picker-efl +Depends: ${shlibs:Depends}, ${misc:Depends}, openssl, libug-picker-efl, wrt-commons (>=0.2.21), wrt-security(>= 0.0.13) Replaces: wrt-installer Provides: wrt-installer Conflicts: wrt-installer @@ -21,5 +21,5 @@ Replaces: wrt-installer-dbg Provides: wrt-installer-dbg Conflicts: wrt-installer-dbg Section: debug -Depends: ${shlibs:Depends}, ${misc:Depends}, wrt (= ${Source-Version}) +Depends: ${shlibs:Depends}, ${misc:Depends} Description: online widget(W3C, BONDI, JIL, MSC) platform - debug diff --git a/debian/rules b/debian/rules index af33220..075ebbe 100755 --- a/debian/rules +++ b/debian/rules @@ -6,54 +6,27 @@ # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - - -# These are used for cross-compiling and for saving the configure script -# from having to guess our platform (since we know it already) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -PACKAGE_VERSION ?= $(shell sed -n "1 p" debian/changelog | sed 's/.*(\(.*\)).*/\1/') +PACKAGE_VERSION ?= $(shell dpkg-parsechangelog | sed -n 's/^Version: // p') PREFIX ?= /usr DATADIR ?= /opt LDFLAGS = -Wl,--rpath=$(PREFIX)/lib -# Please set CFLAGS only in CMakeLists.txt, as they are dependent on CMake build type. - +CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp -ifeq (,$(findstring no,$(DPL_LOG))) +ifeq (,$(findstring no,$(DPL_LOGS))) DPL_LOGS_STATUS = "ON" else DPL_LOGS_STATUS = "OFF" endif -ifeq (1,$(WRT_SKIP_ACE_SUPPORT)) - WRT_SKIP_ACE = "ON" -else - WRT_SKIP_ACE = "OFF" -endif - -ifeq (1,$(WRT_SMACK_ENABLE)) - SMACK_STATUS = "ON" -else - SMACK_STATUS = "OFF" -endif - -#for building with: -#efl library, use TARGET=X1 -export TARGET=X1 - -CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp - -#config.status: configure config.status: dh_testdir # Add here commands to configure the package. mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \ - cmake ${SRCDIR} -DBUILD_TYPE="${TARGET}" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE="$(BUILD_TYPE)" -DDPL_LOG=$(DPL_LOGS_STATUS) -DSMACK_ENABLED=${SMACK_STATUS} -DCMAKE_PACKAGE_VERSION="$(PACKAGE_VERSION)" -DWRT_SKIP_ACE_SUPPORT="${WRT_SKIP_ACE}" .. - - + cmake ${SRCDIR} \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ + -DDPL_LOG=$(DPL_LOGS_STATUS) \ + -DCMAKE_PACKAGE_VERSION=${PACKAGE_VERSION} .. build: build-stamp build-stamp: config.status @@ -61,7 +34,6 @@ build-stamp: config.status # Add here commands to compile the package. cd $(CMAKE_BUILD_DIR) && $(MAKE) -j 4 #docbook-to-man debian/ncurses.sgml > ncurses.1 - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ cat $$f > $${f%.in}; \ sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ diff --git a/packaging/wrt-installer.spec b/packaging/wrt-installer.spec new file mode 100644 index 0000000..78e5130 --- /dev/null +++ b/packaging/wrt-installer.spec @@ -0,0 +1,69 @@ +#sbs-git:public/pkgs/w/wrt-installer wrt-installer 0.0.19 +Name: wrt-installer +Summary: Installer for tizen Webruntime +Version: 0.0.19 +Release: 1 +Group: Development/Libraries +License: Apache License, Version 2.0 +URL: N/A +Source0: %{name}-%{version}.tar.gz +BuildRequires: cmake +BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(openssl) +BuildRequires: pkgconfig(dpl-efl) +BuildRequires: pkgconfig(vcore) +BuildRequires: pkgconfig(dpl-event-efl) +BuildRequires: pkgconfig(dpl-utils-efl) +BuildRequires: pkgconfig(dpl-popup-efl) +BuildRequires: pkgconfig(dpl-wrt-dao-ro) +BuildRequires: pkgconfig(dpl-wrt-dao-rw) +BuildRequires: pkgconfig(ecore-x) +BuildRequires: pkgconfig(ace) +BuildRequires: pkgconfig(ace-dao-ro) +BuildRequires: pkgconfig(ace-dao-rw) +BuildRequires: pkgconfig(elm-webview) +BuildRequires: pkgconfig(xmlsec1) +BuildRequires: pkgconfig(libidn) +BuildRequires: pkgconfig(libiri) +BuildRequires: pkgconfig(libpcrecpp) +BuildRequires: pkgconfig(pkgmgr-installer) +BuildRequires: pkgconfig(pkgmgr-types) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(cert-svc) +BuildRequires: pkgconfig(utilX) + +%description +Description: Wrt Installer for Tizen apps and Wac apps + +%prep +%setup -q + +%build +export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib" + +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DDPL_LOG="ON" \ + -DCMAKE_PACKAGE_VERSION=%{version} +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%clean +rm -rf %{buildroot} + +%post +chmod +s /usr/bin/wrt-installer + +#symlink for package manager +ln -sf /usr/bin/wrt-installer /usr/etc/package-manager/backend/wgt + +%files +/opt/apps/config_gen/*.xml +%attr(755,root,root) %{_bindir}/wrt-installer +%attr(755,root,root) %{_bindir}/wrt-tests-config-gen +%{_libdir}/*.so +%{_libdir}/*.so.* +%{_includedir}/config_generator/config_generator.h +/usr/etc/package-manager/backendlib/libwgt.so diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3a3281f..7b5c113 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,6 +28,10 @@ SET(INSTALLER_CONFIG_PARSER ${INSTALLER_SRC_DIR}/configuration_parser ) +SET(INSTALLER_CONFIG_GENERATOR + ${INSTALLER_SRC_DIR}/config_generator + ) + SET(INSTALLER_JOBS ${INSTALLER_SRC_DIR}/jobs ) @@ -62,7 +66,6 @@ SET(INSTALLER_SOURCES ${INSTALLER_CONFIG_PARSER}/parser_runner.cpp ${INSTALLER_CONFIG_PARSER}/ignoring_parser.cpp ${INSTALLER_CONFIG_PARSER}/deny_all_parser.cpp - ${INSTALLER_CONFIG_PARSER}/powder_parser.cpp ${INSTALLER_CONFIG_PARSER}/libiriwrapper.cpp ${INSTALLER_CONFIG_PARSER}/WidgetConfigurationManager.cpp ${INSTALLER_JOBS}/job.cpp @@ -71,15 +74,16 @@ SET(INSTALLER_SOURCES ${INSTALLER_JOBS}/plugin_install/plugin_objects.cpp ${INSTALLER_JOBS}/plugin_install/plugin_metafile_reader.cpp ${INSTALLER_JOBS}/widget_install/job_widget_install.cpp + ${INSTALLER_JOBS}/widget_install/task_commons.cpp ${INSTALLER_JOBS}/widget_install/task_unzip.cpp ${INSTALLER_JOBS}/widget_install/task_widget_config.cpp ${INSTALLER_JOBS}/widget_install/task_db_update.cpp ${INSTALLER_JOBS}/widget_install/task_smack.cpp ${INSTALLER_JOBS}/widget_install/task_ace_check.cpp ${INSTALLER_JOBS}/widget_install/task_desktop_file.cpp - ${INSTALLER_JOBS}/widget_install/task_parental_mode.cpp ${INSTALLER_JOBS}/widget_install/task_certify.cpp ${INSTALLER_JOBS}/widget_install/task_private_storage.cpp + ${INSTALLER_JOBS}/widget_install/task_prepare_files.cpp ${INSTALLER_JOBS}/widget_install/wac_security.cpp ${INSTALLER_JOBS}/widget_install/widget_update_info.cpp ${INSTALLER_JOBS}/widget_uninstall/job_widget_uninstall.cpp @@ -89,9 +93,9 @@ SET(INSTALLER_SOURCES ${INSTALLER_JOBS}/widget_uninstall/task_smack.cpp ${INSTALLER_SRC_DIR}/logic/installer_logic.cpp ${INSTALLER_SRC_DIR}/logic/installer_controller.cpp - ${INSTALLER_SRC_DIR}/misc/wrt_powder_info_util.cpp ${INSTALLER_SRC_DIR}/misc/wac_widget_id.cpp ${INSTALLER_SRC_DIR}/misc/feature_logic.cpp + ${INSTALLER_CONFIG_GENERATOR}/config_generator.cpp ) MESSAGE(STATUS "add -DSEP_INSTALLER") @@ -102,15 +106,16 @@ PKG_CHECK_MODULES(INSTALLER_STATIC_DEP libxml-2.0 openssl dpl-efl - dpl-vcore + vcore + wrt-security dpl-event-efl dpl-utils-efl dpl-popup-efl dpl-wrt-dao-ro dpl-wrt-dao-rw - dpl-ace - dpl-ace-dao-ro - dpl-ace-dao-rw + ace + ace-dao-ro + ace-dao-rw ecore-x elm-webview xmlsec1 diff --git a/src/config_generator/config_generator.cpp b/src/config_generator/config_generator.cpp index 9efe644..434eea3 100644 --- a/src/config_generator/config_generator.cpp +++ b/src/config_generator/config_generator.cpp @@ -61,8 +61,9 @@ const xmlChar* _TRUE_ = BAD_CAST "true"; const xmlChar* _FALSE_ = BAD_CAST "false"; const xmlChar* _NAME_ = BAD_CAST "name"; const xmlChar* _VALUE_ = BAD_CAST "value"; -const xmlChar* _XMLNS_ = BAD_CAST "xmlns"; -const xmlChar* _NAMESPACE_ = BAD_CAST "http://www.w3.org/ns/widgets"; +const xmlChar* _TIZEN_NS_ = BAD_CAST "http://tizen.org/ns/widgets"; +const xmlChar* _TIZEN_PREFIX_ = BAD_CAST "tizen"; +const xmlChar* _W3C_NS_ = BAD_CAST "http://www.w3.org/ns/widgets"; const xmlChar* _ID_ = BAD_CAST "id"; const xmlChar* _VERSION_ = BAD_CAST "version"; const xmlChar* _HEIGHT_ = BAD_CAST "height"; @@ -146,6 +147,35 @@ void AddNameAndValue(xmlNodePtr node, const char* name, const char* value) AddCharProp(node, _VALUE_, value); } +XmlNodeWrapperPtr CreateRootBase(xmlDocPtr doc, const char* id) +{ + Assert(NULL == xmlDocGetRootElement(doc) && + "The document already has root node"); + + // root + xmlNodePtr root = xmlNewNode(NULL, _WIDGET_); + if (NULL == root) { + Throw(NodeCreationError); + } + + // w3c namespace + xmlNsPtr ns = xmlNewNs(root, _W3C_NS_, NULL); + if (NULL == ns) { + Throw(NodeCreationError); + } + + // tizen namespace + ns = xmlNewNs(root, _TIZEN_NS_, _TIZEN_PREFIX_); + if (NULL == ns) { + Throw(NodeCreationError); + } + + xmlDocSetRootElement(doc, root); + AddCharProp(root, _ID_, id); + XmlNodeWrapperPtr ret(new XmlNodeWrapper(root)); + return ret; +} + } // namespace // ELEMENT /////////////////////////////////////////////////////////////// @@ -295,34 +325,39 @@ template <> XmlNodeWrapperPtr Element::Handler:: CreateNode(const char* name, const char* value) { - xmlNodePtr node = NewNode(m_parent->get(), TIZEN_SETTING); + xmlNodePtr node = NewNode(m_parent->get(),TIZEN_SETTING); AddCharProp(node, name, value); + + xmlNsPtr* list = xmlGetNsList(NULL, m_parent->get()); + if(list && *list) { + xmlSetNs(node, *list); + } + XmlNodeWrapperPtr ret(new XmlNodeWrapper(node)); return ret; } // DOCUMENT ////////////////////////////////////////////////////////////// +// +template <> +XmlNodeWrapperPtr Document::Handler:: + CreateRoot(const char* id, const char* viewmodes) +{ + XmlNodeWrapperPtr ret = CreateRootBase(m_document->get(), id); + AddCharProp(ret->get(), _VIEWMODES_, viewmodes); + return ret; +} + // template <> XmlNodeWrapperPtr Document:: Handler:: CreateRoot(const char* id, const char* version, const char* viewmodes) { - Assert(NULL == xmlDocGetRootElement(m_document->get()) && - "The document already has root node"); - - // root - xmlNodePtr root = xmlNewNode(NULL, _WIDGET_); - if (NULL == root) { - Throw(NodeCreationError); - } - xmlDocSetRootElement(m_document->get(), root); - AddProperty(root, _XMLNS_, _NAMESPACE_ ); - AddCharProp(root, _ID_, id); - AddCharProp(root, _VERSION_, version); - AddCharProp(root, _VIEWMODES_, viewmodes); - XmlNodeWrapperPtr ret(new XmlNodeWrapper(root)); + XmlNodeWrapperPtr ret = CreateRootBase(m_document->get(), id); + AddCharProp(ret->get(), _VIEWMODES_, viewmodes); + AddCharProp(ret->get(), _VERSION_, version); return ret; } @@ -335,22 +370,14 @@ XmlNodeWrapperPtr Document:: Handler:: CreateRoot(const char* id, const char* version, int height, int width) { - // root - xmlNodePtr root = xmlNewNode(NULL, _WIDGET_); - if (NULL == root) { - Throw(NodeCreationError); - } - xmlDocSetRootElement(m_document->get(), root); - AddProperty(root, _XMLNS_, _NAMESPACE_ ); - AddCharProp(root, _ID_, id); - AddCharProp(root, _VERSION_, version); + XmlNodeWrapperPtr ret = CreateRootBase(m_document->get(), id); + AddCharProp(ret->get(), _VERSION_, version); std::ostringstream hstream; hstream << height; - AddProperty(root, _HEIGHT_, BAD_CAST hstream.str().c_str()); + AddProperty(ret->get(), _HEIGHT_, BAD_CAST hstream.str().c_str()); std::ostringstream wstream; wstream << width; - AddProperty(root, _WIDTH_, BAD_CAST wstream.str().c_str()); - XmlNodeWrapperPtr ret(new XmlNodeWrapper(root)); + AddProperty(ret->get(), _WIDTH_, BAD_CAST wstream.str().c_str()); return ret; } diff --git a/src/configuration_parser/WidgetConfigurationManager.cpp b/src/configuration_parser/WidgetConfigurationManager.cpp index 2441731..96c9a56 100644 --- a/src/configuration_parser/WidgetConfigurationManager.cpp +++ b/src/configuration_parser/WidgetConfigurationManager.cpp @@ -184,6 +184,10 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile( } } + if (!!configInfo.minVersionRequired) { + pWidgetConfigInfo.minVersion = configInfo.minVersionRequired; + } + return true; } diff --git a/src/configuration_parser/parser_runner.cpp b/src/configuration_parser/parser_runner.cpp index 79d5f16..53c1f4b 100644 --- a/src/configuration_parser/parser_runner.cpp +++ b/src/configuration_parser/parser_runner.cpp @@ -206,7 +206,6 @@ class ParserRunner::Impl Assert(m_reader); Element element; - element.name = GetNameWithoutNamespace(); element.value = GetValue(); element.lang = GetLanguageTag(); element.ns = GetNamespace(); @@ -228,11 +227,13 @@ class ParserRunner::Impl xmlTextReaderMoveToAttributeNo(m_reader, i); XmlAttribute attribute; - attribute.name = GetName(); + attribute.ns = GetAttributeNamespace(); + attribute.name = GetNameWithoutNamespace(); attribute.value = GetValue(); attribute.lang = GetLanguageTag(); LogDebug("Attribute name: " << attribute.name << ", value: " << attribute.value << + ", namespace: " << attribute.ns << ", lang: " << attribute.lang); parser->Accept(attribute); } @@ -269,6 +270,18 @@ class ParserRunner::Impl return ret_value; } + DPL::String GetAttributeNamespace() const + { + DPL::String ret_value; + const xmlChar* value = xmlTextReaderLookupNamespace(m_reader, NULL); + if (value) { + ret_value = DPL::FromUTF8String(reinterpret_cast(value)); + } + xmlFree(const_cast(value)); + + return ret_value; + } + DPL::String GetName() const { DPL::String ret_value; @@ -294,6 +307,7 @@ class ParserRunner::Impl DPL::String GetNamespace() const { DPL::String ret_value; + const xmlChar* value = xmlTextReaderConstNamespaceUri(m_reader); if (value) { ret_value = DPL::FromUTF8String(reinterpret_cast(value)); diff --git a/src/configuration_parser/powder_parser.cpp b/src/configuration_parser/powder_parser.cpp deleted file mode 100644 index cb9de64..0000000 --- a/src/configuration_parser/powder_parser.cpp +++ /dev/null @@ -1,521 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file powder_parser.cpp - * @author Piotr Marcinkiewicz (p.marcinkiew@samsung.com) - * @version 0.1 - * @brief Parser for WAC defined POWDER - */ - -#include -#include -#include -#include -#include -#include -#include -#include "powder_parser.h" -#include "ignoring_parser.h" -#include "deny_all_parser.h" - -namespace { -void MergeDescriptions(WrtDB::Powder::Description* dest, - const WrtDB::Powder::Description& src) -{ - Assert(dest); -// LogInfo("MergeDescriptions dest: " << *dest << -// " src: " << src); - if (!dest->ageRating) { - dest->ageRating = src.ageRating; - } else { - if (!!src.ageRating) { - if (*dest->ageRating > *src.ageRating) { - dest->ageRating = src.ageRating; - } - } - } - FOREACH(catIter, src.categories) - { - FOREACH(levelIter, catIter->second.levels) - { - dest->categories[catIter->first].levels.push_back(*levelIter); - } - } -// LogInfo("MergeDescriptions result:" << *dest); -} - -//TODO::Check if list of delimiters is valid -const DPL::String constPowderDelimiters = DPL::FromUTF32String(L" ,;\n\r\t"); -} //anonymous namespace - -std::ostream & operator<<(std::ostream& aStream, - const StringSet& aContainer) -{ - if (!aContainer.empty()) { - StringSet::const_iterator iter = aContainer.begin(); - aStream << "{[" << *iter; - ++iter; - for (/*empty*/; iter != aContainer.end(); ++iter) { - aStream << "] [" << *iter; - } - aStream << "]}"; - } - return aStream; -} - -#define DEFINE_ELEMENT_FUNC(element, myClass) \ - m_map[DPL::FromUTF32String(L"" # element)] = \ - DPL::MakeDelegate(this, &myClass::OnElement_ ## element); - -class DenyUnknownTagsParser : public ElementParser -{ - public: - DenyUnknownTagsParser() : ElementParser() - { - } - - void Accept(const XmlAttribute& /*attribute*/) - { - } - - void Accept(const Element& /*element*/) - { - } - - void Accept(const Text& /*text*/) - { - } - - ElementParserPtr OnDenyElement() - { - return ElementParserPtr(new DenyAllParser()); - } - - ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& /*name*/) - { - return DPL::MakeDelegate(this, &DenyUnknownTagsParser::OnDenyElement); - } - - protected: - FuncMap m_map; -}; - -StringSet TokenizeTag(const DPL::String& buffer) -{ - StringSet data; - DPL::Tokenize(buffer, constPowderDelimiters, - std::insert_iterator(data, data.begin()), true); - return data; -} - -class SetOfTextValuesParser : public DenyUnknownTagsParser -{ - public: - explicit SetOfTextValuesParser(std::set* data) : - DenyUnknownTagsParser(), - m_data(data) - { - Assert(m_data); - } - - virtual void Accept(const Text& text) - { - LogDebug("text"); - m_buffer += text.value; - } - void Verify() - { - *m_data = TokenizeTag(m_buffer); - } - - private: - DPL::String m_buffer; - StringSet* m_data; -}; - -// It is data structure used by iriset parser to match IRI's -// and preserve processing result -struct IrisetParserData -{ - const DPL::String* m_host; - const DPL::String* m_path; - bool m_matched; - IrisetParserData(const DPL::String& host, - const DPL::String& path) : - m_host(&host), - m_path(&path), - m_matched(false) - { - } -}; - -class IrisetParser : public DenyUnknownTagsParser -{ - public: - explicit IrisetParser(IrisetParserData* data) : - DenyUnknownTagsParser(), - m_data(data), - m_hostsDetected(0), - m_pathsDetected(0) - { - Assert(m_data); - DEFINE_ELEMENT_FUNC(includehosts, IrisetParser); - DEFINE_ELEMENT_FUNC(includeexactpaths, IrisetParser); - } - - ElementParserPtr OnElement_includehosts() - { - m_hostsDetected++; - return ElementParserPtr(new SetOfTextValuesParser(&m_hosts)); - } - - ElementParserPtr OnElement_includeexactpaths() - { - m_pathsDetected++; - return ElementParserPtr(new SetOfTextValuesParser(&m_paths)); - } - - void Verify() - { - if (m_hostsDetected <= 1 && m_pathsDetected <= 1) { - LogInfo("Matching iriset for host [" << - *m_data->m_host << "] path [" << - *m_data->m_path << "]"); - LogInfo("hosts: " << m_hosts << - " paths: " << m_paths); - m_data->m_matched = - m_hosts.find(*m_data->m_host) != m_hosts.end() && - m_paths.find(*m_data->m_path) != m_paths.end(); - } else { - ThrowMsg(PowderParserException::ParserFailed, - "Invalid iriset contents"); - } - } - - private: - IrisetParserData* m_data; - typedef StringSet Container; - Container m_hosts; - Container m_paths; - size_t m_hostsDetected; - size_t m_pathsDetected; -}; - -class WacCategoryParser : public DenyUnknownTagsParser -{ - public: - WacCategoryParser(WrtDB::Powder::Description::LevelEntry* data) : - DenyUnknownTagsParser(), - m_data(data) - { - Assert(m_data); - } - - virtual void Accept(const Text& text) - { - LogDebug("text"); - m_buffer += text.value; - } - - static StringSet GetAllowedAttributes() - { - StringSet allowed; - allowed.insert(DPL::FromUTF32String(L"xa")); - allowed.insert(DPL::FromUTF32String(L"xb")); - allowed.insert(DPL::FromUTF32String(L"xc")); - allowed.insert(DPL::FromUTF32String(L"xd")); - allowed.insert(DPL::FromUTF32String(L"xe")); - return allowed; - } - - virtual void Accept(const XmlAttribute& attribute) - { - static StringSet allowed = GetAllowedAttributes(); - if (allowed.find(attribute.name) != allowed.end()) { - if (DPL::FromUTF32String(L"1") == attribute.value) { - m_data->context.insert(attribute.name); - } else if (DPL::FromUTF32String(L"0") != attribute.value) { - ThrowMsg(PowderParserException::ParserFailed, - "Invalid attribute for WAC category tag"); - } - } else { - ThrowMsg(PowderParserException::ParserFailed, - "Invalid tag in descriptionset"); - } - } - - virtual void Verify() - { - StringSet values = TokenizeTag(m_buffer); - bool numberFound = false; - - FOREACH(wordIter, values) { - DPL::IStringStream str(*wordIter); - int rating; - str >> rating; - if (str.fail()) { - ThrowMsg(PowderParserException::ParserFailed, - "WAC category level is not number"); - } else { - if (numberFound) { - ThrowMsg(PowderParserException::ParserFailed, - "Too many WAC category levels"); - } else { - if (rating >= MIN_AGE_RATING && rating <= MAX_AGE_RATING) { - m_data->level = - static_cast( - rating); - numberFound = true; - } else { - ThrowMsg(PowderParserException::ParserFailed, - "WAC category level is out of range "); - } - } - } - } - if (!numberFound) { - ThrowMsg(PowderParserException::ParserFailed, - "WAC category level is not present in tag"); - } - } - - private: - WrtDB::Powder::Description::LevelEntry* m_data; - DPL::String m_buffer; - static const int MIN_AGE_RATING = 0; - static const int MAX_AGE_RATING = 5; -}; - -class DescriptorSetParser : public DenyUnknownTagsParser -{ - public: - typedef WrtDB::Powder::Description::CategoryEntries::iterator CatIter; - explicit DescriptorSetParser(WrtDB::Powder::Description* data) : - DenyUnknownTagsParser(), - m_data(data) - { - Assert(m_data); -#define ELEM(tag) DEFINE_ELEMENT_FUNC(tag, DescriptorSetParser) - ELEM(aa); - ELEM(nu); - ELEM(se); - ELEM(vi); - ELEM(la); - ELEM(dr); - ELEM(ga); - ELEM(ha); - ELEM(ug); -#undef ELEM - m_map[DPL::FromUTF32String(L"displayicon")] = - DPL::MakeDelegate(this, &DescriptorSetParser::OnIgnoredElement); - } - - ElementParserPtr OnElement_aa() - { - m_ages.push_back(StringSet()); - return ElementParserPtr(new SetOfTextValuesParser(&m_ages.back())); - } - -#define GENERATE_ELEMENT_FUNC(element) \ - ElementParserPtr OnElement_ ## element() \ - { \ - LogInfo("WAC category tag detected: " << # element); \ - CatIter category = \ - m_data->categories.find(DPL::FromUTF32String(L"" # element)); \ - if (m_data->categories.end() == category) \ - { \ - std::pair result = \ - m_data->categories.insert(std::make_pair( \ - DPL::FromUTF32String(L"" # \ - element), \ - WrtDB::Powder::Description:: \ - CategoryEntry())); \ - category = result.first; \ - } \ - category->second.levels.push_back( \ - WrtDB::Powder::Description::LevelEntry()); \ - return ElementParserPtr(new \ - WacCategoryParser( \ - &category->second.levels.back())); \ - } \ - - GENERATE_ELEMENT_FUNC(nu) - GENERATE_ELEMENT_FUNC(se) - GENERATE_ELEMENT_FUNC(vi) - GENERATE_ELEMENT_FUNC(la) - GENERATE_ELEMENT_FUNC(dr) - GENERATE_ELEMENT_FUNC(ga) - GENERATE_ELEMENT_FUNC(ha) - GENERATE_ELEMENT_FUNC(ug) - -#undef GENERATE_ELEMENT_FUNC - - ElementParserPtr OnIgnoredElement() - { - return ElementParserPtr(new IgnoringParser()); - } - - void Verify() - { - if (m_ages.size() > 1) { - ThrowMsg(PowderParserException::ParserFailed, - "More than one aa tags: not implemented"); - } else if (m_ages.size() == 1) { - if (!m_ages.at(0).empty() && m_ages.at(0).size() <= 1) { - DPL::IStringStream str(*m_ages.at(0).begin()); - int rating = 12; - str >> rating; - if (str.fail()) { - ThrowMsg(PowderParserException::ParserFailed, - "Invalid number in age rating"); - } else { - m_data->ageRating = rating; - } - } else { - ThrowMsg(PowderParserException::ParserFailed, - "Not valid age value in aa tag "); - } - } -// LogInfo("Descriptionset verified: " << *m_data); - } - - private: - typedef std::vector AgesTags; - AgesTags m_ages; - WrtDB::Powder::Description* m_data; -}; - -class DrParser : public DenyUnknownTagsParser -{ - public: - DrParser(WrtDB::Powder::Description* data, - const DPL::String& host, - const DPL::String& path) : - DenyUnknownTagsParser(), - m_data(data), - m_host(host), - m_path(path) - { - Assert(m_data); - DEFINE_ELEMENT_FUNC(iriset, DrParser); - DEFINE_ELEMENT_FUNC(descriptorset, DrParser); - } - - ElementParserPtr OnElement_iriset() - { - m_iriSetOutcomes.push_back(IrisetParserData(m_host, m_path)); - return ElementParserPtr(new IrisetParser(&m_iriSetOutcomes.back())); - } - - ElementParserPtr OnElement_descriptorset() - { - m_descriptions.push_back(WrtDB::Powder::Description()); - return ElementParserPtr(new - DescriptorSetParser(&m_descriptions.back())); - } - - void Verify() - { - if (m_iriSetOutcomes.empty() || m_descriptions.empty()) { - ThrowMsg( - PowderParserException::ParserFailed, - "dr tag don't contain at lease one iriset and descriptionset "); - } else { - IriSetOutcomes::const_iterator outIter; - for (outIter = m_iriSetOutcomes.begin(); - outIter != m_iriSetOutcomes.end() && !outIter->m_matched; - ++outIter) { - } - if (outIter != m_iriSetOutcomes.end()) { - LogInfo("Matching iriset found"); - typedef PowderDescriptions::const_iterator DescIter; - for (DescIter descIter = m_descriptions.begin(); - descIter != m_descriptions.end(); ++descIter) { - MergeDescriptions(m_data, *descIter); - } - } else { - LogWarning("No matching iriset found"); - } - } -// LogInfo("dr tag verified" << *m_data); - } - private: - typedef std::vector PowderDescriptions; - PowderDescriptions m_descriptions; - typedef std::vector IriSetOutcomes; - IriSetOutcomes m_iriSetOutcomes; - WrtDB::Powder::Description* m_data; - const DPL::String& m_host; - const DPL::String& m_path; -}; - -PowderParser::PowderParser(PowderParserData* data) : - ElementParser(), - m_data(data->description), - m_host(data->host), - m_path(data->path) -{ - Assert(m_data); - m_map[DPL::FromUTF32String(L"attribution")] = - DPL::MakeDelegate(this, &PowderParser::OnIgnoredElement); - DEFINE_ELEMENT_FUNC(dr, PowderParser); -} - -ElementParserPtr PowderParser::OnIgnoredElement() -{ - return ElementParserPtr(new IgnoringParser()); -} - -ElementParserPtr PowderParser::OnElement_dr() -{ - return ElementParserPtr(new DrParser(m_data, m_host, m_path)); -} - -void PowderParser::Accept(const Element& /*element*/) -{ -} - -void PowderParser::Accept(const XmlAttribute& /*attribute*/) -{ -} - -void PowderParser::Accept(const Text& /*text*/) -{ -} - -void PowderParser::Verify() -{ -// LogInfo("powder tag verified " << *m_data); -} - -ElementParserPtr PowderParser::OnDenyElement() -{ - return ElementParserPtr(new DenyAllParser()); -} - -ElementParser::ActionFunc PowderParser::GetElementParser(const DPL::String& /*ns*/, - const DPL::String& name) -{ - FuncMap::const_iterator it = m_map.find(name); - if (it != m_map.end()) { - return it->second; - } else { - return DPL::MakeDelegate(this, &PowderParser::OnDenyElement); - } -} - -#undef DEFINE_ELEMENT_FUNC diff --git a/src/configuration_parser/powder_parser.h b/src/configuration_parser/powder_parser.h deleted file mode 100644 index b56ee5b..0000000 --- a/src/configuration_parser/powder_parser.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file powder_parser.h - * @author Piotr Marcinkiewicz (p.marcinkiew@samsung.com) - * @version 0.1 - * @brief Parser for WAC defined POWDER - */ - -#ifndef _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_POWDER_PARSER_H_ -#define _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_POWDER_PARSER_H_ - -#include -#include "element_parser.h" -#include - -//TODO: Move to separate header -namespace PowderParserException { -DECLARE_EXCEPTION_TYPE(DPL::Exception, Base) -DECLARE_EXCEPTION_TYPE(Base, ParserFailed) -} - -struct PowderParserData -{ - WrtDB::Powder::Description* description; - const DPL::String& host; - const DPL::String& path; - PowderParserData(WrtDB::Powder::Description* a_description, - const DPL::String& a_host, - const DPL::String& a_path) : - description(a_description), - host(a_host), - path(a_path) - { - } -}; -//TODO: Move to other header -typedef std::set StringSet; - -class PowderParser : public ElementParser -{ - public: - //Typedef used by RootParser - typedef PowderParserData* Data; - - explicit PowderParser(PowderParserData* data); - - ElementParserPtr OnNameElement(); - - //TODO: Remove not implemented methods - virtual ActionFunc GetElementParser(const DPL::String& ns, - const DPL::String& name); - virtual void Accept(const Element& /*element*/); - virtual void Accept(const XmlAttribute& attribute); - virtual void Accept(const Text& text); - virtual void Verify(); - - ElementParserPtr OnIgnoredElement(); - ElementParserPtr OnElement_dr(); - ElementParserPtr OnDenyElement(); - - private: - WrtDB::Powder::Description* m_data; - const DPL::String& m_host; - const DPL::String& m_path; - FuncMap m_map; -}; -#endif // _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_POWDER_PARSER_H_ diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp index e46b2a7..984c360 100644 --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -244,7 +244,10 @@ class AccessParser : public ElementParser virtual void Accept(const Element& element) { - if (element.ns == ConfigurationNamespace::W3CWidgetNamespaceName) { + // for tizen web apps WARP should be used + if (element.ns == ConfigurationNamespace::W3CWidgetNamespaceName || + element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) + { m_standardType = STANDARD_TYPE_WARP; } if (element.ns == ConfigurationNamespace::JilWidgetNamespaceName) { @@ -1123,154 +1126,6 @@ class LinkParser : public ElementParser DPL::OptionalString m_href; }; -class MinVersionParser : public ElementParser -{ - public: - virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& /*name*/) - { - return &DenyAllParser::Create; - } - - virtual void Accept(const XmlAttribute& attribute) - { - if (m_properNamespace) { - ThrowMsg(Exception::ParseError, - "attirubte: '" + DPL::ToUTF8String(attribute.name) + - "' in min-version element not allowed"); - } - } - - virtual void Accept(const Element& element) - { - if (element.ns == ConfigurationNamespace::WacWidgetNamespaceName) { - m_properNamespace = true; - } - - LogDebug("element min-version"); - } - - virtual void Accept(const Text& text) - { - if (m_properNamespace) { - m_minVersion = text.value; - LogDebug("min-version value: " << m_minVersion); - } - } - - virtual void Verify() - { - if (m_properNamespace) { - if (m_minVersion.IsNull()) { - ThrowMsg(Exception::ParseError, - "min-version element must have value"); - } - - DPL::OptionalFloat version = ParseMinVersion(*m_minVersion); - if (version.IsNull()) { - ThrowMsg(Exception::ParseError, - "min-version element must have value" - " that can be parsed to float"); - } - - if (m_data.minVersionRequiredFound.IsNull()) { - m_data.minVersionRequiredFound = 1; - m_data.minVersionRequired = version; - LogDebug("MinVersionRequired = " << version); - } else { - ThrowMsg(Exception::ParseError, - "multiple min-version elements not allowed"); - } - } - } - - MinVersionParser(ConfigParserData& data) : - ElementParser(), - m_properNamespace(false), - m_data(data), - m_minVersion() - { - LogDebug("MinVersionParser created"); - } - - private: - bool m_properNamespace; - ConfigParserData& m_data; - DPL::OptionalString m_minVersion; - - static DPL::OptionalFloat ParseMinVersion(const DPL::String& value) - { - DPL::OptionalString normalizedValue = value; - NormalizeString(normalizedValue); - if (!(*normalizedValue).empty()) { - char* reterr = NULL; - errno = 0; - float valueFloat = - strtof(DPL::ToUTF8String(value).c_str(), &reterr); - if (errno != 0 || - std::string(reterr) == DPL::ToUTF8String(value) || - valueFloat <= 0.0) { - return DPL::OptionalFloat::Null; - } else { - return valueFloat; - } - } - return DPL::OptionalFloat::Null; - } -}; - -// tag: -class BackParser : public ElementParser -{ - public: - virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& /*name*/) - { - return &IgnoringParser::Create; - } - - virtual void Accept(const XmlAttribute& attribute) - { - LogDebug("attribute"); - if (attribute.name == L"supported") { - if (attribute.value == L"true") { - m_backSupported = true; - } else { - m_backSupported = false; - } - } - } - - virtual void Accept(const Element&) - { - LogDebug("element"); - //if empty back element will be passed, we say true - m_data.backSupported = true; - } - - virtual void Accept(const Text&) - { - LogDebug("text"); - ThrowMsg(Exception::ParseError, "back element must be empty"); - } - - virtual void Verify() - { - m_data.backSupported = m_backSupported; - } - - BackParser(ConfigParserData& data) : - ElementParser(), - m_backSupported(false), - m_data(data) - { - } - - private: - bool m_backSupported; - ConfigParserData& m_data; -}; - class SettingParser : public ElementParser { public: @@ -1446,9 +1301,6 @@ WidgetParser::WidgetParser(ConfigParserData& data) : DPL::MakeDelegate(this, &WidgetParser::OnPreferenceElement); m_map[L"flash"] = DPL::MakeDelegate(this, &WidgetParser::OnFlashElement); m_map[L"link"] = DPL::MakeDelegate(this, &WidgetParser::OnLinkElement); - m_map[L"min-version"] = - DPL::MakeDelegate(this, &WidgetParser::OnMinVersionElement); - m_map[L"back"] = DPL::MakeDelegate(this, &WidgetParser::OnBackElement); m_map[L"pkgname"] = DPL::MakeDelegate(this, &WidgetParser::OnPkgnameElement); m_map[L"setting"] = DPL::MakeDelegate(this, &WidgetParser::OnSettingElement); @@ -1510,16 +1362,6 @@ ElementParserPtr WidgetParser::OnLinkElement() return ElementParserPtr(new LinkParser(m_data)); } -ElementParserPtr WidgetParser::OnMinVersionElement() -{ - return ElementParserPtr(new MinVersionParser(m_data)); -} - -ElementParserPtr WidgetParser::OnBackElement() -{ - return ElementParserPtr(new BackParser(m_data)); -} - ElementParserPtr WidgetParser::OnPkgnameElement() { return ElementParserPtr(new PkgnameParser(m_data)); @@ -1537,7 +1379,9 @@ ElementParserPtr WidgetParser::OnServiceElement() void WidgetParser::Accept(const Element& element) { - if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName) { + if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName && + element.ns != ConfigurationNamespace::TizenWebAppNamespaceName) + { ThrowMsg(Exception::ParseError, "Wrong xml namespace for widget element"); } @@ -1561,6 +1405,11 @@ void WidgetParser::Accept(const XmlAttribute& attribute) } else if (attribute.name == L"version") { m_version = attribute.value; NormalizeString(m_version); + } else if (attribute.name == L"min-version") { + LogInfo("min-version attribute was found. Value: " << attribute.value); + m_minVersion = attribute.value; + NormalizeString(m_minVersion); + m_data.minVersionRequired = m_minVersion; } else if (attribute.name == L"height") { DPL::OptionalString value = attribute.value; NormalizeString(value); @@ -1626,18 +1475,17 @@ void WidgetParser::Accept(const XmlAttribute& attribute) } else { LogWarning("Ignoring subsequent default locale"); } - } else if (DPL::StringCompare(L"xmlns", attribute.name) < 0) { - LogWarning("namespace domain" << attribute.name); - LogWarning("namespace value " << attribute.value); - DPL::OptionalString ns = attribute.value; - - if (attribute.name == L"xmlns:wac") { - m_nameSpaces.push_back(attribute.value); - } else if (attribute.name == L"xmlns:tizen") { - m_nameSpaces.push_back(attribute.value); - } else if (attribute.name == L"xmlns:jil") { - m_nameSpaces.push_back(attribute.value); - } + + //Any other value consider as a namespace definition + } else if (attribute.name == L"xmlns" || + attribute.ns == m_nameSpaces[L"xmlns"]) { + LogInfo("Namespace domain: " << attribute.name); + LogInfo("Namespace value: " << attribute.value); + m_nameSpaces[attribute.name] = attribute.value; + } else { + LogError("Unknown attirbute: namespace=" << attribute.ns << + ", name=" << attribute.name << + ", value=" << attribute.value); } } @@ -1656,7 +1504,7 @@ void WidgetParser::Verify() } m_data.defaultlocale = m_defaultlocale; FOREACH(ns, m_nameSpaces) { - m_data.nameSpaces.insert(*ns); + m_data.nameSpaces.insert(ns->second); } } diff --git a/src/configuration_parser/widget_parser.h b/src/configuration_parser/widget_parser.h index d008a59..07d37c9 100644 --- a/src/configuration_parser/widget_parser.h +++ b/src/configuration_parser/widget_parser.h @@ -29,6 +29,7 @@ #include "element_parser.h" #include +#include #include #include @@ -76,8 +77,6 @@ class WidgetParser : public ElementParser ElementParserPtr OnAccessElement(); ElementParserPtr OnFlashElement(); ElementParserPtr OnLinkElement(); - ElementParserPtr OnMinVersionElement(); - ElementParserPtr OnBackElement(); ElementParserPtr OnPkgnameElement(); ElementParserPtr OnSettingElement(); ElementParserPtr OnServiceElement(); @@ -100,9 +99,10 @@ class WidgetParser : public ElementParser Unicode::Direction m_textDirection; FuncMap m_map; DPL::Optional m_version; + DPL::Optional m_minVersion; std::list m_windowModes; DPL::Optional m_defaultlocale; - std::list m_nameSpaces; + std::map m_nameSpaces; }; struct IconParser; diff --git a/src/jobs/plugin_install/plugin_install_task.cpp b/src/jobs/plugin_install/plugin_install_task.cpp index 218e10b..0d7f147 100644 --- a/src/jobs/plugin_install/plugin_install_task.cpp +++ b/src/jobs/plugin_install/plugin_install_task.cpp @@ -28,6 +28,7 @@ //WRT INCLUDES #include +#include #include #include "plugin_install_task.h" #include "job_plugin_install.h" @@ -50,6 +51,13 @@ const std::string DIRECTORY_SEPARATOR = std::string("/"); m_context->installerTask->UpdateProgress( \ PluginInstallerContext::step, desc); +#define DISABLE_IF_PLUGIN_WITHOUT_LIB() \ + if(m_pluginMetafile.m_libraryName.empty()) \ + { \ + LogWarning("Plugin without library."); \ + return; \ + } + namespace Jobs { namespace PluginInstall { PluginInstallTask::PluginInstallTask(PluginInstallerContext *inCont) : @@ -106,6 +114,14 @@ void PluginInstallTask::stepParseConfigFile() reader.initialize(filename); reader.read(m_pluginMetafile); + FOREACH(it, m_pluginMetafile.m_featureContainer) + { + LogDebug("Parsed feature : " << it->m_name); + FOREACH (devCap, it->m_deviceCapabilities) { + LogDebug(" | DevCap : " << *devCap); + } + } + SET_PLUGIN_INSTALL_PROGRESS(PLUGIN_PATH, "Config file analyzed"); } Catch(ValidationCore::ParserSchemaException::Base) @@ -130,6 +146,8 @@ void PluginInstallTask::stepLoadPluginLibrary() { LogInfo("Plugin installation: step load library"); + DISABLE_IF_PLUGIN_WITHOUT_LIB() + std::string filename = m_context->pluginFilePath + DIRECTORY_SEPARATOR + m_pluginMetafile.m_libraryName; @@ -224,6 +242,8 @@ void PluginInstallTask::stepRegisterPluginObjects() { LogInfo("Plugin installation: step register objects"); + DISABLE_IF_PLUGIN_WITHOUT_LIB() + //register implemented objects PluginObjects::ObjectsPtr objects = m_libraryObjects->getImplementedObject(); @@ -253,6 +273,18 @@ void PluginInstallTask::stepResolvePluginDependencies() { LogInfo("Plugin installation: step resolve dependencies "); + //DISABLE_IF_PLUGIN_WITHOUT_LIB + if(m_pluginMetafile.m_libraryName.empty()) + { + PluginDAO::setPluginInstallationStatus(m_pluginHandle, + PluginDAO::INSTALLATION_COMPLETED); + //Installation completed + m_context->pluginHandle = m_pluginHandle; + m_context->installationCompleted = true; + LogWarning("Plugin without library."); + return; + } + PluginHandleSetPtr handles = PluginHandleSetPtr(new PluginHandleSet); DbPluginHandle handle = INVALID_PLUGIN_HANDLE; diff --git a/src/jobs/plugin_install/plugin_metafile_reader.cpp b/src/jobs/plugin_install/plugin_metafile_reader.cpp index f8b91e5..7dd434a 100644 --- a/src/jobs/plugin_install/plugin_metafile_reader.cpp +++ b/src/jobs/plugin_install/plugin_metafile_reader.cpp @@ -113,6 +113,7 @@ void PluginMetafileReader::tokenEndFeatureRootFingerprint( void PluginMetafileReader::tokenEndApiFeature(PluginMetafileData &data) { data.m_featureContainer.insert(m_feature); + m_feature.m_deviceCapabilities.clear(); } void PluginMetafileReader::tokenEndName(PluginMetafileData & /* data */) diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp index 114878d..b4214c1 100644 --- a/src/jobs/widget_install/job_widget_install.cpp +++ b/src/jobs/widget_install/job_widget_install.cpp @@ -33,7 +33,6 @@ #include "widget_parser.h" #include "parser_runner.h" #include -#include #include #include #include @@ -42,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +50,7 @@ #include // TODO remove #include #include +#include using namespace WrtDB; @@ -57,34 +58,6 @@ namespace // anonymous { const char * const CONFIG_XML = "config.xml"; -struct PathAndFilePair -{ - std::string path; - std::string file; - - PathAndFilePair(const std::string &p, - const std::string &f) : - path(p), - file(f) - { - } -}; - -PathAndFilePair SplitFileAndPath(const std::string &filePath) -{ - std::string::size_type position = filePath.rfind('/'); - - // Is this only a file without a path ? - if (position == std::string::npos) { - return PathAndFilePair(std::string(), filePath); - } - - // This is full file-path pair - return PathAndFilePair(filePath.substr(0, - position), - filePath.substr(position + 1)); -} - class InstallerTaskFail : public DPL::TaskDecl { @@ -121,13 +94,12 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath, m_exceptionCaught(Exceptions::Success) { // Configure installation - ConfigureResult result = ConfigureInstallation(widgetPath); + ConfigureResult result = ConfigureInstallation(widgetPath, false); if (result == ConfigureResult::Ok) { LogInfo("Configure installation succeeded"); // Create installation tasks - AddTask(new TaskParentalMode(m_installerContext)); AddTask(new TaskUnzip(m_installerContext)); AddTask(new TaskWidgetConfig(m_installerContext)); AddTask(new TaskCertify(m_installerContext)); @@ -157,26 +129,72 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath, } } -DPL::Optional JobWidgetInstall::getNewWidgetHandle() const +JobWidgetInstall::JobWidgetInstall( + std::string const & widgetUrl, + std::string const & iconPath, + const WidgetInstallationStruct &installerStruct) : + Job(Installation), + JobContextBase(installerStruct), + m_exceptionCaught(Exceptions::Success) { - return m_installerContext.widgetHandle; -} + // Configure installation + ConfigureResult result = ConfigureInstallation(widgetUrl, true); -bool JobWidgetInstall::getUnzipStartedFlag() const -{ - return m_installerContext.unzipStarted; + if (result == ConfigureResult::Ok) { + LogInfo("Configure installation succeeded"); + + // Check web app url + LibIri::Wrapper iri(widgetUrl.c_str()); + if (!iri.Validate()) { + ThrowMsg(Exceptions::InvalidWidgetUrl, + "Web app url must be a valid iri/uri/url"); + } + + m_installerContext.widgetConfig.configInfo.startFile = + DPL::FromUTF8String(widgetUrl); + + m_installerContext.iconPath = iconPath; + + // Create installation tasks + AddTask(new TaskPrepareFiles(m_installerContext)); + AddTask(new TaskWidgetConfig(m_installerContext)); + AddTask(new TaskCertify(m_installerContext)); + AddTask(new TaskDbUpdate(m_installerContext)); + // TODO: Update progress information for this task + + AddTask(new TaskAceCheck(m_installerContext)); + //This is sort of quick solution, because ACE verdicts are based upon + //data from DAO (DB). So AceCheck for now has to be AFTER DbUpdate + //task. + AddTask(new TaskSmack(m_installerContext)); + + AddTask(new TaskDesktopFile(m_installerContext)); + AddTask(new TaskPrivateStorage(m_installerContext)); + } else if (result == ConfigureResult::Deferred) { + // Installation is deferred + LogInfo("Configure installation deferred"); + + AddTask(new InstallerTaskFail(true)); + } else if (result == ConfigureResult::Failed) { + // Installation is not allowed to proceed due to widget update policy + LogWarning("Configure installation failed!"); + + AddTask(new InstallerTaskFail(false)); + } else { + Assert(false && "Invalid configure result!"); + } } -bool JobWidgetInstall::getUnzipFinishedFlag() const +DPL::Optional JobWidgetInstall::getNewWidgetHandle() const { - return m_installerContext.unzipFinished; + return m_installerContext.widgetHandle; } JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation( - const std::string &widgetPath) + const std::string &widgetSource, bool fromBrowser) { // Detect widget update - WidgetUpdateInfo update = detectWidgetUpdate(widgetPath); + WidgetUpdateInfo update = detectWidgetUpdate(widgetSource, fromBrowser); LogInfo( "Widget install/update: incoming guid = '" << @@ -210,16 +228,16 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation( if (m_jobStruct.updateMode == WidgetUpdateMode::PolicyWac) { LogInfo( "Widget is already running. Policy is update according to WAC"); - LogInfo("Installation deferred: " << widgetPath); + LogInfo("Installation deferred: " << widgetSource); GlobalDAO::AddDefferedWidgetPackageInstallation( - DPL::FromUTF8String(widgetPath)); + DPL::FromUTF8String(widgetSource)); return ConfigureResult::Deferred; } else { LogInfo( "Widget is already running. Policy is not update according to WAC"); - LogInfo("Installation aborted: " << widgetPath); + LogInfo("Installation aborted: " << widgetSource); return ConfigureResult::Failed; } @@ -239,11 +257,9 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation( LogInfo("Whether widget policy allow proceed: " << canProceed); // Init installer context - m_installerContext.widgetFilePath = widgetPath; + m_installerContext.widgetSource = widgetSource; m_installerContext.tempWidgetPath = std::string(); m_installerContext.widgetConfig = WidgetRegisterInfo(); - m_installerContext.unzipStarted = false; - m_installerContext.unzipFinished = false; m_installerContext.installStep = InstallerContext::INSTALL_START; m_installerContext.job = this; m_installerContext.existingWidgetInfo = update.existingWidgetInfo; @@ -287,53 +303,59 @@ WidgetUpdateMode::Type JobWidgetInstall::CalcWidgetUpdatePolicy( } WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate( - const std::string &widgetPath) + const std::string &widgetSource, bool fromBrowser) { LogInfo("Checking up widget package for config.xml..."); Try { - // Open zip file - DPL::ScopedPtr zipFile( - new DPL::ZipInput(widgetPath)); - - // Open config.xml file - DPL::ScopedPtr configFile( - zipFile->OpenFile(CONFIG_XML)); - - // Extract config - DPL::BinaryQueue buffer; - DPL::AbstractWaitableInputAdapter inputAdapter(configFile.Get()); - DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer); - DPL::Copy(&inputAdapter, &outputAdapter); - - // Parse config - ParserRunner parser; - ConfigParserData configInfo; - - parser.Parse(&buffer, - ElementParserPtr( - new RootParser(configInfo, - DPL::FromUTF32String( - L"widget")))); - - // Check widget id - DPL::OptionalString widgetGUID = configInfo.widget_id; - - if (widgetGUID.IsNull()) { - LogDebug("Installed widget has no GUID"); - return WidgetUpdateInfo(); + DPL::OptionalString widgetGUID; + OptionalWidgetVersion widgetVersion; + if (fromBrowser) { + widgetGUID = DPL::FromUTF8String(widgetSource); } + else { + // Open zip file + DPL::ScopedPtr zipFile( + new DPL::ZipInput(widgetSource)); + + // Open config.xml file + DPL::ScopedPtr configFile( + zipFile->OpenFile(CONFIG_XML)); + + // Extract config + DPL::BinaryQueue buffer; + DPL::AbstractWaitableInputAdapter inputAdapter(configFile.Get()); + DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer); + DPL::Copy(&inputAdapter, &outputAdapter); + + // Parse config + ParserRunner parser; + ConfigParserData configInfo; + + parser.Parse(&buffer, + ElementParserPtr( + new RootParser(configInfo, + DPL::FromUTF32String( + L"widget")))); + + // Check widget id + widgetGUID = configInfo.widget_id; + + if (widgetGUID.IsNull()) { + LogDebug("Installed widget has no GUID"); + return WidgetUpdateInfo(); + } - LogDebug("Installed widget GUID: " << *widgetGUID); + LogDebug("Installed widget GUID: " << *widgetGUID); - // Locate widget ID with this GUID - // Incoming widget version - OptionalWidgetVersion widgetVersion; - if (!configInfo.version.IsNull()) { - widgetVersion = - DPL::Optional( - WidgetVersion(*configInfo.version)); + // Locate widget ID with this GUID + // Incoming widget version + if (!configInfo.version.IsNull()) { + widgetVersion = + DPL::Optional( + WidgetVersion(*configInfo.version)); + } } try @@ -346,7 +368,7 @@ WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate( WidgetUpdateInfo::ExistingWidgetInfo( dao.getHandle(), dao.getVersion())); } - Catch(WidgetDAO::Exception::WidgetNotExist){ + Catch(WidgetDAOReadOnly::Exception::WidgetNotExist){ // GUID isn't installed return WidgetUpdateInfo( widgetGUID, @@ -424,7 +446,7 @@ void JobWidgetInstall::displayWidgetInfo() DPL::Optional handle = getNewWidgetHandle(); Assert(!!handle); - WidgetDAO dao(*handle); + WidgetDAOReadOnly dao(*handle); std::ostringstream out; WidgetLocalizedInfo localizedInfo = @@ -481,12 +503,10 @@ void JobWidgetInstall::displayWidgetInfo() } } - out << std::endl << "Back Supported: " << - (dao.getBackSupported() ? "YES" : "NO"); - out << std::endl; LogInfo(out.str()); } + } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/job_widget_install.h b/src/jobs/widget_install/job_widget_install.h index 8822978..0a4a08b 100644 --- a/src/jobs/widget_install/job_widget_install.h +++ b/src/jobs/widget_install/job_widget_install.h @@ -55,8 +55,10 @@ class JobWidgetInstall : Ok, Failed, Deferred }; - ConfigureResult ConfigureInstallation(const std::string &widgetPath); - WidgetUpdateInfo detectWidgetUpdate(const std::string &widgetPath); + ConfigureResult ConfigureInstallation(const std::string &widgetSource, + bool fromBrowser); + WidgetUpdateInfo detectWidgetUpdate(const std::string &widgetSource, + bool fromBrowser); WidgetUpdateMode::Type CalcWidgetUpdatePolicy( const OptionalWidgetVersion &existingVersion, const OptionalWidgetVersion &incomingVersion) const; @@ -68,10 +70,14 @@ class JobWidgetInstall : */ JobWidgetInstall(std::string const & widgetPath, const WidgetInstallationStruct &installerStruct); + /** + * @brief Automaticaly sets installation process from browser + */ + JobWidgetInstall(std::string const & widgetUrl, + std::string const & iconPath, + const WidgetInstallationStruct &installerStruct); DPL::Optional getNewWidgetHandle() const; - bool getUnzipStartedFlag() const; - bool getUnzipFinishedFlag() const; //overrides void SendProgress(); diff --git a/src/jobs/widget_install/task_ace_check.cpp b/src/jobs/widget_install/task_ace_check.cpp index ed87a98..4d7ca33 100644 --- a/src/jobs/widget_install/task_ace_check.cpp +++ b/src/jobs/widget_install/task_ace_check.cpp @@ -20,19 +20,26 @@ * @brief Implementation file for installer task ace check */ +#include + #include #include +#include +#include +#include #include #include #include #include -#include -#include +#include +#include +#include namespace Jobs { namespace WidgetInstall { + TaskAceCheck::TaskAceCheck(InstallerContext& context) : DPL::TaskDecl(this), m_context(context) @@ -48,6 +55,9 @@ void TaskAceCheck::StepPrepareForAce() Assert(!!m_context.widgetHandle); m_context.featureLogic = FeatureLogicPtr(new FeatureLogic(*m_context.widgetHandle)); + m_context.job->UpdateProgress( + InstallerContext::INSTALL_ACE_PREPARE, + "Widget Access Control Check Prepared"); } void TaskAceCheck::StepAceCheck() @@ -87,6 +97,17 @@ void TaskAceCheck::StepProcessAceResponse() // No device caps left to process if (m_context.featureLogic->isDone()) { LogInfo("All responses has been received from ACE."); + + // Saving static dev cap permissions + FOREACH (cap, m_context.staticPermittedDevCaps) { + LogInfo("staticPermittedDevCaps : " << cap->first + << " smack: " << cap->second); + } + + AceDB::AceDAO::setRequestedDevCaps( + *(m_context.widgetHandle), + m_context.staticPermittedDevCaps); + return; } @@ -103,7 +124,21 @@ void TaskAceCheck::StepCheckAceResponse() ThrowMsg(Exceptions::NotAllowed, "Instalation failure. " "Some deviceCap was not accepted by ACE."); } + LogInfo("Updating \"feature reject status\" in database!"); + auto it = m_context.featureLogic->resultBegin(); + auto end = m_context.featureLogic->resultEnd(); + for(;it != end; ++it){ + LogInfo(" |- Feature: " << it->name << " has reject status: " << it->rejected); + if (it->rejected) { + WrtDB::WidgetDAO dao(*(m_context.widgetHandle)); + dao.updateFeatureRejectStatus(*it); + } + } LogInfo("Installation continues..."); + + m_context.job->UpdateProgress( + InstallerContext::INSTALL_ACE_CHECK, + "Widget Access Control Check Finished"); } void TaskAceCheck::ProcessAceResponse(PolicyResult policyResult) @@ -112,8 +147,11 @@ void TaskAceCheck::ProcessAceResponse(PolicyResult policyResult) DPL::String deviceCap = m_context.featureLogic->getDevice(); - if (policyResult == PolicyEffect::PERMIT) - m_context.staticPermittedDevCaps.insert(deviceCap); + LogInfo("DevCap is : " << deviceCap); + LogInfo("PolicyResult is : " << + PolicyResult::serialize(policyResult)); + m_context.staticPermittedDevCaps.insert(std::make_pair(deviceCap, + policyResult == PolicyEffect::PERMIT)); m_context.featureLogic->setAceResponse(policyResult != PolicyEffect::DENY); m_context.job->Resume(); diff --git a/src/jobs/widget_install/task_ace_check.h b/src/jobs/widget_install/task_ace_check.h index 4f9a110..c2c453b 100644 --- a/src/jobs/widget_install/task_ace_check.h +++ b/src/jobs/widget_install/task_ace_check.h @@ -24,7 +24,7 @@ #include #include -#include +#include class InstallerContext; diff --git a/src/jobs/widget_install/task_certify.cpp b/src/jobs/widget_install/task_certify.cpp index d801066..a9760f9 100644 --- a/src/jobs/widget_install/task_certify.cpp +++ b/src/jobs/widget_install/task_certify.cpp @@ -274,6 +274,10 @@ void TaskCertify::stepSignature() } LogInfo("================ Step: <> DONE ================"); + + m_contextData.job->UpdateProgress( + InstallerContext::INSTALL_DIGSIG_CHECK, + "Widget Signature checked"); } void TaskCertify::stepWarningPopup() @@ -410,6 +414,10 @@ void TaskCertify::stepAuthorInfoPopup() void TaskCertify::stepFinalize() { LogInfo("Step: <>"); + + m_contextData.job->UpdateProgress( + InstallerContext::INSTALL_CERT_CHECK, + "Widget Certification Check Finished"); } void TaskCertify::onWarningPopupAnswer(const DPL::Popup::AnswerCallbackData& answer) diff --git a/src/jobs/widget_install/task_commons.cpp b/src/jobs/widget_install/task_commons.cpp new file mode 100644 index 0000000..b64e61b --- /dev/null +++ b/src/jobs/widget_install/task_commons.cpp @@ -0,0 +1,124 @@ +/* + * 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 task_commons.cpp + * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) + * @version 1.0 + */ + +#include "task_commons.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Jobs { +namespace WidgetInstall { + +namespace { + +const char * const TEMPORARY_PATH_POSTFIX = "temp"; +const mode_t TEMPORARY_PATH_MODE = 0775; + +int lambdaDeleteFile(const char *fpath, + const struct stat* /*sb*/, + int tflag, + struct FTW* /*ftwbuf*/) +{ + switch (tflag) { + case FTW_D: + case FTW_DNR: + case FTW_DP: + LogInfo("Removing old temporary directory" << fpath); + return rmdir(fpath); + break; + default: + LogInfo("Unlinking old temporary file" << fpath); + return unlink(fpath); + break; + } + return 0; +} + +} // namespace + +void removeTemporaryDir(const std::string& dir) +{ + LogError("[GenerateConfig Task] Aborting... (removing temporary dir: " << + dir << " )"); + + static const int maxDepth = 1024; + struct stat fileInfo; + if (stat(dir.c_str(), &fileInfo) == 0) { + nftw(dir.c_str(), lambdaDeleteFile, maxDepth, FTW_DEPTH); + } +} + +std::string createTempPath() +{ + LogInfo("Step: Creating temporary path"); + + // Temporary path + std::ostringstream tempPathBuilder; + + tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath(); + tempPathBuilder << "/"; + tempPathBuilder << "widget"; + tempPathBuilder << "/"; + tempPathBuilder << TEMPORARY_PATH_POSTFIX; + tempPathBuilder << "_"; + + timeval tv; + gettimeofday(&tv, NULL); + tempPathBuilder << + (static_cast(tv.tv_sec) * 1000000ULL + + static_cast(tv.tv_usec)); + + std::string tempPath = tempPathBuilder.str(); + + // Remove old path if any + struct stat fileInfo; + + // FIXME: what if there are more then maxDepth recursive directories + static const int maxDepth = 1024; + if (stat(tempPath.c_str(), &fileInfo) == 0) { + int error = nftw( + tempPath.c_str(), lambdaDeleteFile, maxDepth, FTW_DEPTH); + + if (error == -1) { + ThrowMsg(DPL::CommonException::InternalError, + DPL::GetErrnoString()); + } + } + // Create new path + FileUtils::MakePath(tempPath, TEMPORARY_PATH_MODE); + + return tempPath; +} + +void createTempPath(const std::string& path) +{ + FileUtils::MakePath(path, TEMPORARY_PATH_MODE); +} + +} // WidgetInstall +} // Jobs diff --git a/src/jobs/widget_install/task_commons.h b/src/jobs/widget_install/task_commons.h new file mode 100644 index 0000000..76306db --- /dev/null +++ b/src/jobs/widget_install/task_commons.h @@ -0,0 +1,40 @@ +/* + * 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 task_commons.h + * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) + * @version 1.0 + */ + +#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_ +#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_ + +#include + +namespace Jobs { +namespace WidgetInstall { + +void removeTemporaryDir(const std::string& path); + +std::string createTempPath(); + +void createTempPath(const std::string& path); + +} // WidgetInstall +} // Jobs + + +#endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_ */ diff --git a/src/jobs/widget_install/task_db_update.cpp b/src/jobs/widget_install/task_db_update.cpp index 0d087c9..8a8cf94 100644 --- a/src/jobs/widget_install/task_db_update.cpp +++ b/src/jobs/widget_install/task_db_update.cpp @@ -28,10 +28,12 @@ #include #include #include -#include -#include +#include +#include +#include #include #include +#include //#include #include #include @@ -114,6 +116,10 @@ void TaskDbUpdate::StepCreateDirs() widgetSrcPath += GlobalConfig::GetWidgetSrcPath(); _WrtMakeDir(widgetSrcPath.c_str(), 0755, WRT_FILEUTILS_RECUR); + + m_context.job->UpdateProgress( + InstallerContext::INSTALL_DIR_CREATE, + "Widget Directory Created"); } void TaskDbUpdate::StepDbUpdate() @@ -138,7 +144,12 @@ void TaskDbUpdate::StepDbUpdate() m_context.wacSecurity, GetUserAgentLanguageTags()); - AceDB::AceDAO::setStaticDevCapPermissions( + FOREACH (cap, m_context.staticPermittedDevCaps) { + LogInfo("staticPermittedDevCaps : " << cap->first + << " smack status: " << cap->second); + } + + AceDB::AceDAO::setRequestedDevCaps( *(m_context.widgetHandle), m_context.staticPermittedDevCaps); diff --git a/src/jobs/widget_install/task_desktop_file.cpp b/src/jobs/widget_install/task_desktop_file.cpp index c0a7b6b..a002d93 100644 --- a/src/jobs/widget_install/task_desktop_file.cpp +++ b/src/jobs/widget_install/task_desktop_file.cpp @@ -321,25 +321,48 @@ void TaskDesktopFile::saveWidgetName(std::ofstream &file) Assert(!!m_context.widgetHandle); WidgetDAO dao(*m_context.widgetHandle); LanguageTagsList languageTags(dao.getLanguageTags()); + bool defaultNameSaved = false; + auto generateWidgetName = [&] (const DPL::OptionalString& tag, + const DPL::OptionalString& language) + { + DPL::OptionalString name = dao.getLocalizedInfo(*language).name; + if (!!name) { + if (!!tag) + { + saveLocalizedKey(file, L"Name", *tag); + } + else + { + file << "Name="; + defaultNameSaved = true; + } + file << *name; + file << std::endl; + } + }; + FOREACH(i, languageTags) { DPL::OptionalString tag = getLangTag(*i);// translate en -> en_US etc if (tag.IsNull()) { tag = *i; } - saveLocalizedKey(file, L"Name", *tag); + generateWidgetName(tag, *i); - DPL::OptionalString name = dao.getLocalizedInfo(*i).name; - if (!!name) { - file << *name; - } else { - file << "Widget " << *m_context.widgetHandle; - } - file << std::endl; + } + DPL::OptionalString defaultLocale = dao.getDefaultlocale(); + if (!!defaultLocale && !defaultNameSaved) + { + generateWidgetName(DPL::OptionalString::Null, *defaultLocale); } } void TaskDesktopFile::saveWidgetIcons(std::ofstream &file) { + DPL::OptionalString pkgname = m_context.widgetConfig.pkgname; + if (pkgname.IsNull()) { + ThrowMsg(Exceptions::InternalError, "No Package name exists."); + } + //TODO this file will need to be updated when user locale preferences //changes. Assert(!!m_context.widgetHandle); @@ -349,29 +372,66 @@ void TaskDesktopFile::saveWidgetIcons(std::ofstream &file) WidgetDAO::WidgetIconList list = dao.getIconList(); LanguageTagsList languageTags(dao.getLanguageTags()); - FOREACH(it, locList) - { - DPL::String i = it->widgetLocale; - DPL::OptionalString tag = getLangTag(i); // translate en -> en_US etc - if (tag.IsNull()) { tag = i; } + bool defaultIconSaved = false; - saveLocalizedKey(file, L"Icon", *tag); + + auto generateWidgetIcon = [&] (const DPL::OptionalString& tag, + const DPL::String& language, + int iconId) + { + if (!!tag) + { + saveLocalizedKey(file, L"Icon", *tag); + } + else + { + file << "Icon="; + defaultIconSaved = true; + } DPL::OptionalString src; FOREACH(icon, list) { - if (icon->iconId == it->iconId) { + if (icon->iconId == iconId) { src = icon->iconSrc; } } if (!!src) { //If menuscreen need use absolute path of widget's icon, comment out //the following lines. - //file << GlobalConfig::GetUserInstalledWidgetPath() << "/"; - //file << WRT_WIDGET_PKGNAME_PREFIX << m_context.widgetHandle - // << "/"; - //file << GlobalConfig::GetUserWidgetDesktopIconPath() << "/"; - file << getIconTargetFilename(i) << std::endl; + + file << GlobalConfig::GetUserInstalledWidgetPath() << "/"; + file << pkgname << "/"; + file << GlobalConfig::GetUserWidgetDesktopIconPath() << "/"; + file << getIconTargetFilename(language) << std::endl; + } + }; + + FOREACH(it, locList) + { + DPL::String i = it->widgetLocale; + DPL::OptionalString tag = getLangTag(i); // translate en -> en_US etc + if (tag.IsNull()) { tag = i; } + + generateWidgetIcon(tag, i, it->iconId); + + } + DPL::OptionalString defaultLocale = dao.getDefaultlocale(); + if (!!defaultLocale && !defaultIconSaved) + { + int iconId = -1; + FOREACH(it, locList) + { + if (it->widgetLocale == *defaultLocale) + { + iconId = it->iconId; + } + } + if (-1 != iconId) + { + generateWidgetIcon(DPL::OptionalString::Null, + DPL::String(), + iconId); } } } @@ -421,14 +481,11 @@ void TaskDesktopFile::saveWidgetOtherInfo(std::ofstream &file) //file << "BG_SCHEDULE=True" << std::endl; /* visible */ - file << "Visible=True" << std::endl; + file << "nodisplay=FALSE" << std::endl; - file << "X-SLP-BaseLayoutWidth=720" << std::endl; - file << "X-SLP-BaseLayoutHeight=1280" << std::endl; - file << "X-SLP-IsHorizontalScale=True" << std::endl; - file << "X-SLP-PackageType=wgt" << std::endl; + file << "X-TIZEN-PackageType=wgt" << std::endl; if (!widgetID.IsNull()) { - file << "X-SLP-PackageID=" << DPL::ToUTF8String(*widgetID).c_str() << std::endl; + file << "X-TIZEN-PackageID=" << DPL::ToUTF8String(*widgetID).c_str() << std::endl; } } @@ -444,19 +501,22 @@ void TaskDesktopFile::saveAppServiceInfo(std::ofstream &file) return; } - // X-SLP-SVC=operation:scheme:mime; - file << "X-SLP-SVC="; + // x-tizen-svc=http://tizen.org/appsvc/operation/pick|NULL|image; + file << "X-TIZEN-SVC="; FOREACH(it, appServiceList) { - file << DPL::ToUTF8String(it->operation).c_str() << ":"; + if (appServiceList.begin() != it) { + file << ";"; + } + file << DPL::ToUTF8String(it->operation).c_str() << "|"; if (it->scheme.empty()) { - file << "NULL" << ":"; + file << "NULL" << "|"; } else { - file << DPL::ToUTF8String(it->scheme).c_str() << ":"; + file << DPL::ToUTF8String(it->scheme).c_str() << "|"; } if (it->mime.empty()) { - file << "NULL" << ";"; + file << "NULL"; } else { - file << DPL::ToUTF8String(it->mime).c_str() << ";"; + file << DPL::ToUTF8String(it->mime).c_str(); } } } diff --git a/src/jobs/widget_install/task_parental_mode.cpp b/src/jobs/widget_install/task_parental_mode.cpp deleted file mode 100644 index aad45e0..0000000 --- a/src/jobs/widget_install/task_parental_mode.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file task_parental_mode.cpp - * @author Janusz Majnert (j.majnert@samsung.com) - * @version 1.0 - * @brief Implementation for parental mode check installer task - */ -#include -#include -#include -#include -#include - -namespace Jobs { -namespace WidgetInstall { -TaskParentalMode::TaskParentalMode(InstallerContext &installerContext) : - DPL::TaskDecl(this), - m_installerContext(installerContext) -{ - AddStep(&TaskParentalMode::StepCheckParentalMode); -} - -TaskParentalMode::~TaskParentalMode() -{ - //Nothing to do for now -} - -void TaskParentalMode::StepCheckParentalMode() -{ - LogInfo("Step: Checking parental mode status"); - - using namespace WrtDB; - if (GlobalDAOReadOnly::GetParentalMode()) { - Throw(Exceptions::ParentalModeActive); - } -} -} //namespace WidgetInstall -} //namespace Jobs diff --git a/src/jobs/widget_install/task_prepare_files.cpp b/src/jobs/widget_install/task_prepare_files.cpp new file mode 100644 index 0000000..2ce47aa --- /dev/null +++ b/src/jobs/widget_install/task_prepare_files.cpp @@ -0,0 +1,226 @@ +/* + * 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 task_generate_config.cpp + * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) + * @version 1.0 + */ + +#include "task_prepare_files.h" +#include +#include +#include +#include +#include +#include +#include +#include // config.xml logging only +#include +#include +#include +#include +#include + +namespace Jobs { +namespace WidgetInstall { + +namespace { + +const std::string TIZEN_KEYWORD = "tizen"; +const char* BACKKEY = "backbutton-presence"; +const char* ENABLE = "enable"; +const char* DISABLE = "disable"; +const char* ROTATION = "rotation-lock"; +const char* LANDSCAPE = "landscape"; +const char* PORTRAIT = "portrait"; +const char* INDICATOR = "indicator-presence"; + +const char* VIEWMODES[] = { + "windowed ", + "floating ", + "fullscreen ", + "maximized ", + "minimized "}; + +} // namespace + +TaskPrepareFiles::TaskPrepareFiles(InstallerContext &installerContext) : + DPL::TaskDecl(this), + m_installerContext(installerContext) +{ + // Install steps + AddStep(&TaskPrepareFiles::StepShowPopup); + AddStep(&TaskPrepareFiles::StepCreateTempPath); + AddStep(&TaskPrepareFiles::StepCopyIcon); + AddStep(&TaskPrepareFiles::StepCreateConfig); + + AddAbortStep(&TaskPrepareFiles::StepAbort); +} + +void TaskPrepareFiles::StepCreateTempPath() +{ + m_installerContext.tempWidgetPath = createTempPath(); +} + +void TaskPrepareFiles::StepCopyIcon() +{ + if(m_installerContext.iconPath.empty()) { + LogWarning("No icon specified"); + return; + } + + DPL::String path = DPL::FromUTF8String(m_installerContext.iconPath); + std::string filename = m_installerContext.iconPath; + size_t last = m_installerContext.iconPath.find_last_of( "\\/" ); + if(last != std::string::npos) { + filename = m_installerContext.iconPath.substr( last+1 ); + } + std::string target = m_installerContext.tempWidgetPath + '/' + filename; + LogDebug("source " << m_installerContext.iconPath << "#"); + LogDebug("target " << target); + + Try + { + DPL::FileInput input(m_installerContext.iconPath); + DPL::FileOutput output(target); + DPL::Copy(&input, &output); + m_installerContext.iconPath = target; + } + Catch(DPL::FileInput::Exception::Base) + { + LogError("File input error"); + // Error while opening or closing source file + ReThrowMsg(Exceptions::CopyIconFailed, m_installerContext.iconPath); + } + Catch(DPL::FileOutput::Exception::Base) + { + LogError("File output error"); + // Error while opening or closing target file + ReThrowMsg(Exceptions::CopyIconFailed, target); + } + Catch(DPL::CopyFailed) + { + LogError("File copy error"); + // Error while copying + ReThrowMsg(Exceptions::CopyIconFailed, target); + } +} + +void TaskPrepareFiles::StepShowPopup() +{ + LogError("Not implemented"); + /* + * TODO show configuration popup, store results in installer context or + * abort. The icon path is stored in m_installerContext.iconPath. It should + * be updated if necessary. + */ + + // TODO get user options from popup + m_enableIndicator = true; + m_backKey = false; + (void)m_portrait; + m_viewModes.push_back(FULLSCREEN); + m_viewModes.push_back(WINDOWED); + m_viewModes.push_back(FLOATING); + m_viewModes.unique(); +} + + +void TaskPrepareFiles::StepCreateConfig() +{ + LogInfo("creating config.xml..."); + + Try + { + // create document + ConfigXml::DocumentPtr doc = ConfigXml::Document::Create(); + + // setup view modes + std::string modes; + FOREACH(it, m_viewModes) { + modes += VIEWMODES[*it]; + } + + ConfigXml::ElementPtr root = doc->Add( + m_installerContext.widgetSource.c_str(), + modes.c_str()); + + // access to all sites + root->Add("*"); + + // add features + { + using namespace WrtDB; + FeatureHandleList features = FeatureDAOReadOnly::GetHandleList(); + FOREACH(it, features) { + FeatureDAOReadOnly feature(*it); + std::string name = feature.GetName(); + // tizen only + if (std::string::npos != name.find(TIZEN_KEYWORD)) { + root->Add(name.c_str(), false); + } + } + } + + // add settings + if (!!m_enableIndicator) { + root->Add( + INDICATOR, + (*m_enableIndicator ? ENABLE : DISABLE)); + } + if (!!m_backKey) { + root->Add( + BACKKEY, + (*m_backKey ? ENABLE : DISABLE)); + } + if (!!m_portrait) { + root->Add( + ROTATION, + (*m_portrait ? PORTRAIT : LANDSCAPE)); + } + + DPL::BinaryQueue bq; + doc->Write(bq); + + std::unique_ptr buffer(new char[bq.Size()]); + + bq.FlattenConsume(buffer.get(),bq.Size()); + LogInfo("Generated XML:\n\n" << buffer.get()); + + std::string configPath = + m_installerContext.tempWidgetPath + "/config.xml"; + + DPL::FileOutput fo(configPath); + doc->Write(fo); + fo.Close(); + + // Done + LogInfo("Config xml created"); + } + Catch(ConfigXml::Base) + { + LogError("Config xml creation failed"); + ReThrowMsg(ConfigXml::Base, m_installerContext.widgetSource); + } +} + +void TaskPrepareFiles::StepAbort() +{ + removeTemporaryDir(m_installerContext.tempWidgetPath); +} + +} // namespace WidgetInstall +} // namespace Jobs diff --git a/src/jobs/widget_install/task_parental_mode.h b/src/jobs/widget_install/task_prepare_files.h similarity index 50% rename from src/jobs/widget_install/task_parental_mode.h rename to src/jobs/widget_install/task_prepare_files.h index e3eeec5..4329c3c 100644 --- a/src/jobs/widget_install/task_parental_mode.h +++ b/src/jobs/widget_install/task_prepare_files.h @@ -13,36 +13,47 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @file task_parental_mode.h - * @author Janusz Majnert (j.majnert@samsung.com) - * @version 1.0 - * @brief Implementation for parental mode check installer task +/* + * @file task_prepare_files.h + * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) + * @version 1.0 */ -#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_PARENTAL_MODE_H -#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_PARENTAL_MODE_H + +#ifndef SRC_JOBS_WIDGET_INSTALL_TASK_PREPARE_FILES_H_ +#define SRC_JOBS_WIDGET_INSTALL_TASK_PREPARE_FILES_H_ #include +#include +#include +#include class InstallerContext; namespace Jobs { namespace WidgetInstall { -class TaskParentalMode : - public DPL::TaskDecl + +class TaskPrepareFiles : public DPL::TaskDecl { - private: +private: // Installation context InstallerContext &m_installerContext; + DPL::OptionalBool m_enableIndicator; + DPL::OptionalBool m_backKey; + DPL::OptionalBool m_portrait; + std::list m_viewModes; + // TODO anything else? // Steps - void StepCheckParentalMode(); + void StepCreateTempPath(); + void StepCopyIcon(); + void StepShowPopup(); + void StepCreateConfig(); + void StepAbort(); public: - explicit TaskParentalMode(InstallerContext &installerContext); - virtual ~TaskParentalMode(); + explicit TaskPrepareFiles(InstallerContext &installerContext); }; -} //namespace WidgetInstall -} //namespace Jobs -#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_PARENTAL_MODE_H +} // namespace WidgetInstall +} // namespace Jobs +#endif /* SRC_JOBS_WIDGET_INSTALL_TASK_PREPARE_FILES_H_ */ diff --git a/src/jobs/widget_install/task_smack.cpp b/src/jobs/widget_install/task_smack.cpp index f8e679c..7bb343d 100644 --- a/src/jobs/widget_install/task_smack.cpp +++ b/src/jobs/widget_install/task_smack.cpp @@ -46,10 +46,12 @@ void TaskSmack::Step() #ifdef WRT_SMACK_ENABLED std::stringstream devcaps; FOREACH(it, m_context.staticPermittedDevCaps) { - std::string utf8 = DPL::ToUTF8String(*it); - if (it != m_context.staticPermittedDevCaps.begin()) - devcaps << ","; - devcaps << utf8; + if (it->second) { + std::string utf8 = DPL::ToUTF8String(it->first); + if (it != m_context.staticPermittedDevCaps.begin()) + devcaps << ","; + devcaps << utf8; + } } DPL::OptionalString pkgName = m_context.widgetConfig.Pkgname; Assert(!pkgName.IsNull() && "widget doesn't have a pkg name"); @@ -58,6 +60,9 @@ void TaskSmack::Step() devcaps.str().c_str(), OPERATION_INSTALL); Assert(result==PC_OPERATION_SUCCESS && "access control setup failed"); + m_context.job->UpdateProgress( + InstallerContext::INSTALL_SMACK_ENABLE, + "Widget SMACK Enabled"); #endif } diff --git a/src/jobs/widget_install/task_smack.h b/src/jobs/widget_install/task_smack.h index e4ba39a..bb494fd 100644 --- a/src/jobs/widget_install/task_smack.h +++ b/src/jobs/widget_install/task_smack.h @@ -24,7 +24,7 @@ #include #include -#include +#include class InstallerContext; diff --git a/src/jobs/widget_install/task_unzip.cpp b/src/jobs/widget_install/task_unzip.cpp index 1da1176..24d203a 100644 --- a/src/jobs/widget_install/task_unzip.cpp +++ b/src/jobs/widget_install/task_unzip.cpp @@ -22,25 +22,13 @@ #include #include #include -#include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include -using namespace WrtDB; - -namespace // anonymous -{ -const char * const TEMPORARY_PATH_POSTFIX = "temp"; -const mode_t TEMPORARY_PATH_MODE = 0775; +namespace { struct PathAndFilePair { @@ -70,30 +58,7 @@ PathAndFilePair SplitFileAndPath(const std::string &filePath) filePath.substr(position + 1)); } -static int lambdaDeleteFile(const char *fpath, - const struct stat *sb, - int tflag, - struct FTW *ftwbuf) -{ - (void)sb; - (void)ftwbuf; - - switch (tflag) { - case FTW_D: - case FTW_DNR: - case FTW_DP: - LogInfo("Removing old temporary directory" << fpath); - return rmdir(fpath); - break; - default: - LogInfo("Unlinking old temporary file" << fpath); - return unlink(fpath); - break; - } - - return 0; } -} // namespace anonymous namespace Jobs { namespace WidgetInstall { @@ -132,46 +97,8 @@ void TaskUnzip::ExtractFile(DPL::ZipInput::File *input, void TaskUnzip::StepCreateTempPath() { - LogInfo("Step: Creating temporary path"); - - // Temporary path - std::ostringstream tempPathBuilder; - - tempPathBuilder << GlobalConfig::GetUserInstalledWidgetPath(); - tempPathBuilder << "/"; - tempPathBuilder << "widget"; - tempPathBuilder << "/"; - tempPathBuilder << TEMPORARY_PATH_POSTFIX; - tempPathBuilder << "_"; - - timeval tv; - gettimeofday(&tv, NULL); - tempPathBuilder << - (static_cast(tv.tv_sec) * 1000000ULL + - static_cast(tv.tv_usec)); - - std::string tempPath = tempPathBuilder.str(); - - // Remove old path if any - struct stat fileInfo; - - // FIXME: what if there are more then maxDepth recursive directories - static const int maxDepth = 1024; - if (stat(tempPath.c_str(), &fileInfo) == 0) { - int error = nftw( - tempPath.c_str(), lambdaDeleteFile, maxDepth, FTW_DEPTH); - - if (error == -1) { - ThrowMsg(DPL::CommonException::InternalError, - DPL::GetErrnoString()); - } - } - // Create new path - FileUtils::MakePath(tempPath, TEMPORARY_PATH_MODE); - // Step succedded, save temporary widget path - m_installerContext.tempWidgetPath = tempPath; - m_installerContext.unzipStarted = true; + m_installerContext.tempWidgetPath = createTempPath(); } void TaskUnzip::StepUnzipPrepare() @@ -180,12 +107,12 @@ void TaskUnzip::StepUnzipPrepare() Try { - m_zip.Reset(new DPL::ZipInput(m_installerContext.widgetFilePath)); + m_zip.Reset(new DPL::ZipInput(m_installerContext.widgetSource)); LogInfo("Widget package comment: " << m_zip->GetGlobalComment()); // Widget package must not be empty if (m_zip->empty()) { - ThrowMsg(Exceptions::ZipEmpty, m_installerContext.widgetFilePath); + ThrowMsg(Exceptions::ZipEmpty, m_installerContext.widgetSource); } // Set iterator to first file @@ -193,7 +120,7 @@ void TaskUnzip::StepUnzipPrepare() } Catch(DPL::ZipInput::Exception::OpenFailed) { - ReThrowMsg(Exceptions::OpenZipFailed, m_installerContext.widgetFilePath); + ReThrowMsg(Exceptions::OpenZipFailed, m_installerContext.widgetSource); } } @@ -218,7 +145,7 @@ void TaskUnzip::StepUnzipProgress() LogPedantic("Path to extract: " << newPath); // Create path in case of it is empty - FileUtils::MakePath(newPath, TEMPORARY_PATH_MODE); + createTempPath(newPath); } else { // This is regular file std::string fileExtractPath = @@ -234,7 +161,7 @@ void TaskUnzip::StepUnzipProgress() " : " << pathAndFile.file); // First, ensure that path exists - FileUtils::MakePath(pathAndFile.path, TEMPORARY_PATH_MODE); + createTempPath(pathAndFile.path); Try { @@ -264,23 +191,13 @@ void TaskUnzip::StepUnzipFinished() // Unzip finished, close internal structures m_zip.Reset(); - m_installerContext.unzipFinished = true; - // Done LogInfo("Unzip finished"); } void TaskUnzip::StepAbort() { - LogError("[Unzip Task] Aborting... (removing temporary dir: " << - m_installerContext.tempWidgetPath << " )"); - - static const int maxDepth = 1024; - struct stat fileInfo; - if (stat(m_installerContext.tempWidgetPath.c_str(), &fileInfo) == 0) { - nftw(m_installerContext.tempWidgetPath.c_str(), - lambdaDeleteFile, maxDepth, FTW_DEPTH); - } + removeTemporaryDir(m_installerContext.tempWidgetPath); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_widget_config.cpp b/src/jobs/widget_install/task_widget_config.cpp index 8f4710f..6addca6 100644 --- a/src/jobs/widget_install/task_widget_config.cpp +++ b/src/jobs/widget_install/task_widget_config.cpp @@ -24,9 +24,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -37,27 +37,18 @@ #include #include #include -#include "wrt_powder_info_util.h" #include namespace { // anonymous -const char *WIDGET_SCHEMA = "widget"; const WidgetHandle WIDGET_HANDLE_START_VALUE = 1000; -const char * AGE_RATING = "Age Rating: "; -const char * CATEGORY = "Category: "; -const char * LEVEL = "Level: "; -const char * CONTEXT = "Context: "; -const DPL::String POWDER_INFO = DPL::FromUTF8String("Powder Info"); -const DPL::String POWDER_PASSWORD = DPL::FromUTF8String( - "Parental Mode is ON.
" - "Please enter your password"); const DPL::String WIDGET_HEAD = DPL::FromUTF8String("Widget information"); const std::string OK_BUTTON_LABEL = "OK"; const std::string CANCEL_BUTTON_LABEL = "Cancel"; const DPL::String BR = DPL::FromUTF8String("
"); const DPL::String DOUBLE_BR = DPL::FromUTF8String("

"); -const DPL::String POWDER_HEAD = DPL::FromUTF8String("Powder information"); const DPL::String FEATURE_HEAD = DPL::FromUTF8String("Feature information"); +const DPL::String WIDGET_NOT_COMPATIBLE = DPL::FromUTF8String("This widget is " + "not compatible with WRT. Do you want install it anyway?"); } // namespace anonymous namespace Jobs { @@ -81,13 +72,14 @@ TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) : AddStep(&TaskWidgetConfig::ReadLocaleFolders); AddStep(&TaskWidgetConfig::ProcessLocalizedStartFiles); AddStep(&TaskWidgetConfig::ProcessLocalizedIcons); - AddStep(&TaskWidgetConfig::StepProcessPowderFile); AddStep(&TaskWidgetConfig::StepVerifyFeatures); //in case of tests, no popups are shown if (GlobalSettings::GetPopupsEnabledFlag()) { AddStep(&TaskWidgetConfig::StepShowWidgetInfo); AddStep(&TaskWidgetConfig::StepCancelWidgetInstallation); + AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo); + AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion); } } @@ -257,7 +249,7 @@ void TaskWidgetConfig::ProcessStartFile(const DPL::OptionalString& path, // set property data for hosted start url // Hosted start url only support TIZEN WebApp if (m_installContext.widgetConfig.type == - APP_TYPE_TIZENWEBAPP) + APP_TYPE_TIZENWEBAPP) { const char *startPath = DPL::ToUTF8String(startFileData.path).c_str(); @@ -290,6 +282,8 @@ void TaskWidgetConfig::ProcessLocalizedIcons() ProcessIcon(ConfigParserData::Icon(L"icon.png")); ProcessIcon(ConfigParserData::Icon(L"icon.gif")); ProcessIcon(ConfigParserData::Icon(L"icon.jpg")); + ProcessIcon(ConfigParserData::Icon( + DPL::FromUTF8String(m_installContext.iconPath))); FOREACH(i, m_installContext.widgetConfig.configInfo.iconsList) { @@ -309,7 +303,6 @@ void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon) if (m_processedIconSet.count(icon.src) > 0) { return; } - m_processedIconSet.insert(icon.src); LocaleSet localesAvailableForIcon; @@ -346,69 +339,6 @@ void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon) } } -void TaskWidgetConfig::StepProcessPowderFile(void) -{ - using namespace WrtDB; - const std::string& path = m_installContext.tempWidgetPath; - WidgetRegisterInfo* widgetConfiguration = - &m_installContext.widgetConfig; - - LogInfo("Process powder for guid " << - widgetConfiguration->guid); - if (!!widgetConfiguration->guid) { - LibIri::Wrapper iri(DPL::ToUTF8String( - *widgetConfiguration->guid).c_str()); - DPL::String widgetHost; - DPL::String widgetPath; - if (NULL != iri.m_Iri->host) { - widgetHost = DPL::FromUTF8String(iri.m_Iri->host); - } - if (NULL != iri.m_Iri->path) { - widgetPath = DPL::FromUTF8String(iri.m_Iri->path); - } - PowderParserData parserData(&widgetConfiguration->powderDescription, - widgetHost, widgetPath); - ConfigParserData::StringsList& descriptions = - widgetConfiguration->configInfo.powderDescriptionLinks; - - FOREACH(linkIter, descriptions) - { - LogInfo("Process powder link: " << *linkIter); - LibIri::Wrapper link(DPL::ToUTF8String(*linkIter).c_str()); - LogInfo("Parser link" << link); - if (strcmp(link.m_Iri->scheme, WIDGET_SCHEMA) == 0) { - if (NULL != link.m_Iri->host) { - std::ostringstream stream; - //FIXME: Current libiri library is not able to parse - // URL: widget:/powder.xml Field host - // is filed with path - stream << path << "/" << link.m_Iri->host; - ParserRunner().Parse( - stream.str(), - ElementParserPtr(new - RootParser(&parserData, - DPL:: - FromUTF32String( - L"powder")))); - } else { - ThrowMsg(Exceptions::WidgetConfigFileInvalid, - "Powder link " << *linkIter << " path empty."); - } - } else { - ThrowMsg(Exceptions::WidgetConfigFileInvalid, - "Powder link " << - *linkIter << - " schema not supported."); - } - } - } - - //TODO:FIXME make progress valid - m_installContext.job->UpdateProgress( - InstallerContext::INSTALL_WIDGET_CONFIG1, - "Widget Config powder step Finished"); -} - void TaskWidgetConfig::AnswerCallback(const DPL::Popup::AnswerCallbackData &answer) { LogInfo("Callback called"); @@ -425,11 +355,10 @@ void TaskWidgetConfig::StepCancelWidgetInstallation() } } -//TODO this step is not added in constructor -void TaskWidgetConfig::StepShowPowderPasswordCancel() +void TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion() { if (WRT_POPUP_BUTTON_CANCEL == m_installCancel) { - ThrowMsg(Exceptions::NotAllowed, "Parental Mode is ON"); + ThrowMsg(Exceptions::NotAllowed, "WRT version incompatible."); } } @@ -454,46 +383,28 @@ void TaskWidgetConfig::PopupCreate() CONTROLLER_POST_EVENT(PopupController, event); } -DPL::String TaskWidgetConfig::createPowderInfo() const +void TaskWidgetConfig::PopupMinVersionConfirmationCreate() { - WrtDB::Powder::Description &powderDescription = - m_installContext.widgetConfig.powderDescription; - std::ostringstream powderInfo; - if (!!powderDescription.ageRating) { - powderInfo << AGE_RATING; - powderInfo << *powderDescription.ageRating; - powderInfo << BR; - } - FOREACH(categoriesIterator, powderDescription.categories) { - powderInfo << CATEGORY; - powderInfo << PowderInfoUtilSingleton::Instance(). - getCategoryLabel(categoriesIterator->first); - powderInfo << BR; - - FOREACH(levelIterator, categoriesIterator->second.levels) { - powderInfo << LEVEL; - powderInfo << static_cast(levelIterator->level); - powderInfo << BR; - - FOREACH(contextIterator, levelIterator->context) { - powderInfo << CONTEXT; - powderInfo << PowderInfoUtilSingleton::Instance(). - getContextLabel(*contextIterator); - powderInfo << BR; - } - } - } - - return DPL::FromUTF8String(powderInfo.str()); + m_installContext.job->Pause(); + LogDebug("Creating minVersion confirmation popup."); + using namespace DPL::Popup; + CtrlPopupPtr popup = PopupControllerSingleton::Instance().CreatePopup(); + popup->SetTitle(DPL::ToUTF8String(WIDGET_HEAD)); + popup->Append(new PopupObject::Label( + DPL::ToUTF8String(WIDGET_NOT_COMPATIBLE))); + popup->Append(new PopupObject::Button(OK_BUTTON_LABEL, + WRT_POPUP_BUTTON_OK)); + popup->Append(new PopupObject::Button(CANCEL_BUTTON_LABEL, + WRT_POPUP_BUTTON_CANCEL)); + ListenForAnswer(popup); + ShowPopupEvent event(popup, + MakeAnswerCallback(this, &TaskWidgetConfig::AnswerCallback), + DPL::Event::UNDEFINED_LOOP_HANDLE); + CONTROLLER_POST_EVENT(PopupController, event); } void TaskWidgetConfig::StepShowWidgetInfo() { - if (!createPowderInfo().empty()) { - m_popupData.addWidgetInfo(POWDER_HEAD, - createPowderInfo()); - } - if (!m_popupData.widgetInfo.empty()) { PopupCreate(); m_installContext.job->UpdateProgress( @@ -502,16 +413,14 @@ void TaskWidgetConfig::StepShowWidgetInfo() } } -//TODO this step is not added in constructor -void TaskWidgetConfig::StepShowPowderPassword() +void TaskWidgetConfig::StepCheckMinVersionInfo() { - using namespace WrtDB; - if (GlobalDAOReadOnly::GetParentalMode()) { - m_popupData.addWidgetInfo(POWDER_INFO, POWDER_PASSWORD); + if (!isWACVersionCompatible(m_installContext.widgetConfig.minVersion)) { + PopupMinVersionConfirmationCreate(); + m_installContext.job->UpdateProgress( + InstallerContext::INSTALL_WIDGET_CONFIG2, + "Show MinVersion Info Finished"); } - m_installContext.job->UpdateProgress( - InstallerContext::INSTALL_WIDGET_CONFIG2, - "Show Powder Password Finished"); } void TaskWidgetConfig::StepVerifyFeatures() @@ -550,7 +459,7 @@ void TaskWidgetConfig::StepVerifyFeatures() ThrowMsg( Exceptions::WidgetConfigFileInvalid, - "Widget cannot be installedm equired feature is missing:[" + "Widget cannot be installed, required feature is missing:[" + DPL::ToUTF8String(it->name) + "]"); } @@ -648,5 +557,63 @@ bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType, return false; } +bool TaskWidgetConfig::parseVersionString(const std::string &version, + long &majorVersion, long &minorVersion, long µVersion) const +{ + std::istringstream inputString(version); + inputString >> majorVersion; + if (inputString.bad() || inputString.fail()) { + LogWarning("Invalid minVersion format."); + return false; + } + inputString.get(); // skip period + inputString >> minorVersion; + if (inputString.bad() || inputString.fail()) { + LogWarning("Invalid minVersion format"); + return false; + } else { + inputString.get(); // skip period + if (inputString.bad() || inputString.fail()) { + inputString >> microVersion; + } + } + return true; +} + +bool TaskWidgetConfig::isWACVersionCompatible(const DPL::OptionalString + &widgetVersion) const +{ + if (widgetVersion.IsNull() || (*widgetVersion).empty()) + { + LogWarning("minVersion attribute is empty. WRT assumes platform " + "supports this widget."); + return true; + } + + //Parse widget version + long majorWidget = 0, minorWidget = 0, microWidget = 0; + if (!parseVersionString(DPL::ToUTF8String(*widgetVersion), majorWidget, + minorWidget, microWidget)) { + LogWarning("Invalid format of widget version string."); + return true; + } + + //Parse supported version + long majorSupported = 0, minorSupported = 0, microSupported = 0; + if (!parseVersionString(WrtDB::GlobalConfig::GetWACVersion(), + majorSupported, minorSupported, microSupported)) { + LogWarning("Invalid format of WAC version string."); + return true; + } + + if (majorWidget > majorSupported || + minorWidget > minorSupported || + microWidget > microSupported) { + LogInfo("Platform doesn't support this widget."); + return false; + } + return true; +} + } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_widget_config.h b/src/jobs/widget_install/task_widget_config.h index 0655964..f0ab073 100644 --- a/src/jobs/widget_install/task_widget_config.h +++ b/src/jobs/widget_install/task_widget_config.h @@ -53,7 +53,7 @@ class TaskWidgetConfig : public DPL::Popup::PopupControllerUser { private: - enum PowderInfoButton + enum InfoPopupButton { WRT_POPUP_BUTTON_OK, WRT_POPUP_BUTTON_CANCEL }; @@ -73,21 +73,25 @@ class TaskWidgetConfig : bool typeForcedInConfig = false); void ProcessLocalizedIcons(); void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon); - void StepProcessPowderFile(); void StepVerifyFeatures(); void StepShowWidgetInfo(); - void StepPowderCancel(); - void StepFeatureCancel(); + void StepCheckMinVersionInfo(); void StepCancelWidgetInstallation(); - void StepShowPowderPassword(); - void StepShowPowderPasswordCancel(); + void StepCancelWidgetInstallationAfterMinVersion(); void PopupCreate(); - DPL::String createPowderInfo() const; + void PopupMinVersionConfirmationCreate(); void AnswerCallback(const DPL::Popup::AnswerCallbackData& answer); DPL::String createAuthorWidgetInfo() const; void setApplicationType(); bool isFeatureAllowed( WrtDB::AppType appType, DPL::String featureName); + bool isWACVersionCompatible(const DPL::OptionalString &widgetVersion) const; + /** + * @brief Parses version string in format "major.minor.micro anything" + * Returns false if format is invalid + */ + bool parseVersionString(const std::string &version, long &majorVersion, + long &minorVersion, long µVersion) const; public: TaskWidgetConfig(InstallerContext& installTaskContext); diff --git a/src/jobs/widget_install/view_mode.h b/src/jobs/widget_install/view_mode.h new file mode 100644 index 0000000..6054388 --- /dev/null +++ b/src/jobs/widget_install/view_mode.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * @file view_mode.h + * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) + * @version 1.0 + */ + +#ifndef SRC_JOBS_WIDGET_INSTALL_VIEW_MODE_H_ +#define SRC_JOBS_WIDGET_INSTALL_VIEW_MODE_H_ + +namespace Jobs { +namespace WidgetInstall { + +enum ViewMode +{ + WINDOWED = 0, + FLOATING, + FULLSCREEN, + MAXIMIZED, + MINIMIZED +}; + +} // WidgetInstall +} // Jobs + +#endif /* SRC_JOBS_WIDGET_INSTALL_VIEW_MODE_H_ */ diff --git a/src/jobs/widget_install/widget_install_context.h b/src/jobs/widget_install/widget_install_context.h index c277dea..192bc5f 100644 --- a/src/jobs/widget_install/widget_install_context.h +++ b/src/jobs/widget_install/widget_install_context.h @@ -22,11 +22,14 @@ #ifndef INSTALLER_CONTEXT_H #define INSTALLER_CONTEXT_H +#include #include +#include #include #include #include #include +#include namespace Jobs { namespace WidgetInstall { @@ -46,37 +49,42 @@ struct InstallerContext INSTALL_WIDGET_CONFIG3, INSTALL_WIDGET_CONFIG4, INSTALL_WIDGET_CONFIG5, + INSTALL_DIGSIG_CHECK, + INSTALL_CERT_CHECK, INSTALL_DB_UPDATE, + INSTALL_DIR_CREATE, INSTALL_RENAME_PATH, + INSTALL_ACE_PREPARE, + INSTALL_ACE_CHECK, + INSTALL_SMACK_ENABLE, + INSTALL_COPY_ICONFILE, INSTALL_CREATE_DESKTOP, INSTALL_CREATE_EXECFILE, - INSTALL_COPY_ICONFILE, INSTALL_CREATE_PRIVATE_STORAGE, INSTALL_END } InstallStep; // Installation state variables - std::string widgetFilePath; ///< Source widget zip file + std::string widgetSource; ///< Source widget zip file/widget url std::string tempWidgetPath; ///< Unpacked widget temporary path WrtDB::WidgetRegisterInfo widgetConfig; ///< WidgetConfigInfo DPL::Optional widgetHandle; Jobs::WidgetInstall::WacSecurity wacSecurity;///< Widget Domain information. - bool unzipStarted; - ///< flag that indicates whether installer starts to unzip .wgt file - bool unzipFinished; - ///< flag that indicates whether installer finishes to unzip completely. InstallStep installStep; ///< current step of installation Jobs::WidgetInstall::JobWidgetInstall *job; ///< pointer of instance of JobWidgetInstall WidgetUpdateInfo::ExistingWidgetInfo existingWidgetInfo; ///< Whether this is an update or normal installation Jobs::WidgetInstall::FeatureLogicPtr featureLogic; - /** List of dev-caps that get "static" permission (will always - * have PERMIT from ACE Policy). They will therefore receive + /** List of dev-caps that are requested in widget config file. + * Additional flag tells whether dev cap gets "static" permission + * (will always have PERMIT from ACE Policy). They will therefore receive * static SMACK permission. (They may be forbidden because * of ACE User Settings, but for now we do not protect this * case with SMACK). */ - std::set staticPermittedDevCaps; + AceDB::RequestedDevCapsMap staticPermittedDevCaps; + ///< Optional path to downloaded widget icon + std::string iconPath; }; #endif // INSTALLER_CONTEXT_H diff --git a/src/jobs/widget_install/widget_install_errors.h b/src/jobs/widget_install/widget_install_errors.h index 5ed746e..6b1ca1b 100644 --- a/src/jobs/widget_install/widget_install_errors.h +++ b/src/jobs/widget_install/widget_install_errors.h @@ -43,7 +43,6 @@ enum Type ErrorInvalidPackage, ///< Widget signature is invalid. ErrorAlreadyInstalled, ///< ? ErrorInternal, ///< ? - ErrorParentalMode, ///< Widget cannot be installed when parental mode is active ErrorNotAllowed, ///< Widget installation or update not allowed ///< because violation of policy ocurred ErrorDeferred, ///< Widget installation was deferred and will be continued when possible @@ -57,9 +56,7 @@ DECLARE_JOB_EXCEPTION_BASE(JobExceptionBase, Base, ErrorUnknown) // PREPARE DECLARE_JOB_EXCEPTION(Base, NotAllowed, ErrorNotAllowed) DECLARE_JOB_EXCEPTION(Base, Deferred, ErrorDeferred) - -//PARENTAL MODE -DECLARE_JOB_EXCEPTION(Base, ParentalModeActive, ErrorParentalMode) +DECLARE_JOB_EXCEPTION(Base, InvalidWidgetUrl, ErrorInvalidWidgetPackage) //UNZIP DECLARE_JOB_EXCEPTION(Base, OpenZipFailed, ErrorInvalidWidgetPackage) @@ -76,7 +73,6 @@ DECLARE_JOB_EXCEPTION(Base, InvalidPackage, ErrorInvalidPackage) //WCONFIG DECLARE_JOB_EXCEPTION(Base, WidgetConfigFileInvalid, ErrorInvalidWidgetPackage) -DECLARE_JOB_EXCEPTION(Base, WidgetPowderFileInvalid, ErrorInvalidWidgetPackage) DECLARE_JOB_EXCEPTION(Base, NotInstalled, ErrorInvalidWidgetPackage) DECLARE_JOB_EXCEPTION(Base, InstallationFailed, ErrorInvalidWidgetPackage) DECLARE_JOB_EXCEPTION(Base, AlreadyInstalled, ErrorAlreadyInstalled) diff --git a/src/jobs/widget_uninstall/task_smack.cpp b/src/jobs/widget_uninstall/task_smack.cpp index 0d529ca..70d4b71 100644 --- a/src/jobs/widget_uninstall/task_smack.cpp +++ b/src/jobs/widget_uninstall/task_smack.cpp @@ -53,6 +53,10 @@ void TaskSmack::Step() } catch (WrtDB::WidgetDAOReadOnly::Exception) { Assert(false && "can't access widget data"); } + + m_context.job->UpdateProgress( + UninstallerContext::INSTALL_SMACK_UNENABLE, + "Widget SMACK Enabled"); #endif } diff --git a/src/jobs/widget_uninstall/uninstaller_context.h b/src/jobs/widget_uninstall/uninstaller_context.h index 9317654..d51c9f9 100644 --- a/src/jobs/widget_uninstall/uninstaller_context.h +++ b/src/jobs/widget_uninstall/uninstaller_context.h @@ -39,12 +39,12 @@ struct UninstallerContext { UNINSTALL_START, UNINSTALL_CHECK, - UNINSTALL_DB_UPDATE, UNINSTALL_REMOVE_PREPARE, UNINSTALL_REMOVE_ONEFILE, UNINSTALL_REMOVE_DIRECTORIES, - UNINSTALL_REMOVE_FINISHED, UNINSTALL_REMOVE_DESKTOP, + UNINSTALL_REMOVE_FINISHED, + UNINSTALL_DB_UPDATE, UNINSTALL_END }; diff --git a/src/logic/installer_controller.cpp b/src/logic/installer_controller.cpp index 8009b98..efe3a69 100644 --- a/src/logic/installer_controller.cpp +++ b/src/logic/installer_controller.cpp @@ -106,3 +106,18 @@ void InstallerController::OnEventReceived( { m_installerLogic.Terminate(); } + +void InstallerController::OnEventReceived( + const InstallerControllerEvents::InstallWidgetFromBrowserEvent &event) +{ + std::string url = event.GetArg0(); + std::string icon = event.GetArg1(); + WidgetInstallationStruct installerStruct = event.GetArg2(); + Jobs::JobHandle handle = m_installerLogic.InstallWidgetFromBrowser( + url, + icon, + installerStruct); + + //TODO return handle to API + (void)handle; +} diff --git a/src/logic/installer_controller.h b/src/logic/installer_controller.h index 8ce43fc..c68920a 100644 --- a/src/logic/installer_controller.h +++ b/src/logic/installer_controller.h @@ -73,6 +73,15 @@ DECLARE_GENERIC_EVENT_0(InstallDeferredWidgetPackagesEvent) DECLARE_GENERIC_EVENT_0(InitializeEvent) DECLARE_GENERIC_EVENT_0(TerminateEvent) +/** + * @brief Event for initiating from web widget installation. This event + * contains widget url and optionally widget icon url. + */ +DECLARE_GENERIC_EVENT_3(InstallWidgetFromBrowserEvent, + std::string, + std::string, + WidgetInstallationStruct) + } // namespace InstallerEvents /** @@ -96,7 +105,8 @@ typedef DPL::TypeListDecl< InstallerControllerEvents::NextStepEvent, InstallerControllerEvents::InstallDeferredWidgetPackagesEvent, InstallerControllerEvents::InitializeEvent, - InstallerControllerEvents::TerminateEvent>::Type + InstallerControllerEvents::TerminateEvent, + InstallerControllerEvents::InstallWidgetFromBrowserEvent>::Type InstallerControllerEventsSet; class InstallerController : public DPL::Event::Controller @@ -141,6 +151,9 @@ class InstallerController : public DPL::Event::Controller #include #include -//#include #include #include #include @@ -107,6 +106,21 @@ Jobs::JobHandle InstallerLogic::InstallPlugin(std::string const & pluginPath, return AddAndStartJob(job); } +Jobs::JobHandle InstallerLogic::InstallWidgetFromBrowser( + std::string const & url, + std::string const & icon, + const WidgetInstallationStruct &installerStruct) +{ + LogDebug("New Widget Installation:"); + + Jobs::Job *job = new Jobs::WidgetInstall::JobWidgetInstall( + url, + icon, + installerStruct); + + return AddAndStartJob(job); +} + #define TRANSLATE_JOB_EXCEPTION() \ _rethrown_exception.getParam() #define TRANSLATE_JOB_MESSAGE() \ @@ -117,9 +131,9 @@ bool InstallerLogic::NextStep(Jobs::Job *job) Try { bool stepSucceded = job->NextStep(); - if (stepSucceded) { - job->SendProgress(); + job->SendProgress(); + if (stepSucceded) { return !job->IsPaused(); } diff --git a/src/logic/installer_logic.h b/src/logic/installer_logic.h index db45295..4d62dd2 100644 --- a/src/logic/installer_logic.h +++ b/src/logic/installer_logic.h @@ -59,6 +59,11 @@ class InstallerLogic Jobs::JobHandle InstallPlugin(std::string const & pluginPath, const PluginInstallerStruct &installerStruct); + Jobs::JobHandle InstallWidgetFromBrowser( + std::string const & url, + std::string const & icon, + const WidgetInstallationStruct &installerStruct); + bool NextStep(Jobs::Job* installModel); //TODO implement me diff --git a/src/misc/feature_logic.cpp b/src/misc/feature_logic.cpp index a4e4bd3..25f6f1e 100644 --- a/src/misc/feature_logic.cpp +++ b/src/misc/feature_logic.cpp @@ -22,7 +22,7 @@ #include #include #include - +#include #include #include @@ -35,8 +35,12 @@ FeatureLogic::FeatureLogic(WidgetHandle handle) WrtDB::WidgetDAO widgetDao(handle); WidgetFeatureSet featureSet = widgetDao.getFeaturesList(); FOREACH(it, featureSet) { + LogInfo("Feature name : " << it->name); WrtDB::DeviceCapabilitySet dcs = WrtDB::GlobalDAO::GetDeviceCapability(it->name); + FOREACH (devCap, dcs) { + LogInfo("--- dev cap : " << *devCap); + } Feature feature(*it, dcs); m_featureList.push_back(feature); } diff --git a/src/misc/feature_logic.h b/src/misc/feature_logic.h index 550c123..5a95628 100644 --- a/src/misc/feature_logic.h +++ b/src/misc/feature_logic.h @@ -48,18 +48,13 @@ class FeatureLogic : DPL::Noncopyable { return m_rejected; } - private: - bool isProcessable() const; - struct Feature : public WidgetFeature { WrtDB::DeviceCapabilitySet devCapSet; WrtDB::DeviceCapabilitySet::const_iterator currentCap; - bool rejected; Feature(const WidgetFeature &wf, const WrtDB::DeviceCapabilitySet &set) : WidgetFeature(wf) , devCapSet(set) - , rejected(false) { currentCap = devCapSet.begin(); } @@ -81,7 +76,15 @@ class FeatureLogic : DPL::Noncopyable { currentCap = devCapSet.find(*second.currentCap); } }; + typedef std::list FeatureList; + typedef FeatureList::const_iterator FeatureIterator; + + FeatureIterator resultBegin() { return m_featureList.begin(); } + FeatureIterator resultEnd() { return m_featureList.end(); } + + private: + bool isProcessable() const; FeatureList m_featureList; FeatureList::iterator m_currentFeature; diff --git a/src/misc/wrt_powder_info_util.cpp b/src/misc/wrt_powder_info_util.cpp deleted file mode 100644 index de7bab3..0000000 --- a/src/misc/wrt_powder_info_util.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file wrt_powder_info_util.h - * @author Justyna Mejzner (j.kwiatkowsk@samsung.com) - * @version 1.0 - */ - -#include "wrt_powder_info_util.h" -#include -IMPLEMENT_SINGLETON(PowderInfoUtil) - -PowderInfoUtil::PowderInfoUtil() -{ - m_categories[DPL::FromUTF8String("nu")] = "Nudity"; - m_categories[DPL::FromUTF8String("se")] = "Sex"; - m_categories[DPL::FromUTF8String("vi")] = "Violence"; - m_categories[DPL::FromUTF8String("la")] = "Potentially offensive language"; - m_categories[DPL::FromUTF8String("dr")] = "Drug use"; - m_categories[DPL::FromUTF8String("ga")] = "Gambling"; - m_categories[DPL::FromUTF8String("ha")] = "Hate or harmful activities"; - m_categories[DPL::FromUTF8String("ug")] = "Use of user-generated content"; - - m_contexts[DPL::FromUTF8String("xa")] = "This material appears in" - " an artistic conteaxt"; - m_contexts[DPL::FromUTF8String("xb")] = "This material appears in" - " an educational context"; - m_contexts[DPL::FromUTF8String("xc")] = "This material appears in" - " a medical context"; - m_contexts[DPL::FromUTF8String("xd")] = "This material appears in" - " a sports context"; - m_contexts[DPL::FromUTF8String("xe")] = "This material appears in" - " a violent context"; -} - -std::string PowderInfoUtil::getCategoryLabel(const DPL::String &category) const -{ - CategoryMap::const_iterator categoryIterator = m_categories.find(category); - if (categoryIterator == m_categories.end()) { - ThrowMsg(PowderException::IncorrectTypeError, - "Wrong type of category."); - } - return categoryIterator->second; -} - -std::string PowderInfoUtil::getContextLabel(const DPL::String &context) const -{ - ContextMap::const_iterator contextIterator = m_contexts.find(context); - if (contextIterator == m_contexts.end()) { - ThrowMsg(PowderException::IncorrectTypeError, "Wrong type of context."); - } - return contextIterator->second; -} - diff --git a/src/misc/wrt_powder_info_util.h b/src/misc/wrt_powder_info_util.h deleted file mode 100644 index cf5da70..0000000 --- a/src/misc/wrt_powder_info_util.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file wrt_powder_info_util.h - * @author Justyna Mejzner (j.kwiatkowsk@samsung.com) - * @version 1.0 - */ - -#ifndef _WRT_SRC_INSTALLERCORE_POWDERINFOUTIL_H_ -#define _WRT_SRC_INSTALLERCORE_POWDERINFOUTIL_H_ - -#include - -#include -#include - -class PowderInfoUtil -{ - public: - class PowderException - { - public: - DECLARE_EXCEPTION_TYPE(DPL::Exception, Base) - DECLARE_EXCEPTION_TYPE(Base, IncorrectTypeError) - }; - - std::string getCategoryLabel(const DPL::String &category) const; - std::string getContextLabel(const DPL::String &context) const; - - private: - PowderInfoUtil(); - friend class DPL::Singleton; - - typedef std::map CategoryMap; - typedef std::map ContextMap; - CategoryMap m_categories; - ContextMap m_contexts; -}; - -typedef DPL::Singleton PowderInfoUtilSingleton; - -#endif /* _WRT_SRC_INSTALLERCORE_POWDERINFOUTIL_H_ */ - diff --git a/src/pkg-manager/backendlib.cpp b/src/pkg-manager/backendlib.cpp old mode 100755 new mode 100644 index 85b2f5d..830ca84 --- a/src/pkg-manager/backendlib.cpp +++ b/src/pkg-manager/backendlib.cpp @@ -25,7 +25,7 @@ #include "package-manager-plugin.h" #include #include -#include +#include #include #include #include @@ -35,8 +35,8 @@ #include #include #include -#include #include +#include using namespace WrtDB; @@ -56,7 +56,7 @@ class DatabaseConnection public: void AttachDatabase() { - WrtDB::WrtDatabase::attachToThread(); + WrtDB::WrtDatabase::attachToThreadRO(); } void DetachDatabase() diff --git a/src/security/ace_settings_logic.cpp b/src/security/ace_settings_logic.cpp index d980f02..5a99390 100644 --- a/src/security/ace_settings_logic.cpp +++ b/src/security/ace_settings_logic.cpp @@ -27,16 +27,16 @@ #include //#include #include -#include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include +#include +#include #include using namespace WrtDB; diff --git a/src/security/ace_settings_logic.h b/src/security/ace_settings_logic.h index fd91399..e3d2877 100644 --- a/src/security/ace_settings_logic.h +++ b/src/security/ace_settings_logic.h @@ -28,7 +28,7 @@ #include #include -#include +#include class PolicyEnforcementPoint; diff --git a/src/security/attribute_facade.cpp b/src/security/attribute_facade.cpp index 72db14b..b0cec79 100644 --- a/src/security/attribute_facade.cpp +++ b/src/security/attribute_facade.cpp @@ -36,13 +36,14 @@ #include #include #include +#include #include #include -#include +#include #include #include #include -#include +#include #include using namespace WrtDB; diff --git a/src/security/attribute_facade.h b/src/security/attribute_facade.h index e3a8cfd..7b6898c 100644 --- a/src/security/attribute_facade.h +++ b/src/security/attribute_facade.h @@ -29,7 +29,7 @@ #include #include -#include +#include class Request; diff --git a/src/security/i_ace_permissions.h b/src/security/i_ace_permissions.h index 3935c9d..9aebf98 100644 --- a/src/security/i_ace_permissions.h +++ b/src/security/i_ace_permissions.h @@ -26,7 +26,7 @@ #define WRT_SRC_ACCESS_CONTROL_I_ACE_PERMISSSIONS_H_ #include -#include +#include namespace AceSettings { diff --git a/src/security/i_ace_settings_client.h b/src/security/i_ace_settings_client.h index d9f6b92..7891c29 100644 --- a/src/security/i_ace_settings_client.h +++ b/src/security/i_ace_settings_client.h @@ -23,7 +23,7 @@ #define WRT_SRC_UI_SHARED_GADGET_IACESETTINGSCLIENT_H_ #include -#include +#include #include #include #include diff --git a/src/security/security_controller.cpp b/src/security/security_controller.cpp index 762a640..ed52509 100644 --- a/src/security/security_controller.cpp +++ b/src/security/security_controller.cpp @@ -27,9 +27,9 @@ */ #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/src/security/security_controller.h b/src/security/security_controller.h index ad0f3d6..83a924c 100644 --- a/src/security/security_controller.h +++ b/src/security/security_controller.h @@ -35,13 +35,13 @@ #include #include #include -#include -#include +#include +#include #include #include -#include +#include namespace Jobs { class Job; diff --git a/src/security/security_logic.cpp b/src/security/security_logic.cpp index 6485201..8e7a364 100644 --- a/src/security/security_logic.cpp +++ b/src/security/security_logic.cpp @@ -27,7 +27,7 @@ * @brief Header file for security logic */ -#include +#include #include #include #ifdef WRT_SMACK_ENABLED diff --git a/src/security/security_logic.h b/src/security/security_logic.h index 12da736..bdab31c 100644 --- a/src/security/security_logic.h +++ b/src/security/security_logic.h @@ -29,12 +29,12 @@ #ifndef SECURITY_LOGIC_H #define SECURITY_LOGIC_H -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include //#include "ace_settings_logic.h" diff --git a/src/wrt-installer/installer_main_thread.cpp b/src/wrt-installer/installer_main_thread.cpp old mode 100755 new mode 100644 index c984769..bf064c5 --- a/src/wrt-installer/installer_main_thread.cpp +++ b/src/wrt-installer/installer_main_thread.cpp @@ -22,7 +22,7 @@ #include "installer_main_thread.h" #include #include -#include +#include #include #include #include @@ -46,9 +46,9 @@ void InstallerMainThread::AttachDatabases() { Assert(!m_attached); // Attach databases - ValidationCore::AttachToThread(); - AceDB::AceDAO::attachToThread(); - WrtDB::WrtDatabase::attachToThread(); + ValidationCore::AttachToThreadRW(); + AceDB::AceDAO::attachToThreadRW(); + WrtDB::WrtDatabase::attachToThreadRW(); m_attached = true; } diff --git a/src/wrt-installer/wrt_installer.cpp b/src/wrt-installer/wrt_installer.cpp index a61292b..b4cf831 100644 --- a/src/wrt-installer/wrt_installer.cpp +++ b/src/wrt-installer/wrt_installer.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -42,6 +43,8 @@ if(pkgmgr_installer_send_signal(installer, PKG_TYPE, pkg_name, key, val)) {\ LogDebug("Failed to send signal to pkgmgr"); \ } +#define NOFILE_CNT_FOR_INSTALLER 9999 + using namespace WrtDB; namespace { // anonymous const char AUL_ARG_KEY[] = "widget_arg"; @@ -115,7 +118,6 @@ void WrtInstaller::OnCreate() } arg = m_argv[1]; - if (arg == "-h" || arg == "--help") { if (m_argc != 2) { return showHelpAndQuit(); @@ -196,13 +198,22 @@ void WrtInstaller::OnCreate() return showHelpAndQuit(); } m_webAppUrl = m_argv[2]; - + // TODO another option for policy? + m_installPolicy = WRT_WIM_POLICY_FORCE_INSTALL; DPL::OptionalString icon = OptionParser::QueryOption(m_argc, m_argv, "--icon"); if (!icon.IsNull()) { + if(icon->empty()) { + return showHelpAndQuit(); + } m_webAppIcon = DPL::ToUTF8String(*icon); + // TODO fix DPL string conversion to get rid of additional space + m_webAppIcon.erase(remove_if(m_webAppIcon.begin(), + m_webAppIcon.end(), + isspace)); } + AddStep(&WrtInstaller::installFromWebStep); } } else if (arg.find("backend") != std::string::npos) { m_installByPkgmgr = true; @@ -363,9 +374,6 @@ void WrtInstaller::initStep() void WrtInstaller::installStep() { LogDebug("Installing widget ..."); - if (!m_quiet) { - m_popup->init(); - } DPL::ScopedFree packagePath(canonicalize_file_name( m_packagePath.c_str())); wrt_install_widget(packagePath ? packagePath.Get() : m_packagePath.c_str(), @@ -455,10 +463,6 @@ void WrtInstaller::installPluginsStep() void WrtInstaller::uninstallStep() { LogDebug("Uninstalling widget ..."); - if (!m_quiet) { - m_popup->init(); - } - wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback, (!m_quiet || m_installByPkgmgr) ? &staticWrtUninstallProgressCallback : NULL); @@ -467,10 +471,6 @@ void WrtInstaller::uninstallStep() void WrtInstaller::uninstallPkgNameStep() { LogDebug("Uninstalling widget ..."); - if (!m_quiet) { - m_popup->init(); - } - WrtErrStatus status = wrt_get_widget_by_pkgname(m_name, &m_handle); if (status == WRT_SUCCESS) { LogDebug("Get Widget Handle by package name : " << m_handle); @@ -488,10 +488,6 @@ void WrtInstaller::uninstallPkgNameStep() void WrtInstaller::uninstallGuidStep() { LogDebug("Uninstalling widget ..."); - if (!m_quiet) { - m_popup->init(); - } - WrtErrStatus status = wrt_get_widget_by_guid(m_name, &m_handle); if (status == WRT_SUCCESS) { LogDebug("Get Widget Handle by guid : " << m_handle); @@ -516,6 +512,26 @@ void WrtInstaller::shutdownStep() } } +void WrtInstaller::installFromWebStep() +{ + LogDebug("Installing widget ..."); + if (!m_quiet) { + m_popup->init(); + } + + DPL::ScopedFree icon(canonicalize_file_name( + m_webAppIcon.c_str())); + + wrt_install_widget_from_browser( + m_webAppUrl.c_str(), + icon ? icon.Get() : m_webAppIcon.c_str(), + this, + &staticWrtStatusCallback, + (!m_quiet || m_installByPkgmgr) ? + &staticWrtInstallProgressCallback : NULL, + m_installPolicy); +} + void WrtInstaller::staticWrtInitCallback(WrtErrStatus status, void* userdata) { @@ -689,6 +705,7 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status, } if (!This->m_quiet) { + This->m_popup->init(); elm_progressbar_value_set(This->m_popup->m_progressbar, 100.0); evas_object_show(This->m_popup->m_popup); } @@ -697,6 +714,7 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status, ::PostEvent(WRTInstallerNS::NextStepEvent()); } else { if (!This->m_quiet) { + This->m_popup->init(); float percent = (This->m_totalPlugins - This->m_numPluginsToInstall)/(float)This->m_totalPlugins; elm_progressbar_value_set(This->m_popup->m_progressbar, percent); evas_object_show(This->m_popup->m_popup); @@ -764,7 +782,7 @@ void WrtInstaller::staticWrtInstallProgressCallback(float percent, WrtInstaller *This = static_cast(userdata); std::stringstream percentStr; LogInfo(" progress: " << percent << - "description " << description); + " description: " << description); if (This->m_installByPkgmgr) { if (This->m_sendSig) { @@ -780,7 +798,7 @@ void WrtInstaller::staticWrtInstallProgressCallback(float percent, This->m_sendSig = false; } - LogDebug("Broadcast Progress, pkgname" << This->m_name); + LogDebug("Broadcast Progress, pkgname " << This->m_name); percentStr << static_cast(percent); PKGMGR_SEND_SIG(This->m_installer, This->m_name.c_str(), @@ -788,6 +806,7 @@ void WrtInstaller::staticWrtInstallProgressCallback(float percent, } if (!This->m_quiet) { + This->m_popup->init(); elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0); evas_object_show(This->m_popup->m_popup); } @@ -798,7 +817,7 @@ void WrtInstaller::staticWrtUninstallProgressCallback(float percent, WrtInstaller *This = static_cast(userdata); std::stringstream percentStr; LogInfo(" progress: " << percent << - "description " << description); + " description: " << description); if (This->m_installByPkgmgr) { if (This->m_sendSig) { @@ -806,7 +825,7 @@ void WrtInstaller::staticWrtUninstallProgressCallback(float percent, PKGMGR_START_KEY, "uninstall"); This->m_sendSig = false; } - LogDebug("Broadcast Progress, pkgname" << This->m_name); + LogDebug("Broadcast Progress, pkgname " << This->m_name); percentStr << static_cast(percent); PKGMGR_SEND_SIG(This->m_installer, This->m_name.c_str(), @@ -814,6 +833,7 @@ void WrtInstaller::staticWrtUninstallProgressCallback(float percent, } if (!This->m_quiet) { + This->m_popup->init(); elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0); evas_object_show(This->m_popup->m_popup); } @@ -835,31 +855,32 @@ void WrtInstaller::InstallerPopup::init() { LogDebug("Window Init"); - // create window - m_win = createWin("wrt-installer"); + if (m_win == NULL) { + // create window + m_win = createWin("wrt-installer"); - // security popup uses installer window - using namespace DPL::Popup; - PopupControllerSingleton::Instance().setExternalCanvas(m_win); - evas_object_show(m_win); + // security popup uses installer window + using namespace DPL::Popup; + PopupControllerSingleton::Instance().setExternalCanvas(m_win); - // create popup - m_popup = elm_popup_add(m_win); + // create popup + m_popup = elm_popup_add(m_win); - // create progressbar - m_progressbar = elm_progressbar_add(m_popup); - elm_object_style_set(m_progressbar, "list_progress"); - elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE); - evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL, + // create progressbar + m_progressbar = elm_progressbar_add(m_popup); + elm_object_style_set(m_progressbar, "list_progress"); + elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE); + evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND, + evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_popup_content_set(m_popup, m_progressbar); - elm_progressbar_value_set(m_progressbar, 0.0); - evas_object_show(m_progressbar); + elm_object_content_set(m_popup, m_progressbar); + elm_progressbar_value_set(m_progressbar, 0.0); + evas_object_show(m_progressbar); - // set progressbar to popup - evas_object_show(m_popup); + evas_object_show(m_popup); + evas_object_show(m_win); + } } Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name) @@ -906,7 +927,7 @@ Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name) xScale = (double)w / BASE_LAYOUT_W; yScale = (double)h / BASE_LAYOUT_H; scale = xScale < yScale ? xScale : yScale; - elm_scale_set(scale); + elm_config_scale_set(scale); return win; } @@ -915,15 +936,31 @@ void WrtInstaller::InstallerPopup::showPopup(void* userdata, const DPL::String& pkgMsg, ShowResultCallback callback) { + Evas_Object *btn; + + LogDebug("Result Popup Created"); evas_object_del(m_popup); m_popup = NULL; - m_popup = elm_popup_with_buttons_add(m_win, "RESULT", - DPL::ToUTF8String(pkgMsg).c_str(), - 1, "OK", 5, NULL); - evas_object_smart_callback_add(m_popup, "response", callback, userdata); + m_popup = elm_popup_add(m_win); + if (!m_popup) + return; + + btn = elm_button_add(m_popup); + if (!btn) { + evas_object_del(m_popup); + return; + } + elm_object_text_set(btn, "OK"); + evas_object_smart_callback_add(btn, "clicked", callback, userdata); + elm_object_part_content_set(m_popup, "button1", btn); + elm_object_part_text_set(m_popup, "title,text", "RESULT"); + elm_object_text_set(m_popup, DPL::ToUTF8String(pkgMsg).c_str()); + evas_object_show(m_popup); + evas_object_show(m_win); + } void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/, @@ -975,11 +1012,21 @@ int main(int argc, char *argv[]) // the output may not be flushed). setlinebuf(stdout); - // enable gl - if (!getenv("ELM_ENGINE")) { - if (setenv("ELM_ENGINE", "gl", 1)) { - LogDebug("Enable gl for HW Accel"); + // Check and re-set the file open limitation + struct rlimit rlim; + if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) { + LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" ); + LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" ); + + if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) { + rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER; + rlim.rlim_max = NOFILE_CNT_FOR_INSTALLER; + if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) { + LogError("setrlimit is fail!!"); + } } + } else { + LogError("getrlimit is fail!!"); } WrtInstaller app(argc, argv); diff --git a/src/wrt-installer/wrt_installer.h b/src/wrt-installer/wrt_installer.h index c043985..04cc672 100644 --- a/src/wrt-installer/wrt_installer.h +++ b/src/wrt-installer/wrt_installer.h @@ -105,6 +105,7 @@ class WrtInstaller : void shutdownStep(); void registerCallbackStep(); void queryListStep(); + void installFromWebStep(); // Static callbacks diff --git a/src/wrt-installer/wrt_installer_api.cpp b/src/wrt-installer/wrt_installer_api.cpp index 7954f01..910a98a 100644 --- a/src/wrt-installer/wrt_installer_api.cpp +++ b/src/wrt-installer/wrt_installer_api.cpp @@ -237,6 +237,12 @@ extern "C" return TRUE; } + // Initialize ValidationCore - this must be done before AttachDatabases + ValidationCore::VCoreInit( + std::string(GlobalConfig::GetFingerprintListFile()), + std::string(GlobalConfig::GetFingerprintListSchema()), + std::string(GlobalConfig::GetVCoreDatabaseFilePath())); + InstallerMainThreadSingleton::Instance().AttachDatabases(); //checking for correct DB version @@ -259,12 +265,6 @@ extern "C" LanguageSubtagRstTreeSingleton::Instance().Initialize(); LocalizationUtils::Initialize(); - // Initialize ValidationCore - ValidationCore::VCoreInit( - std::string(GlobalConfig::GetFingerprintListFile()), - std::string(GlobalConfig::GetFingerprintListSchema()), - std::string(GlobalConfig::GetVCoreDatabaseFilePath())); - // Security Logic initialization CONTROLLER_POST_SYNC_EVENT( SecurityController, @@ -320,6 +320,9 @@ extern "C" InstallerMainThreadSingleton::Instance().DetachDatabases(); + // This must be done after DetachDatabase + ValidationCore::VCoreDeinit(); + // Global deinit check LogInfo("Cleanup libxml2 global values."); xmlCleanupParser(); @@ -379,6 +382,31 @@ extern "C" UNHANDLED_EXCEPTION_HANDLER_END } + EXPORT_API void wrt_install_widget_from_browser( + const char *url, + const char* icon, + void* userdata, + WrtInstallerStatusCallback status_cb, + WrtProgressCallback progress_cb, + wrt_widget_update_mode_t update_mode) + { + UNHANDLED_EXCEPTION_HANDLER_BEGIN + { + LogInfo("[WRT-API] INSTALL WIDGET: " << url); + // Post installation event + CONTROLLER_POST_EVENT( + InstallerController, + InstallerControllerEvents::InstallWidgetFromBrowserEvent( + url, icon, WidgetInstallationStruct( + InstallerCallbacksTranslate::installFinishedCallback, + InstallerCallbacksTranslate::installProgressCallback, + new InstallerCallbacksTranslate::StatusCallbackStruct( + userdata, status_cb, progress_cb), + translateWidgetUpdateMode(update_mode)))); + } + UNHANDLED_EXCEPTION_HANDLER_END + } + EXPORT_API void wrt_install_plugin( const char *pluginDir, void *user_param, diff --git a/src/wrt-installer/wrt_installer_api.h b/src/wrt-installer/wrt_installer_api.h index fe5ca85..bf43a1a 100755 --- a/src/wrt-installer/wrt_installer_api.h +++ b/src/wrt-installer/wrt_installer_api.h @@ -325,6 +325,51 @@ int wrt_installer_init_for_tests(void *userdata, */ void wrt_installer_shutdown_for_tests(); +/** + * @fn void wrt_install_widget_from_web(const char *url, + * const char* icon, + * void *userdata, + * WrtInstallerStatusCallback status_callback, + * WrtProgressCallback progress_callback, + * wrt_widget_update_mode_t update_mode); + * + * @brief Installs widget from given url + * + * This method is used to install widget from a given url. + * + * @param [in] url Widget url + * @param [in] icon Icon url + * @param [in] userdata User parameters to be passed to the callback + * @param [in] status_cb Call to this one will be done at the end of + * operation + * The callback is called in the context of the + * application's + * @param [in] progress_cb Callback function to get data of install + * progress + * If you don't want to get progress data, this + * should be NULL + * @param [in] install_mode Installation mode + * @return Nothing (status returned in callback). + * + * Sample code: + * @code + * wrt_install_widget(url.c_str(), + * icon.c_str(), + * NULL, + * install_cb, + * progress_cb, + * WRT_WIM_POLICY_WAC); + * @endcode + * + * @see wrt_installer_uninstall_widget + */ +void wrt_install_widget_from_browser(const char *url, + const char* icon, + void* userdata, + WrtInstallerStatusCallback status_cb, + WrtProgressCallback progress_cb, + wrt_widget_update_mode_t update_mode); + WrtErrStatus wrt_get_widget_by_pkgname(const std::string pkgname, int *widget_handle); diff --git a/tests/config_generator/xml/test001_basic.xml b/tests/config_generator/xml/test001_basic.xml index 5da8118..b5039b5 100644 --- a/tests/config_generator/xml/test001_basic.xml +++ b/tests/config_generator/xml/test001_basic.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/config_generator/xml/test002_basic.xml b/tests/config_generator/xml/test002_basic.xml index 5e8b8bb..a38742b 100644 --- a/tests/config_generator/xml/test002_basic.xml +++ b/tests/config_generator/xml/test002_basic.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/config_generator/xml/test003_name.xml b/tests/config_generator/xml/test003_name.xml index e4d7069..9b2cc56 100644 --- a/tests/config_generator/xml/test003_name.xml +++ b/tests/config_generator/xml/test003_name.xml @@ -1,5 +1,5 @@ - + example \ No newline at end of file diff --git a/tests/config_generator/xml/test004_description.xml b/tests/config_generator/xml/test004_description.xml index 58c4d14..ac59c80 100644 --- a/tests/config_generator/xml/test004_description.xml +++ b/tests/config_generator/xml/test004_description.xml @@ -1,5 +1,5 @@ - + description \ No newline at end of file diff --git a/tests/config_generator/xml/test005_author.xml b/tests/config_generator/xml/test005_author.xml index b74a0da..28cbc4c 100644 --- a/tests/config_generator/xml/test005_author.xml +++ b/tests/config_generator/xml/test005_author.xml @@ -1,5 +1,5 @@ - + Krzysztof Janiak Krzysztof Janiak diff --git a/tests/config_generator/xml/test006_license.xml b/tests/config_generator/xml/test006_license.xml index bf190c0..1291fe8 100644 --- a/tests/config_generator/xml/test006_license.xml +++ b/tests/config_generator/xml/test006_license.xml @@ -1,5 +1,5 @@ - + Public domain. Apache 2.0 diff --git a/tests/config_generator/xml/test007_icon.xml b/tests/config_generator/xml/test007_icon.xml index 43afca6..f6c04b3 100644 --- a/tests/config_generator/xml/test007_icon.xml +++ b/tests/config_generator/xml/test007_icon.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/config_generator/xml/test008_content.xml b/tests/config_generator/xml/test008_content.xml index b10be8b..be6874e 100644 --- a/tests/config_generator/xml/test008_content.xml +++ b/tests/config_generator/xml/test008_content.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/config_generator/xml/test009_feature.xml b/tests/config_generator/xml/test009_feature.xml index 5413b33..d93d696 100644 --- a/tests/config_generator/xml/test009_feature.xml +++ b/tests/config_generator/xml/test009_feature.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/config_generator/xml/test010_preference.xml b/tests/config_generator/xml/test010_preference.xml index db88274..bcb4e48 100644 --- a/tests/config_generator/xml/test010_preference.xml +++ b/tests/config_generator/xml/test010_preference.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/config_generator/xml/test011_access.xml b/tests/config_generator/xml/test011_access.xml index c609def..ef34cc7 100644 --- a/tests/config_generator/xml/test011_access.xml +++ b/tests/config_generator/xml/test011_access.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/config_generator/xml/test012_tizen_setting.xml b/tests/config_generator/xml/test012_tizen_setting.xml index 9b1f65e..5dde547 100644 --- a/tests/config_generator/xml/test012_tizen_setting.xml +++ b/tests/config_generator/xml/test012_tizen_setting.xml @@ -1,6 +1,6 @@ - + - + \ No newline at end of file -- 2.7.4