--- /dev/null
+{
+ 'includes':[
+ '../common/common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'tizen_badge',
+ 'type': 'loadable_module',
+ 'sources': [
+ 'badge_api.js',
+ 'badge_extension.cc',
+ 'badge_extension.h',
+ 'badge_instance.cc',
+ 'badge_instance.h',
+ 'badge_manager.cc',
+ 'badge_manager.h',
+ ],
+ 'conditions': [
+ ['tizen == 1', {
+ 'variables': {
+ 'packages': [
+ 'vconf',
+ ]
+ },
+ }],
+ ],
+ },
+ ],
+}
--- /dev/null
+/* global xwalk, extension, tizen */
+
+// Copyright 2014 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 file.
+
+var validator_ = xwalk.utils.validator;
+var types_ = validator_.Types;
+var native_ = new xwalk.utils.NativeManager(extension);
+
+/**
+ * This class provides functions to request and release badge resource.
+ * @constructor
+ */
+function BadgeManager() {
+}
+
+/**
+ * Sets the badge count for the designated application.
+ * @param {!ApplicationId} ID of the application to update the badge
+ * @param {!number} Number to display as the badge on the application icon
+ */
+BadgeManager.prototype.setBadgeCount = function() {
+ throw new tizen.WebAPIException(tizen.WebAPIException.UNKNOWN_ERROR, 'Not implemented');
+}
+
+/**
+ * Gets the badge count for the designated application.
+ * @param {!ApplicationId} ID of the designated application
+ * @return {number} long Count of the badge
+ */
+BadgeManager.prototype.getBadgeCount = function() {
+ throw new tizen.WebAPIException(tizen.WebAPIException.UNKNOWN_ERROR, 'Not implemented');
+}
+
+/**
+ * Gets the badge count for the designated application.
+ * @param {!ApplicationId} Array of the ID of the designated application
+ * @param {!function} Callback method to be invoked when a badge number change notification is received
+ */
+BadgeManager.prototype.addChangeListener = function() {
+ throw new tizen.WebAPIException(tizen.WebAPIException.UNKNOWN_ERROR, 'Not implemented');
+}
+
+/**
+ * Gets the badge count for the designated application.
+ * @param {!ApplicationId} Array of the ID of the designated application
+ */
+BadgeManager.prototype.removeChangeListener = function() {
+ throw new tizen.WebAPIException(tizen.WebAPIException.UNKNOWN_ERROR, 'Not implemented');
+}
+
+exports.badge = new BadgeManager();
--- /dev/null
+// Copyright 2014 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 file.
+
+#include "badge/badge_extension.h"
+
+#include "badge/badge_instance.h"
+
+// This will be generated from badge_api.js
+extern const char kSource_badge_api[];
+
+common::Extension* CreateExtension() { return new BadgeExtension; }
+
+BadgeExtension::BadgeExtension() {
+ SetExtensionName("tizen.badge");
+ SetJavaScriptAPI(kSource_badge_api);
+}
+
+BadgeExtension::~BadgeExtension() {}
+
+common::Instance* BadgeExtension::CreateInstance() {
+ return new extension::badge::BadgeInstance;
+}
--- /dev/null
+// Copyright 2014 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 file.
+
+#ifndef BADGE_BADGE_EXTENSION_H_
+#define BADGE_BADGE_EXTENSION_H_
+
+#include "common/extension.h"
+
+class BadgeExtension : public common::Extension {
+ public:
+ BadgeExtension();
+ virtual ~BadgeExtension();
+
+ private:
+ virtual common::Instance* CreateInstance();
+};
+
+#endif // BADGE_BADGE_EXTENSION_H_
--- /dev/null
+// Copyright 2014 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 file.
+
+#include "badge/badge_instance.h"
+
+#include "common/picojson.h"
+#include "common/logger.h"
+#include "common/platform_exception.h"
+
+namespace extension {
+namespace badge {
+
+namespace {
+// The privileges that required in Badge API
+const std::string kPrivilegeBadge = "http://tizen.org/privilege/badge";
+
+} // namespace
+
+using namespace common;
+using namespace extension::badge;
+
+BadgeInstance::BadgeInstance() {
+ using namespace std::placeholders;
+#define REGISTER_SYNC(c, x) \
+ RegisterSyncHandler(c, std::bind(&BadgeInstance::x, this, _1, _2));
+
+#undef REGISTER_SYNC
+}
+
+BadgeInstance::~BadgeInstance() {}
+
+} // namespace badge
+} // namespace extension
--- /dev/null
+// Copyright 2014 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 file.
+
+#ifndef BADGE_BADGE_INSTANCE_H_
+#define BADGE_BADGE_INSTANCE_H_
+
+#include "common/extension.h"
+
+namespace extension {
+namespace badge {
+
+class BadgeInstance : public common::ParsedInstance {
+ public:
+ BadgeInstance();
+ virtual ~BadgeInstance();
+
+};
+
+} // namespace badge
+} // namespace extension
+
+#endif // BADGE_BADGE_INSTANCE_H_
--- /dev/null
+// Copyright 2014 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 file.
+
+#include "badge_manager.h"
+
+#include <cstring>
+
+#include "common/logger.h"
+#include "common/platform_exception.h"
+
+using namespace common;
+
+namespace extension {
+namespace badge {
+
+BadgeManager::BadgeManager() {}
+
+BadgeManager::~BadgeManager() {}
+
+BadgeManager* BadgeManager::GetInstance() {
+ static BadgeManager instance;
+ return &instance;
+}
+
+void setBadgeCount(std::string appId, long count) {
+ throw UnknownException("Not implemented.");
+}
+
+long getBadgeCount(std::string appId) {
+ throw UnknownException("Not implemented.");
+}
+
+} // namespace badge
+} // namespace extension
--- /dev/null
+// Copyright 2014 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 file.
+
+#ifndef BADGE_BADGE_MANAGER_H_
+#define BADGE_BADGE_MANAGER_H_
+
+#include <string>
+
+namespace extension {
+namespace badge {
+
+class BadgeManager {
+ public:
+ BadgeManager();
+ ~BadgeManager();
+ BadgeManager* GetInstance();
+
+ void setBadgeCount(std::string appId, long count);
+ long getBadgeCount(std::string appId);
+};
+
+} // namespace badge
+} // namespace extension
+
+#endif // BADGE_BADGE_MANAGER_H_
[
'extension_host_os == "mobile"', {
'dependencies': [
+ 'badge/badge.gyp:*',
'callhistory/callhistory.gyp:*',
'contact/contact.gyp:*',
'calendar/calendar.gyp:*',