* Sets the badge count for the designated application.
*/
BadgeManager.prototype.setBadgeCount = function() {
- xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
-
var args = validator_.validateArgs(arguments, [
{name: 'appId', type: types_.STRING},
{name: 'count', type: types_.LONG}
* @return {number} long Count of the badge
*/
BadgeManager.prototype.getBadgeCount = function() {
- xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
-
var args = validator_.validateArgs(arguments, [
{name: 'appId', type: types_.STRING}
]);
* Gets the badge count for the designated application.
*/
BadgeManager.prototype.addChangeListener = function() {
- xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
-
var args = validator_.validateArgs(arguments, [
{
name: 'appIdList',
* Gets the badge count for the designated application.
*/
BadgeManager.prototype.removeChangeListener = function() {
- xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
-
var args = validator_.validateArgs(arguments, [
{
name: 'appIdList',
#include "badge/badge_instance.h"
#include "common/converter.h"
+#include "common/tools.h"
namespace extension {
namespace badge {
+namespace {
+// The privileges that required in Badge API
+const std::string kPrivilegeNotification = "http://tizen.org/privilege/notification";
+
+} // namespace
+
using namespace common;
using namespace extension::badge;
void BadgeInstance::BadgeManagerSetBadgeCount(const JsonValue& args,
JsonObject& out) {
LoggerD("Enter");
+ CHECK_PRIVILEGE_ACCESS(kPrivilegeNotification, &out);
+
std::string app_id =
common::FromJson<std::string>(args.get<JsonObject>(), "appId");
const double count = args.get("count").get<double>();
void BadgeInstance::BadgeManagerGetBadgeCount(const JsonValue& args,
JsonObject& out) {
LoggerD("Enter");
+ CHECK_PRIVILEGE_ACCESS(kPrivilegeNotification, &out);
+
std::string app_id =
common::FromJson<std::string>(args.get<JsonObject>(), "appId");
void BadgeInstance::BadgeManagerAddChangeListener(const JsonValue& args,
JsonObject& out) {
LoggerD("Enter");
+ CHECK_PRIVILEGE_ACCESS(kPrivilegeNotification, &out);
+
PlatformResult status =
manager_.AddChangeListener(args.get<JsonObject>());
void BadgeInstance::BadgeManagerRemoveChangeListener(const JsonValue& args,
JsonObject& out) {
LoggerD("Enter");
+ CHECK_PRIVILEGE_ACCESS(kPrivilegeNotification, &out);
+
PlatformResult status =
manager_.RemoveChangeListener(args.get<JsonObject>());