merge with master
[framework/osp/net.git] / inc / FNetHttpHttpCookieStorageManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file                FNetHttpHttpCookieStorageManager.h
20  * @brief               This is the header file for the %HttpCookieStorageManager class.
21  *
22  * This header file contains the declarations of the %HttpCookieStorageManager class.
23  */
24
25 #ifndef _FNET_HTTP_HTTP_COOKIE_STORAGE_MANAGER_H_
26 #define _FNET_HTTP_HTTP_COOKIE_STORAGE_MANAGER_H_
27
28 #include <FBaseResult.h>
29 #include <FNetHttpHttpTypes.h>
30
31 namespace Tizen { namespace Net { namespace Http
32 {
33 class HttpSession;
34 class _HttpCookieStorageManagerImpl;
35 /**
36  * @class       HttpCookieStorageManager
37  * @brief       This class provides a collection of %Http cookies of a particular session.
38  *
39  * @since   2.0
40  *
41  * The %HttpCookieStorageManager class instance encapsulates the cookies received by the client in this particular session.
42  *
43  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/net/http_connectivity.htm">HTTP Guide</a>.
44  */
45 class _OSP_EXPORT_ HttpCookieStorageManager
46         : public Tizen::Base::Object
47 {
48
49 public:
50         /**
51          * Gets the string to be used in the cookie header of the request corresponding to the requested URL.
52          *
53          * @since               2.0
54          *
55          * @return              An error code
56          * @param[in]   url                                     The request URL
57          * @param[out]  cookies                         The cookie header value @n
58          *                                                          For example, cookie-name1=cookie-value1;cookie-name2=cookie-value2.
59          * @exception   E_SUCCESS                       The method is successful.
60          * @exception   E_INVALID_ARG           The specified @c cookies is an empty string.
61          * @exception   E_INVALID_STATE         The method invoked is invalid.
62          */
63         result GetCookies(const Tizen::Base::String& url, Tizen::Base::String& cookies) const;
64
65         /**
66          * Removes all the cookies corresponding to the requested URL from the cookie storage.
67          *
68          * @since                       2.0
69          * @privlevel           public
70          * @privilege           http://tizen.org/privilege/http
71          *
72          * @return              An error code
73          * @param[in]   url                                             The requested URL
74          * @exception   E_SUCCESS                               The method is successful.
75          * @exception   E_INVALID_ARG                   The specified @c url is an empty string.
76          * @exception   E_INVALID_STATE                 The method invoked is invalid.
77          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
78          * @exception   E_SYSTEM                                A system error has occurred.
79          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
80          */
81         result RemoveCookies(const Tizen::Base::String& url);
82
83         /**
84          * Removes all the cookies from the cookie storage.
85          *
86          * @since                       2.0
87          * @privlevel           public
88          * @privilege           http://tizen.org/privilege/http
89          *
90          * @return              An error code
91          * @exception   E_SUCCESS                               The method is successful.
92          * @exception   E_INVALID_STATE         The method invoked is invalid.
93          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
94          * @exception   E_SYSTEM                                A system error has occurred.
95          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
96          */
97         result RemoveAllCookies();
98
99 private:
100         /**
101          * This default constructor is intentionally declared as private so that only the platform can create an instance.
102          */
103         HttpCookieStorageManager();
104
105         /**
106          * This default constructor is intentionally declared as private so that only the platform can delete an instance.
107          */
108         ~HttpCookieStorageManager();
109
110         /**
111          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
112          *
113          * @param[in]   rhs   An instance of %HttpCookieStorageManager
114          */
115         HttpCookieStorageManager(const HttpCookieStorageManager& rhs);
116
117         /**
118          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
119          *
120          * @param[in]   rhs             An instance of %HttpCookieStorageManager
121          */
122         HttpCookieStorageManager& operator =(const HttpCookieStorageManager& rhs);
123
124 private:
125         friend class _HttpCookieStorageManagerImpl;
126         _HttpCookieStorageManagerImpl* __pHttpCookieStorageManagerImpl;
127
128 }; // HttpCookieStorageManager
129
130 } } } //Tizen::Net::Http
131 #endif // _FNET_HTTP_HTTP_COOKIE_STORAGE_MANAGER_H_