ContextInstaller::ContextInstaller()
: manifest_data(static_cast<manifest_x*>(calloc(1, sizeof(manifest_x)))),
old_manifest_data(nullptr),
- uid(getuid()) {}
+ uid(getuid()),
+ backend_data(nullptr) {}
ContextInstaller::~ContextInstaller() {
if (manifest_data.get())
pkgmgr_parser_free_manifest_xml(manifest_data.get());
if (old_manifest_data.get())
pkgmgr_parser_free_manifest_xml(old_manifest_data.get());
+ if (backend_data.get())
+ delete backend_data.get();
}
} // namespace common_installer
#include <memory>
#include <string>
-namespace common_installer {
+#include "common/utils/property.h"
-/** Template class for defining smart attributes.
- *
- * Property should be used when, given attribute needs to have pure
- * setter and getter. This template class will generate getter and setter.
- * It uses operator() overloading.
- */
-template<typename Type>
-class Property {
- public:
- Property() {}
- Property(const Type &val): value_(val) { } // NOLINT
- const Type& get() const { return value_; }
- Type& get() { return value_; }
- void set(const Type &val) { value_ = val; }
- private:
- Type value_;
-};
+namespace common_installer {
class ConfigData {
public:
Property<std::string> required_version;
};
+class BackendData {
+ public:
+ virtual ~BackendData() { }
+};
+
// TODO(p.sikorski@samsung.com) this class should be divided into:
// Base Context class
// CtxInstall class that inherits from Context
// path for the applications root directory
Property<boost::filesystem::path> root_application_path;
+
+ // Backend specific data
+ Property<BackendData*> backend_data;
};
} // namespace common_installer
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef COMMON_UTILS_PROPERTY_H_
+#define COMMON_UTILS_PROPERTY_H_
+
+/** Template class for defining smart attributes.
+ *
+ * Property should be used when, given attribute needs to have pure
+ * setter and getter. This template class will generate getter and setter.
+ * It uses operator() overloading.
+ */
+template<typename Type>
+class Property {
+ public:
+ Property() {}
+ Property(const Type &val): value_(val) { } // NOLINT
+ const Type& get() const { return value_; }
+ Type& get() { return value_; }
+ void set(const Type &val) { value_ = val; }
+ private:
+ Type value_;
+};
+
+#endif // COMMON_UTILS_PROPERTY_H_
step/step_create_symbolic_link.cc
update_workaround.cc
wgt_backend.cc
+ wgt_backend_data.cc
)
IF(WRT_LAUNCHER)
#include "wgt/step/step_parse.h"
-#include <string.h>
+#include <manifest_handlers/application_manifest_constants.h>
+#include <manifest_handlers/appwidget_handler.h>
+#include <manifest_handlers/category_handler.h>
+#include <manifest_handlers/ime_handler.h>
+#include <manifest_handlers/metadata_handler.h>
+#include <manifest_handlers/navigation_handler.h>
+#include <manifest_handlers/setting_handler.h>
+#include <manifest_handlers/splash_screen_handler.h>
+#include <manifest_parser/manifest_handler.h>
+#include <manifest_parser/manifest_constants.h>
#include <pkgmgr/pkgmgr_parser.h>
+#include <string.h>
+
#include <cstdio>
#include <cstdlib>
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "manifest_handlers/application_manifest_constants.h"
-#include "manifest_handlers/appwidget_handler.h"
-#include "manifest_handlers/category_handler.h"
-#include "manifest_handlers/ime_handler.h"
-#include "manifest_handlers/metadata_handler.h"
-#include "manifest_handlers/navigation_handler.h"
-#include "manifest_handlers/setting_handler.h"
-#include "manifest_handlers/splash_screen_handler.h"
-#include "manifest_parser/manifest_handler.h"
-#include "manifest_parser/manifest_constants.h"
+#include "wgt/wgt_backend_data.h"
namespace {
if (perm_info)
permissions = perm_info->GetAPIPermissions();
+ std::unique_ptr<WgtBackendData> backend_data(new WgtBackendData());
+
+ std::shared_ptr<const SettingInfo> settings_info =
+ std::static_pointer_cast<const SettingInfo>(
+ parser_->GetManifestData(
+ wgt::application_widget_keys::kTizenSettingKey));
+ if (settings_info)
+ backend_data->settings.set(*settings_info);
+
+ context_->backend_data.set(backend_data.release());
+
LOG(DEBUG) << " Read data -[ ";
LOG(DEBUG) << "App id: " << info->id();
LOG(DEBUG) << " package = " << info->package();
#include "wgt/update_workaround.h"
-#include "wgt/step/step_parse.h"
#include "wgt/step/step_create_symbolic_link.h"
+#include "wgt/step/step_parse.h"
namespace ci = common_installer;
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "wgt/wgt_backend_data.h"
+
+namespace wgt {
+
+WgtBackendData::WgtBackendData() {
+}
+
+} // namespace wgt
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef WGT_WGT_BACKEND_DATA_H_
+#define WGT_WGT_BACKEND_DATA_H_
+
+#include <manifest_handlers/setting_handler.h>
+
+#include "common/context_installer.h"
+#include "common/utils/property.h"
+
+namespace wgt {
+
+class WgtBackendData : public common_installer::BackendData {
+ public:
+ WgtBackendData();
+
+ Property<parse::SettingInfo> settings;
+};
+
+} // namespace wgt
+
+#endif // WGT_WGT_BACKEND_DATA_H_