From: Piotr Kosko
Date: Wed, 15 Jul 2020 05:10:46 +0000 (+0200)
Subject: [Bookmark] Removed whole implementation of module.
X-Git-Tag: submit/tizen/20200730.063627~2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F238558%2F1;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Bookmark] Removed whole implementation of module.
By HQ decision whole module was removed.
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-266
[Verification] Code compiles without errors.
Change-Id: Icff7a08dfb7250c2029de677be0373236e98812f
---
diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec
index 2f832a5e..7265ef0d 100644
--- a/packaging/webapi-plugins.spec
+++ b/packaging/webapi-plugins.spec
@@ -30,7 +30,6 @@ Source0: %{name}-%{version}.tar.gz
%define tizen_common_feature_archive_support 0
%define tizen_common_feature_badge_support 0
%define tizen_common_feature_bluetooth_support 1
-%define tizen_common_feature_bookmark_support 0
%define tizen_common_feature_calendar_support 0
%define tizen_common_feature_callhistory_support 0
%define tizen_common_feature_contact_support 0
@@ -89,7 +88,6 @@ Source0: %{name}-%{version}.tar.gz
%define tizen_mobile_feature_archive_support 1
%define tizen_mobile_feature_badge_support 1
%define tizen_mobile_feature_bluetooth_support 1
-%define tizen_mobile_feature_bookmark_support 1
%define tizen_mobile_feature_calendar_support 1
%define tizen_mobile_feature_contact_support 1
%define tizen_mobile_feature_content_support 1
@@ -199,9 +197,6 @@ Source0: %{name}-%{version}.tar.gz
%define tizen_wearable_feature_bluetooth_support 1
-# Bookmark API is optional in Tizen Wearable Profile.
-%define tizen_wearable_feature_bookmark_support 0
-
# Calendar API is mandatory in Tizen Wearable Profile.
%define tizen_wearable_feature_calendar_support 1
%define tizen_wearable_feature_contact_support 1
@@ -286,7 +281,6 @@ Source0: %{name}-%{version}.tar.gz
%define tizen_tv_feature_archive_support 1
%define tizen_tv_feature_badge_support 0
%define tizen_tv_feature_bluetooth_support 1
-%define tizen_tv_feature_bookmark_support 0
%define tizen_tv_feature_calendar_support 0
%define tizen_tv_feature_callhistory_support 0
%define tizen_tv_feature_contact_support 0
@@ -348,7 +342,6 @@ Source0: %{name}-%{version}.tar.gz
%define tizen_feature_archive_support %{expand:%tizen_%{?profile}_feature_archive_support}
%define tizen_feature_badge_support %{expand:%tizen_%{?profile}_feature_badge_support}
%define tizen_feature_bluetooth_support %{expand:%tizen_%{?profile}_feature_bluetooth_support}
-%define tizen_feature_bookmark_support %{expand:%tizen_%{?profile}_feature_bookmark_support}
%define tizen_feature_calendar_support %{expand:%tizen_%{?profile}_feature_calendar_support}
%define tizen_feature_contact_support %{expand:%tizen_%{?profile}_feature_contact_support}
%define tizen_feature_content_support %{expand:%tizen_%{?profile}_feature_content_support}
@@ -474,11 +467,6 @@ BuildRequires: pkgconfig(capi-context)
BuildRequires: pkgconfig(capi-appfw-app-control)
%endif
-%if "%{?tizen_feature_bookmark_support}" == "1" || "%{?unified_build}" == "1"
-BuildRequires: pkgconfig(capi-web-bookmark)
-BuildRequires: pkgconfig(bookmark-adaptor)
-%endif
-
%if "%{?tizen_feature_datacontrol_support}" == "1" || "%{?unified_build}" == "1"
BuildRequires: pkgconfig(capi-data-control)
%endif
@@ -706,7 +694,6 @@ GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_application_support=%{?tizen_mobile_fe
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_archive_support=%{?tizen_mobile_feature_archive_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_badge_support=%{?tizen_mobile_feature_badge_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bluetooth_support=%{?tizen_mobile_feature_bluetooth_support}"
-GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bookmark_support=%{?tizen_mobile_feature_bookmark_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_calendar_support=%{?tizen_mobile_feature_calendar_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_callhistory_support=%{?tizen_mobile_feature_callhistory_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_contact_support=%{?tizen_mobile_feature_contact_support}"
@@ -797,7 +784,6 @@ GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_application_support=%{?tizen_mobile_fe
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_archive_support=%{?tizen_mobile_feature_archive_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_badge_support=%{?tizen_mobile_feature_badge_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bluetooth_support=%{?tizen_mobile_feature_bluetooth_support}"
-GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bookmark_support=%{?tizen_mobile_feature_bookmark_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_calendar_support=%{?tizen_mobile_feature_calendar_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_callhistory_support=%{?tizen_mobile_feature_callhistory_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_contact_support=%{?tizen_mobile_feature_contact_support}"
@@ -876,7 +862,6 @@ GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_application_support=%{?tizen_wearable_
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_archive_support=%{?tizen_wearable_feature_archive_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_badge_support=%{?tizen_wearable_feature_badge_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bluetooth_support=%{?tizen_wearable_feature_bluetooth_support}"
-GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bookmark_support=%{?tizen_wearable_feature_bookmark_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_calendar_support=%{?tizen_wearable_feature_calendar_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_callhistory_support=%{?tizen_wearable_feature_callhistory_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_contact_support=%{?tizen_wearable_feature_contact_support}"
@@ -962,7 +947,6 @@ GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_application_support=%{?tizen_wearable_
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_archive_support=%{?tizen_wearable_feature_archive_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_badge_support=%{?tizen_wearable_feature_badge_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bluetooth_support=%{?tizen_wearable_feature_bluetooth_support}"
-GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bookmark_support=%{?tizen_wearable_feature_bookmark_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_calendar_support=%{?tizen_wearable_feature_calendar_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_callhistory_support=%{?tizen_wearable_feature_callhistory_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_contact_support=%{?tizen_wearable_feature_contact_support}"
@@ -1041,7 +1025,6 @@ GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_application_support=%{?tizen_tv_featur
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_archive_support=%{?tizen_tv_feature_archive_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_badge_support=%{?tizen_tv_feature_badge_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bluetooth_support=%{?tizen_tv_feature_bluetooth_support}"
-GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bookmark_support=%{?tizen_tv_feature_bookmark_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_calendar_support=%{?tizen_tv_feature_calendar_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_callhistory_support=%{?tizen_tv_feature_callhistory_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_contact_support=%{?tizen_tv_feature_contact_support}"
@@ -1118,7 +1101,6 @@ GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_application_support=%{?tizen_common_fe
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_archive_support=%{?tizen_common_feature_archive_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_badge_support=%{?tizen_common_feature_badge_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bluetooth_support=%{?tizen_common_feature_bluetooth_support}"
-GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bookmark_support=%{?tizen_common_feature_bookmark_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_calendar_support=%{?tizen_common_feature_calendar_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_callhistory_support=%{?tizen_common_feature_callhistory_support}"
GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_contact_support=%{?tizen_common_feature_contact_support}"
diff --git a/src/bookmark/bookmark.gyp b/src/bookmark/bookmark.gyp
deleted file mode 100644
index 5d1af2fb..00000000
--- a/src/bookmark/bookmark.gyp
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- 'includes':[
- '../common/common.gypi',
- ],
- 'targets': [
- {
- 'target_name': 'tizen_bookmark',
- 'type': 'loadable_module',
- 'dependencies': [
- '../common/common.gyp:tizen_common',
- ],
- 'sources': [
- 'bookmark_api.js',
- 'bookmark_extension.cc',
- 'bookmark_extension.h',
- 'bookmark_instance.cc',
- 'bookmark_instance.h',
- ],
- 'conditions': [
- ['tizen == 1', {
- 'variables': {
- 'packages': [
- 'bookmark-adaptor',
- ]
- },
- }],
- ],
- },
- ],
-}
diff --git a/src/bookmark/bookmark_api.js b/src/bookmark/bookmark_api.js
deleted file mode 100755
index 6e38b603..00000000
--- a/src/bookmark/bookmark_api.js
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * Copyright (c) 2015 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 types_ = validator_.Types;
-var native_ = new xwalk.utils.NativeManager(extension);
-var privUtils_ = xwalk.utils;
-
-function EditManager() {
- this.canEdit = false;
-}
-
-EditManager.prototype.allow = function() {
- this.canEdit = true;
-};
-
-EditManager.prototype.disallow = function() {
- this.canEdit = false;
-};
-
-var _edit = new EditManager();
-
-function BookmarkManager() {}
-
-BookmarkManager.prototype.get = function() {
- privUtils_.printDeprecationWarningFor('Bookmark API');
- var args = validator_.validateArgs(arguments, [
- {
- name: 'parentFolder',
- type: types_.PLATFORM_OBJECT,
- values: [tizen.BookmarkFolder, tizen.BookmarkItem],
- optional: true,
- nullable: true
- },
- {
- name: 'recursive',
- type: types_.BOOLEAN,
- optional: true,
- nullable: true
- }
- ]);
- var result;
-
- if (arguments.length === 0 || args.parentFolder === null) {
- result = provider.getFolderItems(provider.getRootId(), args.recursive);
- if (!result) throw new WebAPIException(WebAPIException.NOT_FOUND_ERR);
- return result;
- }
- if (args.parentFolder.id === null || args.parentFolder.id === 0)
- throw new WebAPIException(WebAPIException.NOT_FOUND_ERR);
-
- result = provider.getFolderItems(args.parentFolder.id, args.recursive);
- if (!result) throw new WebAPIException(WebAPIException.NOT_FOUND_ERR);
- return result;
-};
-
-BookmarkManager.prototype.add = function() {
- privUtils_.printDeprecationWarningFor('Bookmark API');
- var args = validator_.validateArgs(arguments, [
- {
- name: 'bookmark',
- type: types_.PLATFORM_OBJECT,
- values: [tizen.BookmarkFolder, tizen.BookmarkItem],
- optional: false,
- nullable: false
- },
- {
- name: 'parentFolder',
- type: types_.PLATFORM_OBJECT,
- values: tizen.BookmarkFolder,
- optional: true,
- nullable: true
- }
- ]);
- if (arguments.length == 1 || args.parentFolder === null) {
- if (args.bookmark.id) {
- throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR);
- }
-
- provider.addToFolder(args.bookmark, provider.getRootId());
- return;
- }
- if (!args.parentFolder.id) {
- throw new WebAPIException(WebAPIException.NOT_FOUND_ERR);
- }
-
- provider.addToFolder(args.bookmark, args.parentFolder.id);
-};
-
-BookmarkManager.prototype.remove = function() {
- privUtils_.printDeprecationWarningFor('Bookmark API');
- var args = validator_.validateArgs(arguments, [
- {
- name: 'bookmark',
- type: types_.PLATFORM_OBJECT,
- values: [tizen.BookmarkFolder, tizen.BookmarkItem],
- optional: true,
- nullable: true
- }
- ]);
-
- if (!arguments.length || args.bookmark === null) {
- var result = native_.callSync('BookmarkRemoveAll');
- if (native_.isFailure(result)) {
- throw native_.getErrorObject(result);
- }
- return;
- }
-
- if (!args.bookmark.id) {
- throw new WebAPIException(WebAPIException.UNKNOWN_ERR);
- }
-
- var result = native_.isFailure(
- native_.callSync('BookmarkRemove', { id: args.bookmark.id })
- );
- if (native_.isFailure(result)) {
- throw native_.getErrorObject(result);
- }
-
- _edit.allow();
- args.bookmark.id = null;
- args.bookmark.parent = undefined;
- _edit.disallow();
-};
-
-function BookmarkProvider() {}
-
-BookmarkProvider.prototype.addToFolder = function() {
- privUtils_.printDeprecationWarningFor('Bookmark API');
- var args = validator_.validateArgs(arguments, [
- {
- name: 'bookmark',
- type: types_.PLATFORM_OBJECT,
- values: [tizen.BookmarkFolder, tizen.BookmarkItem],
- optional: true,
- nullable: true
- },
- {
- name: 'parentId',
- type: types_.DOUBLE,
- optional: false,
- nullable: false
- }
- ]);
- var ret = native_.callSync('BookmarkAdd', {
- title: args.bookmark.title,
- url: String(args.bookmark.url),
- parentId: args.parentId,
- type: args.bookmark instanceof tizen.BookmarkFolder
- });
-
- if (native_.isFailure(ret)) {
- throw native_.getErrorObject(ret);
- }
-
- var ret_id = native_.getResultObject(ret);
- _edit.allow();
- args.bookmark.id = ret_id;
- args.bookmark.parent = this.getFolder(args.parentId);
- _edit.disallow();
-};
-
-BookmarkProvider.prototype.getFolder = function() {
- privUtils_.printDeprecationWarningFor('Bookmark API');
- var args = validator_.validateArgs(arguments, [
- {
- name: 'id',
- type: types_.DOUBLE,
- optional: false,
- nullable: false
- }
- ]);
- if (arguments.length === 0 || args.id <= 0) return null;
- if (args.id == this.getRootId()) return null;
-
- var ret = native_.callSync('BookmarkGet', {
- id: args.id,
- shouldGetItems: false
- });
-
- if (native_.isFailure(ret)) {
- throw native_.getErrorObject(ret);
- }
-
- var folder = native_.getResultObject(ret);
- if (folder === undefined || folder === null) {
- throw new WebAPIException(WebAPIException.UNKNOWN_ERR);
- }
-
- var obj = new tizen.BookmarkFolder(folder[0].title);
- obj.id = folder[0].id;
- obj.parent = this.getFolder(folder[0].parentId);
- return obj;
-};
-
-BookmarkProvider.prototype.getFolderItems = function() {
- privUtils_.printDeprecationWarningFor('Bookmark API');
- var args = validator_.validateArgs(arguments, [
- {
- name: 'id',
- type: types_.DOUBLE,
- optional: false,
- nullable: false
- },
- {
- name: 'recursive',
- type: types_.BOOLEAN,
- optional: true,
- nullable: true
- }
- ]);
-
- var ret = native_.callSync('BookmarkGet', {
- id: Number(args.id),
- shouldGetItems: true
- });
-
- if (native_.isFailure(ret)) {
- throw native_.getErrorObject(ret);
- }
-
- var folder = native_.getResultObject(ret);
- if (folder === undefined) {
- throw new WebAPIException(WebAPIException.UNKNOWN_ERR);
- }
-
- var item;
- var obj;
- var result = [];
- var len = folder.length;
-
- for (var i = 0; (item = folder[i]), i < len; i++) {
- if (Number(item.type) === 0) obj = new tizen.BookmarkItem(item.title, item.url);
- else obj = new tizen.BookmarkFolder(item.title);
-
- _edit.allow();
- obj.id = item.id;
- obj.parent = this.getFolder(item.parentId);
- _edit.disallow();
- result.push(obj);
-
- if (args.recursive && Number(item.type) !== 0)
- result = result.concat(this.getFolderItems(item.id, true));
- }
- return result;
-};
-
-BookmarkProvider.prototype.getRootId = function() {
- privUtils_.printDeprecationWarningFor('Bookmark API');
- var ret = native_.callSync('BookmarkGetRootId');
- if (native_.isFailure(ret)) {
- throw native_.getErrorObject(ret);
- }
- var rootId = native_.getResultObject(ret);
- return Number(rootId);
-};
-
-var provider = new BookmarkProvider();
-
-tizen.BookmarkItem = function() {
- privUtils_.printDeprecationWarningFor('Bookmark API');
- validator_.isConstructorCall(this, tizen.BookmarkItem);
- var args = validator_.validateArgs(arguments, [
- {
- name: 'title',
- type: types_.STRING,
- optional: false
- },
- {
- name: 'url',
- type: types_.STRING,
- optional: false
- }
- ]);
- var parent_;
- var id_ = null;
-
- Object.defineProperties(this, {
- parent: {
- get: function() {
- return parent_;
- },
- set: function(new_parent) {
- if (_edit.canEdit) parent_ = new_parent;
- },
- enumerable: true,
- nullable: true
- },
- title: {
- get: function() {
- return args.title;
- },
- enumerable: true,
- nullable: false
- },
- url: {
- get: function() {
- if (args.url === 'undefined') args.url = undefined;
- return args.url;
- },
- enumerable: true,
- nullable: false
- },
- id: {
- get: function() {
- return id_;
- },
- set: function(new_id) {
- if (_edit.canEdit) id_ = new_id;
- },
- enumerable: false,
- nullable: true
- }
- });
-};
-
-tizen.BookmarkFolder = function() {
- privUtils_.printDeprecationWarningFor('Bookmark API');
- validator_.isConstructorCall(this, tizen.BookmarkFolder);
- var args = validator_.validateArgs(arguments, [
- {
- name: 'title',
- type: types_.STRING,
- optional: false,
- nullable: false
- }
- ]);
-
- var parent_;
- var id_ = null;
-
- Object.defineProperties(this, {
- parent: {
- get: function() {
- return parent_;
- },
- set: function(new_parent) {
- if (_edit.canEdit) parent_ = new_parent;
- },
- enumerable: true,
- nullable: true
- },
- title: {
- get: function() {
- return args.title;
- },
- enumerable: true,
- nullable: false
- },
- id: {
- get: function() {
- return id_;
- },
- set: function(new_id) {
- if (_edit.canEdit) id_ = new_id;
- },
- enumerable: false,
- nullable: true
- }
- });
-};
-exports = new BookmarkManager();
diff --git a/src/bookmark/bookmark_extension.cc b/src/bookmark/bookmark_extension.cc
deleted file mode 100644
index 9769d74c..00000000
--- a/src/bookmark/bookmark_extension.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2015 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 "bookmark/bookmark_extension.h"
-#include "bookmark/bookmark_instance.h"
-#include "common/logger.h"
-
-namespace {
-constexpr char kBookmark[] = "tizen.bookmark";
-constexpr char kBookmarkItem[] = "tizen.BookmarkItem";
-constexpr char kBookmarkFolder[] = "tizen.BookmarkFolder";
-}
-
-// This will be generated from bookmark_api.js.
-extern const char kSource_bookmark_api[];
-
-common::Extension* CreateExtension() {
- return new BookmarkExtension;
-}
-
-BookmarkExtension::BookmarkExtension() {
- SetExtensionName(kBookmark);
- SetJavaScriptAPI(kSource_bookmark_api);
-
- const char* entry_points[] = {kBookmarkItem, kBookmarkFolder, nullptr};
- SetExtraJSEntryPoints(entry_points);
-}
-
-BookmarkExtension::~BookmarkExtension() {
-}
-
-common::Instance* BookmarkExtension::CreateInstance() {
- return new extension::bookmark::BookmarkInstance;
-}
diff --git a/src/bookmark/bookmark_extension.h b/src/bookmark/bookmark_extension.h
deleted file mode 100755
index c2b1ffc5..00000000
--- a/src/bookmark/bookmark_extension.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2015 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 BOOKMARK_BOOKMARK_EXTENSION_H_
-#define BOOKMARK_BOOKMARK_EXTENSION_H_
-
-#include "common/extension.h"
-
-class BookmarkExtension : public common::Extension {
- public:
- BookmarkExtension();
- virtual ~BookmarkExtension();
-
- private:
- virtual common::Instance* CreateInstance();
-};
-
-#endif // BOOKMARK_BOOKMARK_EXTENSION_H_
diff --git a/src/bookmark/bookmark_instance.cc b/src/bookmark/bookmark_instance.cc
deleted file mode 100644
index eefb2e89..00000000
--- a/src/bookmark/bookmark_instance.cc
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright (c) 2015 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 "bookmark/bookmark_instance.h"
-
-#include
-#include
-
-#include "common/converter.h"
-#include "common/logger.h"
-#include "common/platform_exception.h"
-#include "common/tools.h"
-
-using common::ErrorCode;
-using common::PlatformResult;
-using namespace common::tools;
-
-namespace extension {
-namespace bookmark {
-
-namespace {
-constexpr char kId[] = "id";
-constexpr char kTitle[] = "title";
-constexpr char kType[] = "type";
-constexpr char kParentId[] = "parentId";
-constexpr char kUrl[] = "url";
-constexpr char kShouldGetItems[] = "shouldGetItems";
-
-constexpr char kPrivilegeBookmarkRead[] = "http://tizen.org/privilege/bookmark.read";
-constexpr char kPrivilegeBookmarkWrite[] = "http://tizen.org/privilege/bookmark.write";
-} // namespace
-
-BookmarkInstance::BookmarkInstance() {
- ScopeLogger();
- using std::placeholders::_1;
- using std::placeholders::_2;
-
-#define REGISTER_METHOD(M) RegisterSyncHandler(#M, std::bind(&BookmarkInstance::M, this, _1, _2))
-
- REGISTER_METHOD(BookmarkGet);
- REGISTER_METHOD(BookmarkAdd);
- REGISTER_METHOD(BookmarkRemove);
- REGISTER_METHOD(BookmarkRemoveAll);
- REGISTER_METHOD(BookmarkGetRootId);
-
-#undef REGISTER_METHOD
-
- if (bp_bookmark_adaptor_initialize()) {
- LoggerE("bp_bookmark_adaptor_initialize failed.");
- }
-}
-
-BookmarkInstance::~BookmarkInstance() {
- ScopeLogger();
- if (bp_bookmark_adaptor_deinitialize()) {
- LoggerE("bp_bookmark_adaptor_deinitialize failed.");
- }
-}
-
-bool BookmarkInstance::bookmark_foreach(Context& ctx, bp_bookmark_info_fmt& info) {
- ScopeLogger();
- int ids_count = 0;
- int* ids = nullptr;
- if (bp_bookmark_adaptor_get_ids_p(&ids, &ids_count, -1, 0, -1, -1, -1, -1,
- BP_BOOKMARK_O_DATE_CREATED, 0) < 0) {
- return false;
- }
- ctx.folders.reserve(ids_count);
- std::unique_ptr ids_ptr(ids, free);
- for (int i = 0; i < ids_count; ++i) {
- if (bp_bookmark_adaptor_get_easy_all(ids[i], &info) < 0) {
- int errorcode = bp_bookmark_adaptor_get_errorcode();
- LoggerW("bp_bookmark_adaptor_get_easy_all for id %d returns error: %d", ids[i], errorcode);
- continue;
- }
- if ((ctx.shouldGetItems && info.parent != ctx.id) ||
- (!ctx.shouldGetItems && ids[i] != ctx.id)) {
- continue;
- }
- ctx.folders.push_back({ids[i], info});
- }
- return true;
-}
-
-PlatformResult BookmarkInstance::BookmarkUrlExists(const char* url, bool* exists) {
- ScopeLogger();
- int ids_count = 0;
- int* ids = nullptr;
- int ntv_ret = bp_bookmark_adaptor_get_ids_p(&ids, // ids
- &ids_count, // count
- -1, // limit
- 0, // offset
- -1, // parent
- -1, // type
- -1, // is_operator
- -1, // is_editable
- BP_BOOKMARK_O_DATE_CREATED, // order_offset
- 0); // ordering ASC
- if (ntv_ret < 0) {
- return LogAndCreateResult(
- ErrorCode::UNKNOWN_ERR, "Failed to obtain bookmarks",
- ("bp_bookmark_adaptor_get_ids_p error: %d (%s)", ntv_ret, get_error_message(ntv_ret)));
- }
- std::unique_ptr ids_ptr(ids, free);
- for (int i = 0; i < ids_count; ++i) {
- char* compare_url = nullptr;
- ntv_ret = bp_bookmark_adaptor_get_url(ids[i], &compare_url);
- if (ntv_ret < 0) {
- PlatformResult result = LogAndCreateResult(
- ErrorCode::UNKNOWN_ERR, "Failed to obtain URL",
- ("bp_bookmark_adaptor_get_url error: %d (%s)", ntv_ret, get_error_message(ntv_ret)));
- return result;
- }
- std::unique_ptr bookmark_url(compare_url, free);
- if (0 == strcmp(url, compare_url)) {
- *exists = true;
- return PlatformResult{ErrorCode::NO_ERROR};
- }
- }
- *exists = false;
- return PlatformResult{ErrorCode::NO_ERROR};
-}
-
-PlatformResult BookmarkInstance::BookmarkTitleExistsInParent(const char* title, int parent,
- bool* exists) {
- ScopeLogger();
- int ids_count = 0;
- int* ids = nullptr;
- int ntv_ret = bp_bookmark_adaptor_get_ids_p(&ids, // ids
- &ids_count, // count
- -1, // limit
- 0, // offset
- -1, // parent
- -1, // type
- -1, // is_operator
- -1, // is_editable
- BP_BOOKMARK_O_DATE_CREATED, // order_offset
- 0); // ordering ASC
- if (ntv_ret < 0) {
- return LogAndCreateResult(
- ErrorCode::UNKNOWN_ERR, "Failed to obtain bookmarks",
- ("bp_bookmark_adaptor_get_ids_p error: %d (%s)", ntv_ret, get_error_message(ntv_ret)));
- }
- std::unique_ptr ids_ptr(ids, free);
- for (int i = 0; i < ids_count; ++i) {
- int compare_parent = -1;
- ntv_ret = bp_bookmark_adaptor_get_parent_id(ids[i], &compare_parent);
- if (ntv_ret < 0) {
- PlatformResult result =
- LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Failed to obtain parent ID",
- ("bp_bookmark_adaptor_get_parent_id error: %d (%s)", ntv_ret,
- get_error_message(ntv_ret)));
- return result;
- }
- char* compare_title = nullptr;
- ntv_ret = bp_bookmark_adaptor_get_title(ids[i], &compare_title);
- if (ntv_ret < 0) {
- PlatformResult result = LogAndCreateResult(
- ErrorCode::UNKNOWN_ERR, "Failed to obtain title",
- ("bp_bookmark_adaptor_get_title error: %d (%s)", ntv_ret, get_error_message(ntv_ret)));
- return result;
- }
- std::unique_ptr bookmark_url(compare_title, free);
- if (parent == compare_parent && 0 == strcmp(title, compare_title)) {
- *exists = true;
- return PlatformResult{ErrorCode::NO_ERROR};
- }
- }
- *exists = false;
- return PlatformResult{ErrorCode::NO_ERROR};
-}
-
-void BookmarkInstance::BookmarkGet(const picojson::value& arg, picojson::object& o) {
- ScopeLogger();
- PrintDeprecationWarningFor("Bookmark API");
- CHECK_PRIVILEGE_ACCESS(kPrivilegeBookmarkRead, &o);
-
- Context ctx = {0};
- bp_bookmark_info_fmt info = {0};
- ctx.shouldGetItems = arg.get(kShouldGetItems).get();
- ctx.id = arg.get(kId).get();
-
- if (!bookmark_foreach(ctx, info)) {
- LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get bookmark"), &o);
- return;
- }
-
- picojson::value::array arr;
- arr.reserve(ctx.folders.size());
- for (auto& item : ctx.folders) {
- picojson::object obj;
- obj.emplace(kTitle, picojson::value(item.bookmark_info.title));
- obj.emplace(kId, picojson::value(std::to_string(item.id)));
- obj.emplace(kType, picojson::value(std::to_string(item.bookmark_info.type)));
- obj.emplace(kParentId, picojson::value(std::to_string(item.bookmark_info.parent)));
- if (!item.bookmark_info.type) {
- obj.emplace(kUrl, picojson::value(item.bookmark_info.url));
- }
-
- arr.push_back(std::move(picojson::value(std::move(obj))));
- }
- ReportSuccess(picojson::value(std::move(arr)), o);
-}
-
-void BookmarkInstance::BookmarkAdd(const picojson::value& arg, picojson::object& o) {
- ScopeLogger();
- PrintDeprecationWarningFor("Bookmark API");
- CHECK_PRIVILEGE_ACCESS(kPrivilegeBookmarkWrite, &o);
-
- const auto& title = arg.get(kTitle).get();
- const int parent = static_cast(arg.get(kParentId).get());
- const bool is_folder = arg.get(kType).get();
- const auto& url = arg.get(kUrl).get();
-
- if (!is_folder) { // bookmark
- bool exists = false;
- auto result = BookmarkUrlExists(url.c_str(), &exists);
- if (!result) {
- LogAndReportError(result, &o);
- return;
- } else if (exists) {
- LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Bookmark already exists"),
- &o);
- return;
- }
- } else { // folder
- bool exists = false;
- auto result = BookmarkTitleExistsInParent(title.c_str(), parent, &exists);
- if (!result) {
- LogAndReportError(result, &o);
- return;
- } else if (exists) {
- LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Bookmark already exists"),
- &o);
- return;
- }
- }
-
- int saved_id = -1;
- int ntv_ret = bp_bookmark_adaptor_create(&saved_id);
- if (ntv_ret < 0) {
- LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to create adaptor"), &o);
- return;
- }
-
- std::unique_ptr bookmark(
- &saved_id, [](int* bookmark_ptr) { bp_bookmark_adaptor_delete(*bookmark_ptr); });
- ntv_ret = bp_bookmark_adaptor_set_title(saved_id, title.c_str());
- if (ntv_ret < 0) {
- LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to set title"), &o);
- return;
- }
-
- ntv_ret = bp_bookmark_adaptor_set_parent_id(saved_id, parent);
- if (ntv_ret < 0) {
- LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to set parent id"), &o);
- return;
- }
-
- ntv_ret = bp_bookmark_adaptor_set_type(saved_id, static_cast(is_folder));
- if (ntv_ret < 0) {
- LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to set type"), &o);
- return;
- }
-
- ntv_ret = bp_bookmark_adaptor_set_url(saved_id, url.c_str());
- if (ntv_ret < 0) {
- LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to set url"), &o);
- return;
- }
- bookmark.release();
- ReportSuccess(picojson::value(std::to_string(saved_id)), o);
-}
-
-void BookmarkInstance::BookmarkRemove(const picojson::value& arg, picojson::object& o) {
- ScopeLogger();
- PrintDeprecationWarningFor("Bookmark API");
- CHECK_PRIVILEGE_ACCESS(kPrivilegeBookmarkWrite, &o);
-
- int id = common::stol(common::FromJson(arg.get(), kId));
-
- int ntv_ret = bp_bookmark_adaptor_delete(id);
- if (ntv_ret < 0) {
- LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to remove bookmark"), &o);
- return;
- }
- ReportSuccess(o);
-}
-
-void BookmarkInstance::BookmarkRemoveAll(const picojson::value& msg, picojson::object& o) {
- ScopeLogger();
- PrintDeprecationWarningFor("Bookmark API");
- CHECK_PRIVILEGE_ACCESS(kPrivilegeBookmarkWrite, &o);
-
- int ntv_ret = bp_bookmark_adaptor_reset();
- if (ntv_ret < 0) {
- LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to remove bookmark"), &o);
- return;
- }
- ReportSuccess(o);
-}
-
-void BookmarkInstance::BookmarkGetRootId(const picojson::value& msg, picojson::object& o) {
- ScopeLogger();
- PrintDeprecationWarningFor("Bookmark API");
- int rootId(0);
- int ntv_ret = bp_bookmark_adaptor_get_root(&rootId);
- if (ntv_ret < 0) {
- LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to remove bookmark"), &o);
- return;
- }
- ReportSuccess(picojson::value(std::to_string(rootId)), o);
-}
-} // namespace bookmark
-} // namespace extension
diff --git a/src/bookmark/bookmark_instance.h b/src/bookmark/bookmark_instance.h
deleted file mode 100644
index ae468c73..00000000
--- a/src/bookmark/bookmark_instance.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2015 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 BOOKMARK_BOOKMARK_INSTANCE_H_
-#define BOOKMARK_BOOKMARK_INSTANCE_H_
-
-#include
-#include
-
-#include "common/extension.h"
-#include "common/picojson.h"
-#include "common/platform_result.h"
-
-namespace extension {
-namespace bookmark {
-
-struct BookmarkObject {
- int id;
- bp_bookmark_info_fmt bookmark_info;
-};
-
-struct Context {
- int id;
- bool shouldGetItems;
- std::vector folders;
-};
-
-class BookmarkInstance : public common::ParsedInstance {
- public:
- BookmarkInstance();
- virtual ~BookmarkInstance();
-
- private:
- bool bookmark_foreach(Context& ctx, bp_bookmark_info_fmt& info);
- common::PlatformResult BookmarkUrlExists(const char* url, bool* exists);
- common::PlatformResult BookmarkTitleExistsInParent(const char* title, int parent, bool* exists);
- void BookmarkGet(const picojson::value& arg, picojson::object& o);
- void BookmarkAdd(const picojson::value& arg, picojson::object& o);
- void BookmarkRemove(const picojson::value& arg, picojson::object& o);
- void BookmarkRemoveAll(const picojson::value& msg, picojson::object& o);
- void BookmarkGetRootId(const picojson::value& msg, picojson::object& o);
-};
-} // namespace bookmark
-} // namespace extension
-#endif // BOOKMARK_BOOKMARK_INSTANCE_H_
diff --git a/src/tizen-wrt.gyp b/src/tizen-wrt.gyp
index 9517163c..9235bf2e 100755
--- a/src/tizen-wrt.gyp
+++ b/src/tizen-wrt.gyp
@@ -64,13 +64,6 @@
],
},
],
- [
- 'tizen_feature_bookmark_support==1', {
- 'dependencies': [
- 'bookmark/bookmark.gyp:*',
- ],
- },
- ],
[
'tizen_feature_calendar_support==1', {
'dependencies': [
diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js
index 70424a53..87bbea07 100644
--- a/src/utils/utils_api.js
+++ b/src/utils/utils_api.js
@@ -153,8 +153,6 @@ var _privilege = {
BLUETOOTH_SPP: 'http://tizen.org/privilege/bluetooth.spp',
BLUETOOTHMANAGER: 'http://tizen.org/privilege/bluetoothmanager',
BLUETOOTH: 'http://tizen.org/privilege/bluetooth',
- BOOKMARK_READ: 'http://tizen.org/privilege/bookmark.read',
- BOOKMARK_WRITE: 'http://tizen.org/privilege/bookmark.write',
CALENDAR_READ: 'http://tizen.org/privilege/calendar.read',
CALENDAR_WRITE: 'http://tizen.org/privilege/calendar.write',
CALLHISTORY_READ: 'http://tizen.org/privilege/callhistory.read',