TV profile has forked wgt-manifest-handlers separately in github.
Thus, there are migration or maintenance issues sometimes.
Because the code difference is not large, it is better to use it
as one branch.
Change-Id: Ibb18fb5cfe79343b77a98205da443428b62349ca
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
Name: wgt-manifest-handlers
Summary: wgt-manifest-handlers
-Version: 1.9.0
+Version: 1.9.1
Release: 1
Group: Application Framework/Package Management
License: Apache-2.0 and BSD-3-Clause
launch_screen_handler.cc
splash_screen_handler.cc
tizen_application_handler.cc
+ video_splash_screen_handler.cc
warp_handler.cc
widget_config_parser.cc
widget_handler.cc
// launch_screen
const char kLaunchScreenKey[] = "widget.launch_screen";
+// video_splash_screen
+const char kVideoSplashScreenKey[] = "widget.video_splash_screen";
} // namespace application_widget_keys
extern const char kWidgetKey[];
extern const char kLaunchScreenKey[];
extern const char kTizenTrustAnchorKey[];
+extern const char kVideoSplashScreenKey[];
} // namespace application_widget_keys
const std::vector<std::string> GetElementsWithDifferentAttributeLength();
namespace wgt {
namespace parse {
-enum class ReadyWhen { FIRSTPAINT, COMPLETE, CUSTOM };
+enum class ReadyWhen { FIRSTPAINT, COMPLETE, CUSTOM, VIDEOFINISHED };
enum class ScreenOrientation { AUTO, PORTRAIT, LANDSCAPE, NONE };
std::vector<std::string> image_border;
std::vector<std::pair<std::string, boost::optional<int>>> images;
std::vector<std::pair<std::string, boost::optional<int>>> background_images;
+ std::string video;
};
class LaunchScreenInfo : public parser::ManifestData {
std::string* error) override;
std::string Key() const override;
- private:
- bool ParseSingleOrientation(const parser::Manifest& manifest,
- ScreenOrientation orientation,
- LaunchScreenInfo* ls_info);
+ protected:
bool ParseElement(const parser::DictionaryValue* dict,
std::vector<std::string>* to_be_saved,
const char* keyToParse);
std::vector<std::pair<std::string,
boost::optional<int>>>* to_be_saved,
const char* keyToParse);
- bool ParseReadyWhen(const parser::Manifest& manifest,
- LaunchScreenInfo* ls_info);
bool ParseColor(const parser::DictionaryValue* dict,
LaunchScreenData* launch_screen);
+
+ private:
+ bool ParseSingleOrientation(const parser::Manifest& manifest,
+ ScreenOrientation orientation,
+ LaunchScreenInfo* ls_info);
+ bool ParseReadyWhen(const parser::Manifest& manifest,
+ LaunchScreenInfo* ls_info);
};
} // namespace parse
const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
const char kTizenSettingKey[] = "widget.setting";
const char kTizenLongPollingKey[] = "@long-polling";
+const char kTizenPointingDeviceSupport[] = "@pointing-device-support";
+
const utils::VersionNumber kDefaultAutoOrientationVersion("3.0");
bool ForAllFindKey(const parser::Value* value, const std::string& key,
*error = "Long polling value is out of range";
return false;
}
+
+ std::string pointing_device_option;
+ ForAllFindKey(value, kTizenPointingDeviceSupport, &pointing_device_option);
+ app_info->set_pointing_device_option(pointing_device_option);
}
*output = std::static_pointer_cast<parser::ManifestData>(app_info);
*/
boost::optional<unsigned int> long_polling() const { return long_polling_; }
+ /**
+ * @brief set_pointing_device_option
+ * @param pointing device option
+ */
+ void set_pointing_device_option(std::string& option) {
+ pointing_device_option_ = option;
+ }
+
+ /**
+ * @brief pointing_device_option
+ * @return pointing device option value
+ */
+ std::string pointing_device_option() const { return pointing_device_option_; }
+
private:
bool hwkey_enabled_;
ScreenOrientation screen_orientation_;
bool background_vibration_;
bool orientation_defaulted_;
boost::optional<unsigned int> long_polling_;
+ std::string pointing_device_option_;
};
/**
--- /dev/null
+// Copyright (c) 2018 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.
+
+#include <cassert>
+#include <cstdlib>
+#include <map>
+#include <string>
+#include <utility>
+
+#include "manifest_parser/utils/logging.h"
+#include "wgt_manifest_handlers/application_manifest_constants.h"
+#include "wgt_manifest_handlers/video_splash_screen_handler.h"
+
+namespace keys = wgt::application_widget_keys;
+namespace wgt_parse = wgt::parse;
+
+namespace {
+
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kTagDelimiter[] = " ";
+const char kImageDelimiter[] = ",";
+const char kFirstPaint[] = "first-paint";
+const char kComplete[] = "complete";
+const char kCustom[] = "custom";
+const char kVideoFinished[] = "video-finished";
+const char kVideoSplashScreenDefault[] =
+ "widget.video_splash_screen.vss_default";
+const char kVideoSplashScreenPortrait[] =
+ "widget.video_splash_screen.vss_portrait";
+const char kVideoSplashScreenLandscape[] =
+ "widget.video_splash_screen.vss_landscape";
+const char kVideoSplashScreenKey[] = "widget.video_splash_screen";
+const char kVideoSplashScreenReadyWhen[] = "@ready_when";
+const char kVideoSplashScreenBgColor[] = "@background_color";
+const char kVideoSplashScreenBgImage[] = "@background_image";
+const char kVideoSplashScreenImage[] = "@image";
+const char kVideoSplashScreenImageBorder[] = "@image_border";
+const char kVideoSplashScreenVideo[] = "@video";
+const std::map<wgt_parse::ScreenOrientation, const char*> kOrientationMap = {
+ {wgt_parse::ScreenOrientation::AUTO, kVideoSplashScreenDefault},
+ {wgt_parse::ScreenOrientation::LANDSCAPE, kVideoSplashScreenLandscape},
+ {wgt_parse::ScreenOrientation::PORTRAIT, kVideoSplashScreenPortrait}};
+
+} // namespace
+
+namespace wgt {
+namespace parse {
+
+std::string VideoSplashScreenInfo::Key() {
+ return kVideoSplashScreenKey;
+}
+
+bool VideoSplashScreenHandler::ParseSingleOrientation(
+ const parser::Manifest& manifest, ScreenOrientation orientation,
+ VideoSplashScreenInfo* vss_info) {
+ auto dict_element_parser =
+ [this](LaunchScreenData& video_splash_screen,
+ const parser::DictionaryValue* dict) -> bool {
+ if (!parser::VerifyElementNamespace(*dict, kTizenNamespacePrefix))
+ return false;
+ bool result = ParseColor(dict, &video_splash_screen);
+ if (!result)
+ return false;
+
+ result = ParseImages(dict, &video_splash_screen.background_images,
+ kVideoSplashScreenBgImage);
+ if (!result)
+ return false;
+
+ result = ParseImages(dict, &video_splash_screen.images,
+ kVideoSplashScreenImage);
+ if (!result)
+ return false;
+
+ result = ParseVideo(dict, video_splash_screen.video);
+ if (!result)
+ return false;
+
+ result = ParseElement(dict, &video_splash_screen.image_border,
+ kVideoSplashScreenImageBorder);
+ if (!result)
+ return false;
+
+ return !!video_splash_screen.background_color
+ || !video_splash_screen.background_images.empty()
+ || !video_splash_screen.images.empty();
+ };
+
+ auto orientation_chosen = kOrientationMap.at(orientation);
+
+
+ auto& dict_element =
+ parser::GetOneOrMany(manifest.value(),
+ orientation_chosen,
+ kTizenNamespacePrefix);
+ if (dict_element.empty())
+ return true;
+
+ if (dict_element.size() > 1)
+ return false;
+
+ LaunchScreenData video_splash_screen;
+ if (!dict_element_parser(video_splash_screen, dict_element[0]))
+ return false;
+
+ vss_info->set_launch_screen_data(std::make_pair(orientation, video_splash_screen));
+ return true;
+}
+
+
+bool VideoSplashScreenHandler::ParseReadyWhen(const parser::Manifest& manifest,
+ VideoSplashScreenInfo* vss_info) {
+ auto dict_values = parser::GetOneOrMany(manifest.value(),
+ kVideoSplashScreenKey,
+ kTizenNamespacePrefix);
+ if (dict_values.empty())
+ return false;
+
+ std::string ready_when;
+ dict_values[0]->GetString(kVideoSplashScreenReadyWhen, &ready_when);
+
+ if (ready_when.empty()) {
+ ready_when = kFirstPaint;
+ }
+ if (ready_when != kFirstPaint && ready_when != kComplete &&
+ ready_when != kCustom && ready_when != kVideoFinished)
+ return false;
+
+ if (ready_when == kFirstPaint) {
+ vss_info->set_ready_when(ReadyWhen::FIRSTPAINT);
+ } else if (ready_when == kComplete) {
+ vss_info->set_ready_when(ReadyWhen::COMPLETE);
+ } else if (ready_when == kCustom) {
+ vss_info->set_ready_when(ReadyWhen::CUSTOM);
+ } else if (ready_when == kVideoFinished) {
+ vss_info->set_ready_when(ReadyWhen::VIDEOFINISHED);
+ }
+ return true;
+}
+
+bool VideoSplashScreenHandler::ParseVideo(const parser::DictionaryValue* dict,
+ std::string& to_be_saved) {
+ std::string element;
+ if (!dict->GetString(kVideoSplashScreenVideo, &element))
+ return false;
+ to_be_saved = element;
+ return true;
+}
+
+
+bool VideoSplashScreenHandler::Parse(const parser::Manifest& manifest,
+ std::shared_ptr<parser::ManifestData>* output,
+ std::string* error) {
+ auto vss_info = std::make_shared<VideoSplashScreenInfo>();
+ if (!ParseReadyWhen(manifest, vss_info.get())) return false;
+
+ if (!ParseSingleOrientation(manifest, ScreenOrientation::AUTO,
+ vss_info.get())) {
+ *error = "Failed to parse video splash screen default orientation";
+ return false;
+ }
+ if (!ParseSingleOrientation(manifest, ScreenOrientation::LANDSCAPE,
+ vss_info.get())) {
+ *error = "Failed to parse video splash screen landscape orientation";
+ return false;
+ }
+ if (!ParseSingleOrientation(manifest, ScreenOrientation::PORTRAIT,
+ vss_info.get())) {
+ *error = "Failed to parse video splash screen portrait orientation";
+ return false;
+ }
+ *output = std::static_pointer_cast<parser::ManifestData>(vss_info);
+ return true;
+}
+
+
+std::string VideoSplashScreenHandler::Key() const {
+ return kVideoSplashScreenKey;
+}
+
+} // namespace parse
+} // namespace wgt
--- /dev/null
+// Copyright (c) 2018 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 WGT_MANIFEST_HANDLERS_VIDEO_SPLASH_SCREEN_HANDLER_H_
+#define WGT_MANIFEST_HANDLERS_VIDEO_SPLASH_SCREEN_HANDLER_H_
+
+#include <map>
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "manifest_parser/manifest_handler.h"
+#include "manifest_parser/values.h"
+#include "wgt_manifest_handlers/launch_screen_handler.h"
+#include "wgt_manifest_handlers/setting_handler.h"
+
+namespace wgt {
+namespace parse {
+
+class VideoSplashScreenInfo : public LaunchScreenInfo {
+ public:
+ VideoSplashScreenInfo() = default;
+ virtual ~VideoSplashScreenInfo() = default;
+ static std::string Key();
+};
+
+/**
+ * @brief The VideoSplashScreenHandler class
+ *
+ * Handler of config.xml for xml elements:
+ * - <tizen:video_splash_screen>.
+ */
+class VideoSplashScreenHandler : public LaunchScreenHandler {
+ public:
+ VideoSplashScreenHandler() = default;
+ virtual ~VideoSplashScreenHandler() = default;
+ bool Parse(const parser::Manifest& manifest,
+ std::shared_ptr<parser::ManifestData>* output,
+ std::string* error) override;
+ std::string Key() const override;
+
+ private:
+ bool ParseSingleOrientation(const parser::Manifest& manifest,
+ ScreenOrientation orientation,
+ VideoSplashScreenInfo* vss_info);
+ bool ParseReadyWhen(const parser::Manifest& manifest,
+ VideoSplashScreenInfo* vss_info);
+ bool ParseVideo(const parser::DictionaryValue* dict,
+ std::string& to_be_saved);
+};
+
+} // namespace parse
+} // namespace wgt
+
+
+#endif // WGT_MANIFEST_HANDLERS_VIDEO_SPLASH_SCREEN_HANDLER_H_
bool CheckW3CContentSrcExists(const bf::path& widget_path,
const std::string& content) {
if (!content.empty()) {
- if (FindFilesWithinWidget(widget_path, content) == FindResult::OK) {
+ auto tmg_content = std::string(content).append(".spm");
+ if (FindFilesWithinWidget(widget_path, content) == FindResult::OK ||
+ FindFilesWithinWidget(widget_path, tmg_content) == FindResult::OK) {
return true;
}
}
// http://www.w3.org/TR/widgets/#step-8-locate-the-start-file
bool CheckStartFileInWidget(const bf::path& widget_path) {
for (auto& file : kDefaultStartFiles) {
- if (FindFilesWithinWidget(widget_path, file) == FindResult::OK) {
+ auto tmg_file = std::string(file).append(".spm");
+ if (FindFilesWithinWidget(widget_path, file) == FindResult::OK ||
+ FindFilesWithinWidget(widget_path, tmg_file) == FindResult::OK) {
LOG(INFO) << "Start file is: " << file;
return true;
}
for (auto& service_info : service_list.services) {
bf::path start_file = widget_path / service_info.content();
- if (!bf::exists(start_file)) {
+ bf::path start_file_tmg = widget_path / (service_info.content() + ".spm");
+ if (!bf::exists(start_file) && !bf::exists(start_file_tmg)) {
*error = std::string("Could not find valid service start file: ")
+ start_file.string();
return false;
#include "wgt_manifest_handlers/launch_screen_handler.h"
#include "wgt_manifest_handlers/splash_screen_handler.h"
#include "wgt_manifest_handlers/tizen_application_handler.h"
+#include "wgt_manifest_handlers/video_splash_screen_handler.h"
#include "wgt_manifest_handlers/warp_handler.h"
#include "wgt_manifest_handlers/widget_handler.h"
#include "wgt_manifest_handlers/w3c_pc_utils.h"
std::make_shared<AppDefinedPrivilegeHandler>(),
std::make_shared<ProvidesAppDefinedPrivilegeHandler>(),
std::make_shared<TrustAnchorHandler>(),
- std::make_shared<AddonHandler>()
+ std::make_shared<AddonHandler>(),
+ std::make_shared<VideoSplashScreenHandler>()
};
std::unique_ptr<parser::ManifestHandlerRegistry> registry(
}
bool WidgetConfigParser::CheckSplashAndLaunchScreenOccurences() {
- return parser_->GetManifestData(SplashScreenInfo::Key()) &&
- parser_->GetManifestData(LaunchScreenInfo::Key());
+ return parser_->GetManifestData(SplashScreenInfo::Key()) &&
+ (parser_->GetManifestData(LaunchScreenInfo::Key()) ||
+ parser_->GetManifestData(VideoSplashScreenInfo::Key()));
}
+
bool WidgetConfigParser::ParseManifest(const boost::filesystem::path& path) {
widget_path_ = path.parent_path();
std::shared_ptr<parser::ManifestConstraints> constraints(