application_manifest_constants.cc
application_icons_handler.cc
appwidget_handler.cc
+ background_category_handler.cc
category_handler.cc
content_handler.cc
csp_handler.cc
const char kTizenApplicationPackageKey[] = "@package";
const char kAllowNavigationKey[] = "widget.allow-navigation";
+const char kTizenBackgroundCategoryKey[] = "widget.background-category";
const char kTizenSettingKey[] = "widget.setting";
const char kTizenInstallLocationKey[] = "@install-location";
const char kTizenUserAgentKey[] = "@user-agent";
extern const char kTizenApplicationAppControlsKey[];
extern const char kTizenApplicationKey[];
extern const char kTizenAppWidgetFullKey[];
+extern const char kTizenBackgroundCategoryKey[];
extern const char kTizenCategoryKey[];
extern const char kTizenContentKey[];
extern const char kTizenImeKey[];
--- /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-xwalk file.
+
+#include "manifest_handlers/background_category_handler.h"
+
+#include "manifest_handlers/application_manifest_constants.h"
+
+namespace {
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kTizenBackgroundCategoryValueKey[] = "@value";
+const char kErrMsgElementParse[] = "Parsing background-category element failed";
+} // namespace
+
+namespace wgt {
+namespace parse {
+
+namespace keys = wgt::application_widget_keys;
+
+bool BackgroundCategoryHandler::ParseBackgroundCategoryElement(
+ const parser::DictionaryValue& element_dict,
+ BackgroundCategoryInfoList* bclist) {
+ std::string value;
+
+ if (!element_dict.GetString(kTizenBackgroundCategoryValueKey, &value))
+ return false;
+
+ bclist->background_categories.emplace_back(value);
+
+ return true;
+}
+
+bool BackgroundCategoryHandler::Parse(
+ const parser::Manifest& manifest,
+ std::shared_ptr<parser::ManifestData>* output,
+ std::string* error) {
+ if (!manifest.HasPath(keys::kTizenBackgroundCategoryKey))
+ return true;
+
+ std::shared_ptr<BackgroundCategoryInfoList> bclist(
+ new BackgroundCategoryInfoList());
+
+ for (const auto& dict : parser::GetOneOrMany(manifest.value(),
+ keys::kTizenBackgroundCategoryKey, kTizenNamespacePrefix)) {
+ if (!ParseBackgroundCategoryElement(*dict, bclist.get())) {
+ *error = kErrMsgElementParse;
+ return false;
+ }
+ }
+
+ *output = std::static_pointer_cast<parser::ManifestData>(bclist);
+ return true;
+}
+
+std::string BackgroundCategoryHandler::Key() const {
+ return keys::kTizenBackgroundCategoryKey;
+}
+
+BackgroundCategoryInfo::BackgroundCategoryInfo(const std::string& value) :
+ value_(value) {}
+
+} // namespace parse
+} // namespace wgt
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE-xwalk file.
+
+#ifndef MANIFEST_HANDLERS_BACKGROUND_CATEGORY_HANDLER_H_
+#define MANIFEST_HANDLERS_BACKGROUND_CATEGORY_HANDLER_H_
+
+#include <string>
+#include <vector>
+
+#include "manifest_parser/manifest_handler.h"
+
+namespace wgt {
+namespace parse {
+
+/**
+ * \brief Holds details about background-category element
+ *
+ * Purpose of this class is to hold information declared in background-category
+ * element in manifest xml document
+ */
+class BackgroundCategoryInfo : public parser::ManifestData {
+ public:
+ explicit BackgroundCategoryInfo(const std::string& value);
+ virtual ~BackgroundCategoryInfo() {}
+
+ const std::string& value() const { return value_; }
+
+ private:
+ std::string value_;
+};
+
+/**
+ * \brief Container for detailed information of each declaration of
+ * background-category element
+ */
+struct BackgroundCategoryInfoList : public parser::ManifestData {
+ std::vector<BackgroundCategoryInfo> background_categories;
+};
+
+/**
+ * \brief The BackgroundCategoryHandler class
+ *
+ * Handler of config.xml for xml elements:
+ * - <tizen:background-category>.
+ */
+class BackgroundCategoryHandler : 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;
+
+ private:
+ bool ParseBackgroundCategoryElement(
+ const parser::DictionaryValue& element_dict,
+ BackgroundCategoryInfoList* bclist);
+};
+
+} // namespace parse
+} // namespace wgt
+
+#endif // MANIFEST_HANDLERS_BACKGROUND_CATEGORY_HANDLER_H_
#include "manifest_handlers/application_icons_handler.h"
#include "manifest_handlers/application_manifest_constants.h"
#include "manifest_handlers/appwidget_handler.h"
+#include "manifest_handlers/background_category_handler.h"
#include "manifest_handlers/category_handler.h"
#include "manifest_handlers/content_handler.h"
#include "manifest_handlers/csp_handler.h"
new SplashScreenHandler,
new TizenApplicationHandler,
new WarpHandler,
- new WidgetHandler
+ new WidgetHandler,
+ new BackgroundCategoryHandler
};
std::unique_ptr<parser::ManifestHandlerRegistry> registry(