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 * @privilege %http://tizen.org/privilege/bookmark.read and %http://tizen.org/privilege/bookmark.write @n
48 * Both privileges are required.
50 * The %WebBookmark class provides methods to get bookmark information of the browser and organize it.
51 * 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
52 * If you use these APIs to backup and restore the bookmark, add bookmark items and folders recursively from the topmost level.
54 class _OSP_EXPORT_ WebBookmark
55 : public Tizen::Base::Object
59 * 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. *
66 * This destructor overrides Osp::Base::Object::~Object().
70 virtual ~ WebBookmark(void);
73 * Initializes this instance of %WebBookmark.
77 * @return An error code
78 * @exception E_SUCCESS The method is successful.
79 * @exception E_SYSTEM A system error has occurred.
81 result Construct(void);
84 * Adds a bookmark folder.
89 * @privilege %http://tizen.org/privilege/bookmark.write
91 * @return An error code
92 * @param[in] title The title of bookmark item
93 * @param[out] folderId The current folder id
94 * @param[in] parentId The parent folder id
95 * @exception E_SUCCESS The method is successful.
96 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
97 * - The specified title is an empty string. @n
98 * - The specified parentId is invalid..
99 * @exception E_OBJ_ALREADY_EXIST A folder with the same title and parent id already exists.
100 * @exception E_SYSTEM The method has failed.
101 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
102 * @see BookmarkItem::GetParentFolderId()
104 result AddFolder(const Tizen::Base::String& title, RecordId& folderId, RecordId parentId = ROOT_FOLDER_ID);
108 * Adds a bookmark contents.
112 * @privlevel platform
113 * @privilege %http://tizen.org/privilege/bookmark.write
115 * @return An error code
116 * @param[in] title The title of bookmark item
117 * @param[in] url The url of bookmark item
118 * @param[out] bookmarkId The current bookmark id
119 * @param[in] parentId The parent folder id
120 * @exception E_SUCCESS The method is successful.
121 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
122 * - The specified title is an empty string. @n
123 * - The specified url is an empty string. @n
124 * - The specified folderId is invalid.
125 * @exception E_OBJ_ALREADY_EXIST A folder with the same title and parent id already exists.
126 * @exception E_SYSTEM The method has failed.
127 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
128 * @see BookmarkItem::GetParentFolderId()
130 result AddBookmark(const Tizen::Base::String& title, const Tizen::Base::String& url, RecordId& bookmarkId, RecordId parentId = ROOT_FOLDER_ID);
137 * @privlevel platform
138 * @privilege %http://tizen.org/privilege/bookmark.write
140 * @return An error code
141 * @param[in] bookmarkId The bookmark id
142 * @param[in] favicon The favicon image
143 * @exception E_SUCCESS The method is successful.
144 * @exception E_INVALID_ARG The specified bookmarkId is invalid.
145 * @exception E_INVALID_DATA The specified favicon data is invalid.
146 * @exception E_SYSTEM The method has failed.
147 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
148 * @see BookmarkItem::GetFavicon()
150 result SetFavicon(RecordId bookmarkId, const Tizen::Graphics::Bitmap& favicon);
153 * Gets the bookmark item pointed to by the specified index.
157 * @privlevel platform
158 * @privilege %http://tizen.org/privilege/bookmark.read
160 * @return The bookmark item at the specified index
161 * @param[in] index The index of an element @n
162 * The value of the index must be greater than or equal to @c 0.
163 * @exception E_SUCCESS The method is successful.
164 * @exception E_OUT_OF_RANGE The specified index is out of range.
165 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
166 * @remarks The specific error code can be accessed using the GetLastResult() method.
168 const BookmarkItem* GetItemAt(int index) const;
171 * Gets the total number of items.
175 * @privlevel platform
176 * @privilege %http://tizen.org/privilege/bookmark.read
178 * @return The total number of items
179 * @exception E_SUCCESS The method is successful.
180 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
181 * @remarks The specific error code can be accessed using the GetLastResult() method.
183 int GetItemCount(void) const;
186 * Removes all elements.
190 * @privlevel platform
191 * @privilege %http://tizen.org/privilege/bookmark.write
193 * @return An error code
194 * @exception E_SUCCESS The method is successful.
195 * @exception E_SYSTEM The method has failed.
196 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
198 result RemoveAll(void);
202 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
204 // @param[in] rhs The instance of the %WebBookmark class to copy from
205 // @remarks This constructor is hidden.
207 WebBookmark(const WebBookmark & rhs);
210 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
212 // @param[in] rhs An instance of %WebBookmark
213 // @remarks The method is declared but not implemented.
215 WebBookmark& operator=(const WebBookmark& rhs);
218 _WebBookmarkImpl * __pWebBookmarkImpl;
220 friend class _WebBookmarkImpl;
224 #endif // _FWEB_WEB_BOOKMARK_H_