1 // Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_TIZEN_APPWIDGET_HANDLER_H_
6 #define XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_TIZEN_APPWIDGET_HANDLER_H_
12 #include "xwalk/application/common/application_data.h"
13 #include "xwalk/application/common/manifest_handler.h"
16 namespace application {
18 typedef std::map<std::string, std::string> TizenAppWidgetLabelLangValueMap;
20 struct TizenAppWidgetLabel {
22 std::string default_value;
24 // may be empty if default is set
25 TizenAppWidgetLabelLangValueMap lang_value_map;
28 enum TizenAppWidgetSizeType {
32 struct TizenAppWidgetSize {
34 TizenAppWidgetSizeType type;
36 // optional, relative to web app directory
39 // optional, default: true
43 typedef std::vector<TizenAppWidgetSize> TizenAppWidgetSizeVector;
45 struct TizenAppWidgetDropView {
46 // mandatory, relative to web app directory or remote URL
52 // mandatory, <1, 380>
56 typedef std::vector<TizenAppWidgetDropView> TizenAppWidgetDropViewVector;
58 struct TizenAppWidget {
59 // mandatory, unique, must start with application id and end with label
60 // separated with dot, the label can contain only 0-9, a-z, A-Z
63 // mandatory, only one may contain true
66 // optional(0-1), min: 1800.0, default: no update
67 std::vector<double> update_period;
69 // optional, default: false
72 // box label, multiple(1+)
73 TizenAppWidgetLabel label;
75 // box icon, optional(0-1), src, mandatory, relative to web app directory
78 // box content, mandatory(1) -[
80 // mandatory, relative to web app directory or remote URL
81 std::string content_src;
83 // optional, default: false
84 bool content_mouse_event;
86 // optional, default: true
87 bool content_touch_effect;
89 // box size, mandatory(1-3), 1x1 must exist
90 TizenAppWidgetSizeVector content_size;
92 // drop view, optional(0-1)
93 TizenAppWidgetDropViewVector content_drop_view;
98 typedef std::vector<TizenAppWidget> TizenAppWidgetVector;
100 class TizenAppWidgetInfo : public ApplicationData::ManifestData {
102 explicit TizenAppWidgetInfo(const TizenAppWidgetVector& app_widgets);
103 virtual ~TizenAppWidgetInfo();
105 const TizenAppWidgetVector& app_widgets() const {
111 TizenAppWidgetVector app_widgets_;
114 class TizenAppWidgetHandler : public ManifestHandler {
116 TizenAppWidgetHandler();
117 virtual ~TizenAppWidgetHandler();
119 bool Parse(scoped_refptr<ApplicationData> application,
120 base::string16* error) override;
121 bool Validate(scoped_refptr<const ApplicationData> application,
122 std::string* error) const override;
123 std::vector<std::string> Keys() const override;
126 DISALLOW_COPY_AND_ASSIGN(TizenAppWidgetHandler);
129 } // namespace application
132 #endif // XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_TIZEN_APPWIDGET_HANDLER_H_