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 | |
37 // Sets a single cookie. Expects a cookie line, like "a=1; domain=b.com". | 36 // Sets a single cookie. Expects a cookie line, like "a=1; domain=b.com". |
38 // | 37 // |
39 // Fails either if the cookie is invalid or if this is a non-HTTPONLY cookie | 38 // Fails either if the cookie is invalid or if this is a non-HTTPONLY cookie |
40 // and it would overwrite an existing HTTPONLY cookie. | 39 // and it would overwrite an existing HTTPONLY cookie. |
41 // Returns true if the cookie is successfully set. | 40 // Returns true if the cookie is successfully set. |
42 virtual void SetCookieWithOptionsAsync( | 41 virtual void SetCookieWithOptionsAsync( |
43 const GURL& url, | 42 const GURL& url, |
44 const std::string& cookie_line, | 43 const std::string& cookie_line, |
45 const CookieOptions& options, | 44 const CookieOptions& options, |
46 const SetCookiesCallback& callback) = 0; | 45 const SetCookiesCallback& callback) = 0; |
(...skipping 28 matching lines...) Expand all Loading... |
75 | 74 |
76 protected: | 75 protected: |
77 friend class base::RefCountedThreadSafe<CookieStore>; | 76 friend class base::RefCountedThreadSafe<CookieStore>; |
78 CookieStore(); | 77 CookieStore(); |
79 virtual ~CookieStore(); | 78 virtual ~CookieStore(); |
80 }; | 79 }; |
81 | 80 |
82 } // namespace net | 81 } // namespace net |
83 | 82 |
84 #endif // NET_COOKIES_COOKIE_STORE_H_ | 83 #endif // NET_COOKIES_COOKIE_STORE_H_ |
OLD | NEW |