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.
46 * @final This class is not intended for extension.
48 * The %WebBookmark class provides methods to get bookmark information of the browser and organize it.
49 * 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
50 * If you use these APIs to backup and restore the bookmark, add bookmark items and folders recursively from the topmost level.
52 class _OSP_EXPORT_ WebBookmark
53 : public Tizen::Base::Object
57 * The object is not fully constructed after this constructor is called. @n
58 * For full construction, the Construct() method must be called right after calling this constructor.
65 * This destructor overrides Osp::Base::Object::~Object().
69 virtual ~ WebBookmark(void);
72 * Initializes this instance of %WebBookmark.
76 * @return An error code
77 * @exception E_SUCCESS The method is successful.
78 * @exception E_SYSTEM A system error has occurred.
80 result Construct(void);
83 * Adds a bookmark folder.
87 * @privilege %http://tizen.org/privilege/bookmark.write
89 * @return An error code
90 * @param[in] title The title of bookmark item
91 * @param[out] folderId The current folder ID
92 * @param[in] parentId The parent folder ID
93 * @exception E_SUCCESS The method is successful.
94 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
95 * - The specified title is an empty string. @n
96 * - The specified @c parentId is invalid.
97 * @exception E_OBJ_ALREADY_EXIST A folder with the same title and parent ID already exists.
98 * @exception E_SYSTEM The method has failed.
99 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
100 * @see BookmarkItem::GetParentFolderId()
102 result AddFolder(const Tizen::Base::String& title, RecordId& folderId, RecordId parentId = ROOT_FOLDER_ID);
106 * Adds 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 @c title is an empty string. @n
120 * - The specified @c url is an empty string. @n
121 * - The specified @c parentId 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);
133 * @privlevel platform
134 * @privilege %http://tizen.org/privilege/bookmark.write
136 * @return An error code
137 * @param[in] bookmarkId The bookmark ID
138 * @param[in] favicon The favicon image
139 * @exception E_SUCCESS The method is successful.
140 * @exception E_INVALID_ARG The specified @c bookmarkId is invalid.
141 * @exception E_INVALID_DATA The specified @c favicon data is invalid.
142 * @exception E_SYSTEM The method has failed.
143 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
144 * @see BookmarkItem::GetFavicon()
146 result SetFavicon(RecordId bookmarkId, const Tizen::Graphics::Bitmap& favicon);
149 * Gets the bookmark item pointed to by the specified @c index.
152 * @privlevel platform
153 * @privilege %http://tizen.org/privilege/bookmark.read
155 * @return The bookmark item at the specified @c index
156 * @param[in] index The index of an element @n
157 * The value of the @c index must be greater than or equal to @c 0.
158 * @exception E_SUCCESS The method is successful.
159 * @exception E_OUT_OF_RANGE The specified @c index is out of range.
160 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
161 * @remarks The specific error code can be accessed using the GetLastResult() method.
163 const BookmarkItem* GetItemAt(int index) const;
166 * Gets the total number of items.
169 * @privlevel platform
170 * @privilege %http://tizen.org/privilege/bookmark.read
172 * @return The total number of items
173 * @exception E_SUCCESS The method is successful.
174 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
175 * @remarks The specific error code can be accessed using the GetLastResult() method.
177 int GetItemCount(void) const;
180 * Removes all elements.
183 * @privlevel platform
184 * @privilege %http://tizen.org/privilege/bookmark.write
186 * @return An error code
187 * @exception E_SUCCESS The method is successful.
188 * @exception E_SYSTEM The method has failed.
189 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
191 result RemoveAll(void);
195 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
197 // @param[in] rhs The instance of the %WebBookmark class to copy from
198 // @remarks This constructor is hidden.
200 WebBookmark(const WebBookmark & rhs);
203 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
205 // @param[in] rhs An instance of %WebBookmark
206 // @remarks The method is declared but not implemented.
208 WebBookmark& operator=(const WebBookmark& rhs);
211 _WebBookmarkImpl * __pWebBookmarkImpl;
213 friend class _WebBookmarkImpl;
217 #endif // _FWEB_WEB_BOOKMARK_H_