* Sets the badge count for the designated application.
*/
BadgeManager.prototype.setBadgeCount = function() {
+ xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
+
if (arguments.length < 2)
throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
'incorrect number of arguments');
* @return {number} long Count of the badge
*/
BadgeManager.prototype.getBadgeCount = function() {
+ xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
+
if (arguments.length < 1)
throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
'incorrect number of arguments');
* Gets the badge count for the designated application.
*/
BadgeManager.prototype.addChangeListener = function() {
+ xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
+
if (arguments.length < 2)
throw new WebAPIException(WebAPIException.TYPE_MISMATCH_ERR,
'incorrect number of arguments');
* Gets the badge count for the designated application.
*/
BadgeManager.prototype.removeChangeListener = function() {
+ xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
+
if (arguments.length < 1)
throw new WebAPIException(WebAPIException.TYPE_MISMATCH_ERR,
'incorrect number of arguments');
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) {
- 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) {
- 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) {
- CHECK_PRIVILEGE_ACCESS(kPrivilegeNotification, &out);
PlatformResult status =
manager_.AddChangeListener(args.get<JsonObject>());
void BadgeInstance::BadgeManagerRemoveChangeListener(const JsonValue& args,
JsonObject& out) {
- CHECK_PRIVILEGE_ACCESS(kPrivilegeNotification, &out);
PlatformResult status =
manager_.RemoveChangeListener(args.get<JsonObject>());