[Widget] Initial commit.
authorTomasz Marciniak <t.marciniak@samsung.com>
Tue, 23 Feb 2016 13:58:05 +0000 (14:58 +0100)
committerLukasz Bardeli <l.bardeli@samsung.com>
Thu, 14 Apr 2016 09:32:06 +0000 (11:32 +0200)
[Verification] Code compiles.

Change-Id: Ice74943c7da19a19c0616968167f4b59df394283
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
packaging/webapi-plugins.spec
src/tizen-wrt.gyp
src/widget/widget.gyp [new file with mode: 0644]
src/widget/widget_api.js [new file with mode: 0755]
src/widget/widget_extension.cc [new file with mode: 0755]
src/widget/widget_extension.h [new file with mode: 0755]
src/widget/widget_instance.cc [new file with mode: 0755]
src/widget/widget_instance.h [new file with mode: 0755]

index 1f81cab78b9b3f3fbe5a6cfb2d0b31b021722248..e897ae6446364488b46b72df16e27d0e7f54dfd5 100644 (file)
@@ -97,6 +97,7 @@ Source0:    %{name}-%{version}.tar.gz
 %endif
 %define tizen_feature_time_support                    1
 %define tizen_feature_web_setting_support             1
+%define tizen_feature_widget_support                  0
 %if 0%{?tizen_is_emulator}
 %define tizen_feature_wi_fi_support                   0
 %else
@@ -193,6 +194,7 @@ Source0:    %{name}-%{version}.tar.gz
 %define tizen_feature_telephony_support               0
 %define tizen_feature_time_support                    1
 %define tizen_feature_web_setting_support             0
+%define tizen_feature_widget_support                  0
 %define tizen_feature_wi_fi_support                   1
 %define tizen_feature_inputdevice_support             1
 %define tizen_feature_tvinputdevice_support           0
@@ -257,6 +259,7 @@ Source0:    %{name}-%{version}.tar.gz
 %define tizen_feature_telephony_support               0
 %define tizen_feature_time_support                    1
 %define tizen_feature_web_setting_support             1
+%define tizen_feature_widget_support                  0
 %define tizen_feature_wi_fi_support                   1
 %define tizen_feature_inputdevice_support             0
 %define tizen_feature_tvinputdevice_support           1
@@ -297,6 +300,7 @@ BuildRequires: pkgconfig(capi-appfw-package-manager)
 BuildRequires: pkgconfig(capi-content-media-content)
 BuildRequires: pkgconfig(capi-media-metadata-extractor)
 BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(widget_service)
 
 %if %{with wayland}
 %define display_type wayland
@@ -496,6 +500,7 @@ GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_telephony_support=%{?tizen_feature_tel
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_time_support=%{?tizen_feature_time_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_inputdevice_support=%{?tizen_feature_inputdevice_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_web_setting_support=%{?tizen_feature_web_setting_support}"
+GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_widget_support=%{?tizen_feature_widget_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_wi_fi_support=%{?tizen_feature_wi_fi_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_tvinputdevice_support=%{?tizen_feature_tvinputdevice_support}"
 
index 65659deb2be3e478d25f5584847152314e1ca427..1f1f240c3f41553a82baca21636063b51a68666f 100755 (executable)
             ],
           },
         ],
+        [
+          'tizen_feature_widget_support==1', {
+            'dependencies': [
+              'widget/widget.gyp:*',
+            ],
+          },
+        ],
       ], # end conditions
     },
   ], # end targets
diff --git a/src/widget/widget.gyp b/src/widget/widget.gyp
new file mode 100644 (file)
index 0000000..305fd65
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  'includes':[
+    '../common/common.gypi',
+  ],
+  'targets': [
+    {
+      'target_name': 'tizen_widget',
+      'type': 'loadable_module',
+      'dependencies': [
+        '../common/common.gyp:tizen_common',
+      ],
+      'sources': [
+        'widget_api.js',
+        'widget_extension.cc',
+        'widget_extension.h',
+        'widget_instance.cc',
+        'widget_instance.h',
+      ],
+      'conditions': [
+        ['tizen == 1', {
+          'variables': {
+            'packages': [
+              'widget_service',
+            ]
+          },
+        }],
+      ],
+    },
+  ],
+}
diff --git a/src/widget/widget_api.js b/src/widget/widget_api.js
new file mode 100755 (executable)
index 0000000..bef94fd
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+var validator = xwalk.utils.validator;
+var converter = xwalk.utils.converter;
+var type = xwalk.utils.type;
+var native = new xwalk.utils.NativeManager(extension);
+
+function WidgetManager() {
+}
+
+//Exports
+exports = new WidgetManager();
diff --git a/src/widget/widget_extension.cc b/src/widget/widget_extension.cc
new file mode 100755 (executable)
index 0000000..9381b49
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include "widget/widget_extension.h"
+
+#include "widget/widget_instance.h"
+
+// This will be generated from widget_api.js
+extern const char kSource_widget_api[];
+
+common::Extension* CreateExtension() {
+  return new WidgetExtension;
+}
+
+WidgetExtension::WidgetExtension() {
+  SetExtensionName("tizen.widget");
+  SetJavaScriptAPI(kSource_widget_api);
+}
+
+WidgetExtension::~WidgetExtension() {}
+
+common::Instance* WidgetExtension::CreateInstance() {
+  return new extension::widget::WidgetInstance();
+}
diff --git a/src/widget/widget_extension.h b/src/widget/widget_extension.h
new file mode 100755 (executable)
index 0000000..0d9d461
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#ifndef WIDGET_WIDGET_EXTENSION_H_
+#define WIDGET_WIDGET_EXTENSION_H_
+
+#include "common/extension.h"
+
+class WidgetExtension : public common::Extension {
+ public:
+  WidgetExtension();
+  virtual ~WidgetExtension();
+
+ private:
+  virtual common::Instance* CreateInstance();
+};
+
+#endif  // WIDGET_WIDGET_EXTENSION_H_
diff --git a/src/widget/widget_instance.cc b/src/widget/widget_instance.cc
new file mode 100755 (executable)
index 0000000..8ad28c0
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include "widget/widget_instance.h"
+
+namespace extension {
+namespace widget {
+
+namespace {
+const std::string kPrivilegeWidget = "http://tizen.org/privilege/widget.viewer";
+
+}  // namespace
+
+WidgetInstance::WidgetInstance() {
+  ScopeLogger();
+  using std::placeholders::_1;
+  using std::placeholders::_2;
+
+#define REGISTER_SYNC(c,x) \
+  RegisterSyncHandler(c, std::bind(&WidgetInstance::x, this, _1, _2));
+
+#undef REGISTER_SYNC
+
+#define REGISTER_ASYNC(c, x) \
+  RegisterHandler(c, std::bind(&WidgetInstance::x, this, _1, _2));
+
+#undef REGISTER_ASYNC
+}
+
+WidgetInstance::~WidgetInstance() {
+  ScopeLogger();
+}
+
+} // namespace widget
+} // namespace extension
diff --git a/src/widget/widget_instance.h b/src/widget/widget_instance.h
new file mode 100755 (executable)
index 0000000..7f1e3a1
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#ifndef WIDGET_WIDGET_INSTANCE_H_
+#define WIDGET_WIDGET_INSTANCE_H_
+
+#include "common/tizen_instance.h"
+
+namespace extension {
+namespace widget {
+
+class WidgetInstance : public common::TizenInstance {
+ public:
+  WidgetInstance();
+  virtual ~WidgetInstance();
+
+};
+
+} // namespace widget
+} // namespace extension
+
+#endif // WIDGET_WIDGET_INSTANCE_H_