OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Brought to you by number 42. | 5 // Brought to you by number 42. |
6 | 6 |
7 #ifndef NET_COOKIES_COOKIE_STORE_H_ | 7 #ifndef NET_COOKIES_COOKIE_STORE_H_ |
8 #define NET_COOKIES_COOKIE_STORE_H_ | 8 #define NET_COOKIES_COOKIE_STORE_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 15 matching lines...) Expand all Loading... |
26 // An interface for storing and retrieving cookies. Implementations need to | 26 // An interface for storing and retrieving cookies. Implementations need to |
27 // be thread safe as its methods can be accessed from IO as well as UI threads. | 27 // be thread safe as its methods can be accessed from IO as well as UI threads. |
28 class NET_EXPORT CookieStore : public base::RefCountedThreadSafe<CookieStore> { | 28 class NET_EXPORT CookieStore : public base::RefCountedThreadSafe<CookieStore> { |
29 public: | 29 public: |
30 // Callback definitions. | 30 // Callback definitions. |
31 typedef base::Callback<void(const std::string& cookie)> | 31 typedef base::Callback<void(const std::string& cookie)> |
32 GetCookiesCallback; | 32 GetCookiesCallback; |
33 typedef base::Callback<void(bool success)> SetCookiesCallback; | 33 typedef base::Callback<void(bool success)> SetCookiesCallback; |
34 typedef base::Callback<void(int num_deleted)> DeleteCallback; | 34 typedef base::Callback<void(int num_deleted)> DeleteCallback; |
35 | 35 |
| 36 |
36 // Sets a single cookie. Expects a cookie line, like "a=1; domain=b.com". | 37 // Sets a single cookie. Expects a cookie line, like "a=1; domain=b.com". |
37 // | 38 // |
38 // Fails either if the cookie is invalid or if this is a non-HTTPONLY cookie | 39 // Fails either if the cookie is invalid or if this is a non-HTTPONLY cookie |
39 // and it would overwrite an existing HTTPONLY cookie. | 40 // and it would overwrite an existing HTTPONLY cookie. |
40 // Returns true if the cookie is successfully set. | 41 // Returns true if the cookie is successfully set. |
41 virtual void SetCookieWithOptionsAsync( | 42 virtual void SetCookieWithOptionsAsync( |
42 const GURL& url, | 43 const GURL& url, |
43 const std::string& cookie_line, | 44 const std::string& cookie_line, |
44 const CookieOptions& options, | 45 const CookieOptions& options, |
45 const SetCookiesCallback& callback) = 0; | 46 const SetCookiesCallback& callback) = 0; |
(...skipping 28 matching lines...) Expand all Loading... |
74 | 75 |
75 protected: | 76 protected: |
76 friend class base::RefCountedThreadSafe<CookieStore>; | 77 friend class base::RefCountedThreadSafe<CookieStore>; |
77 CookieStore(); | 78 CookieStore(); |
78 virtual ~CookieStore(); | 79 virtual ~CookieStore(); |
79 }; | 80 }; |
80 | 81 |
81 } // namespace net | 82 } // namespace net |
82 | 83 |
83 #endif // NET_COOKIES_COOKIE_STORE_H_ | 84 #endif // NET_COOKIES_COOKIE_STORE_H_ |
OLD | NEW |