--- /dev/null
+// Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "tpk_manifest_handlers/light_user_handler.h"
+
+#include "manifest_parser/values.h"
+
+namespace tpk {
+namespace parse {
+
+namespace {
+
+const char kLightUserKey[] = "manifest.light-user";
+const char kLightUserSwitchModeKey[] = "@switch-mode";
+
+void ParseLightUserAndStore(
+ const parser::DictionaryValue& light_user_dict,
+ LightUserInfo* light_user) {
+ std::string switch_mode;
+ light_user_dict.GetString(kLightUserSwitchModeKey, &switch_mode);
+ light_user->set_switch_mode(switch_mode);
+}
+
+} // namespace
+
+bool LightUserHandler::Parse(
+ const parser::Manifest& manifest,
+ std::shared_ptr<parser::ManifestData>* output,
+ std::string* /*error*/) {
+ std::shared_ptr<LightUserInfo> light_user(new LightUserInfo());
+
+ auto items = parser::GetOneOrMany(manifest.value(), kLightUserKey, "");
+ if (items.empty())
+ return true;
+
+ ParseLightUserAndStore(*items[0], light_user.get());
+
+ *output = std::static_pointer_cast<parser::ManifestData>(light_user);
+ return true;
+}
+
+std::string LightUserInfo::Key() {
+ return kLightUserKey;
+}
+
+std::string LightUserHandler::Key() const {
+ return kLightUserKey;
+}
+
+} // namespace parse
+} // namespace tpk
--- /dev/null
+// Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef TPK_MANIFEST_HANDLERS_LIGHT_USER_HANDLER_H_
+#define TPK_MANIFEST_HANDLERS_LIGHT_USER_HANDLER_H_
+
+#include <memory>
+#include <string>
+
+#include "manifest_parser/manifest_handler.h"
+
+namespace tpk {
+namespace parse {
+
+class LightUserInfo : public parser::ManifestData {
+ public:
+ /**
+ * @brief key
+ * @param key string
+ */
+ static std::string Key();
+ /**
+ * @brief set_switch_mode sets switch_mode
+ * @param switch_mode
+ */
+ void set_switch_mode(std::string switch_mode) {
+ switch_mode_ = std::move(switch_mode);
+ }
+ /**
+ * @brief switch_mode
+ * @return switch_mode string
+ */
+ const std::string& switch_mode() const {
+ return switch_mode_;
+ }
+
+ private:
+ std::string switch_mode_;
+};
+
+/**
+ * @brief The LightUserHandler class
+ *
+ * Handler of tizen-manifest.xml for xml elements:
+ * <light-user>
+ */
+class LightUserHandler : public parser::ManifestHandler {
+ public:
+ bool Parse(
+ const parser::Manifest& manifest,
+ std::shared_ptr<parser::ManifestData>* output,
+ std::string* error) override;
+ std::string Key() const override;
+};
+
+} // namespace parse
+} // namespace tpk
+
+#endif // TPK_MANIFEST_HANDLERS_LIGHT_USER_HANDLER_H_
#include "tpk_manifest_handlers/dependencies_handler.h"
#include "tpk_manifest_handlers/description_handler.h"
#include "tpk_manifest_handlers/feature_handler.h"
+#include "tpk_manifest_handlers/light_user_handler.h"
#include "tpk_manifest_handlers/package_handler.h"
#include "tpk_manifest_handlers/privileges_handler.h"
#include "tpk_manifest_handlers/profile_handler.h"
std::make_shared<TrustAnchorHandler>(),
std::make_shared<DependenciesHandler>(),
std::make_shared<ComponentBasedApplicationHandler>(),
+ std::make_shared<LightUserHandler>(),
};
std::unique_ptr<parser::ManifestHandlerRegistry> registry(