2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FWebWebBookmark.h
20 * @brief This is the header file for the % WebBookmark class.
22 * This header file contains the declarations of the % WebBookmark class.
25 #ifndef _FWEB_WEB_BOOKMARK_H_
26 #define _FWEB_WEB_BOOKMARK_H_
28 #include <FBaseString.h>
29 #include <FWebBookmarkItem.h>
31 namespace Tizen { namespace Graphics
36 namespace Tizen { namespace Web
38 class _WebBookmarkImpl;
42 * @brief This class provides methods to manage bookmark items of the browser.
45 * @final This class is not intended for extension.
47 * The %WebBookmark class provides methods to get bookmark information of the browser and organize it.
48 * The bookmark system has hierarchical structure with the parent folder id supporting multiple folders and The bookmark items are represented by the BookmarkItem class. @n
49 * If you use these APIs to backup and restore the bookmark, add bookmark items and folders recursively from the topmost level.
51 class _OSP_EXPORT_ WebBookmark
52 : public Tizen::Base::Object
56 * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor. *
63 * This destructor overrides Osp::Base::Object::~Object().
67 virtual ~ WebBookmark(void);
70 * Initializes this instance of %WebBookmark.
74 * @return An error code
75 * @exception E_SUCCESS The method is successful.
76 * @exception E_SYSTEM A system error has occurred.
78 result Construct(void);
81 * Adds a bookmark folder.
86 * @privilege %http://tizen.org/privilege/bookmark.write
88 * @return An error code
89 * @param[in] title The title of bookmark item
90 * @param[out] folderId The current folder id
91 * @param[in] parentId The parent folder id
92 * @exception E_SUCCESS The method is successful.
93 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
94 * - The specified title is an empty string. @n
95 * - The specified parentId is invalid..
96 * @exception E_OBJ_ALREADY_EXIST A folder with the same title and parent id already exists.
97 * @exception E_SYSTEM The method has failed.
98 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
99 * @see BookmarkItem::GetParentFolderId()
101 result AddFolder(const Tizen::Base::String& title, RecordId& folderId, RecordId parentId = ROOT_FOLDER_ID);
105 * Adds a bookmark contents.
109 * @privlevel platform
110 * @privilege %http://tizen.org/privilege/bookmark.write
112 * @return An error code
113 * @param[in] title The title of bookmark item
114 * @param[in] url The url of bookmark item
115 * @param[out] bookmarkId The current bookmark id
116 * @param[in] parentId The parent folder id
117 * @exception E_SUCCESS The method is successful.
118 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
119 * - The specified title is an empty string. @n
120 * - The specified url is an empty string. @n
121 * - The specified folderId is invalid.
122 * @exception E_OBJ_ALREADY_EXIST A folder with the same title and parent id already exists.
123 * @exception E_SYSTEM The method has failed.
124 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
125 * @see BookmarkItem::GetParentFolderId()
127 result AddBookmark(const Tizen::Base::String& title, const Tizen::Base::String& url, RecordId& bookmarkId, RecordId parentId = ROOT_FOLDER_ID);
134 * @privlevel platform
135 * @privilege %http://tizen.org/privilege/bookmark.write
137 * @return An error code
138 * @param[in] bookmarkId The bookmark id
139 * @param[in] favicon The favicon image
140 * @exception E_SUCCESS The method is successful.
141 * @exception E_INVALID_ARG The specified bookmarkId is invalid.
142 * @exception E_INVALID_DATA The specified favicon data is invalid.
143 * @exception E_SYSTEM The method has failed.
144 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
145 * @see BookmarkItem::GetFavicon()
147 result SetFavicon(RecordId bookmarkId, const Tizen::Graphics::Bitmap& favicon);
150 * Gets the bookmark item pointed to by the specified index.
154 * @privlevel platform
155 * @privilege %http://tizen.org/privilege/bookmark.read
157 * @return The bookmark item at the specified index
158 * @param[in] index The index of an element @n
159 * The value of the index must be greater than or equal to @c 0.
160 * @exception E_SUCCESS The method is successful.
161 * @exception E_OUT_OF_RANGE The specified index is out of range.
162 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
163 * @remarks The specific error code can be accessed using the GetLastResult() method.
165 const BookmarkItem* GetItemAt(int index) const;
168 * Gets the total number of items.
172 * @privlevel platform
173 * @privilege %http://tizen.org/privilege/bookmark.read
175 * @return The total number of items
176 * @exception E_SUCCESS The method is successful.
177 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
178 * @remarks The specific error code can be accessed using the GetLastResult() method.
180 int GetItemCount(void) const;
183 * Removes all elements.
187 * @privlevel platform
188 * @privilege %http://tizen.org/privilege/bookmark.write
190 * @return An error code
191 * @exception E_SUCCESS The method is successful.
192 * @exception E_SYSTEM The method has failed.
193 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
195 result RemoveAll(void);
199 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
201 // @param[in] rhs The instance of the %WebBookmark class to copy from
202 // @remarks This constructor is hidden.
204 WebBookmark(const WebBookmark & rhs);
207 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
209 // @param[in] rhs An instance of %WebBookmark
210 // @remarks The method is declared but not implemented.
212 WebBookmark& operator=(const WebBookmark& rhs);
215 _WebBookmarkImpl * __pWebBookmarkImpl;
217 friend class _WebBookmarkImpl;
221 #endif // _FWEB_WEB_BOOKMARK_H_