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 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // 5.3). Cookies with same tuple (cookie-name, cookie-domain, cookie-path, | 89 // 5.3). Cookies with same tuple (cookie-name, cookie-domain, cookie-path, |
90 // host-only-flag) as cookie that are already stored, will replace the stored | 90 // host-only-flag) as cookie that are already stored, will replace the stored |
91 // cookies. | 91 // cookies. |
92 class CannedBrowsingDataCookieHelper : public BrowsingDataCookieHelper { | 92 class CannedBrowsingDataCookieHelper : public BrowsingDataCookieHelper { |
93 public: | 93 public: |
94 typedef std::map<GURL, canonical_cookie::CookieHashSet*> OriginCookieSetMap; | 94 typedef std::map<GURL, canonical_cookie::CookieHashSet*> OriginCookieSetMap; |
95 | 95 |
96 explicit CannedBrowsingDataCookieHelper( | 96 explicit CannedBrowsingDataCookieHelper( |
97 net::URLRequestContextGetter* request_context); | 97 net::URLRequestContextGetter* request_context); |
98 | 98 |
99 // Return a copy of the cookie helper. Only one consumer can use the | |
100 // StartFetching method at a time, so we need to create a copy of the helper | |
101 // everytime we instantiate a cookies tree model for it. | |
102 CannedBrowsingDataCookieHelper* Clone(); | |
103 | |
104 // Adds the cookies from |cookie_list|. Current cookies that have the same | 99 // Adds the cookies from |cookie_list|. Current cookies that have the same |
105 // cookie name, cookie domain, cookie path, host-only-flag tuple as passed | 100 // cookie name, cookie domain, cookie path, host-only-flag tuple as passed |
106 // cookies are replaced by the passed cookies. | 101 // cookies are replaced by the passed cookies. |
107 void AddReadCookies(const GURL& frame_url, | 102 void AddReadCookies(const GURL& frame_url, |
108 const GURL& request_url, | 103 const GURL& request_url, |
109 const net::CookieList& cookie_list); | 104 const net::CookieList& cookie_list); |
110 | 105 |
111 // Adds a CanonicalCookie that is created from the passed |cookie_line| | 106 // Adds a CanonicalCookie that is created from the passed |cookie_line| |
112 // (called set-cookie-string in RFC 6225). The |cookie_line| is parsed, | 107 // (called set-cookie-string in RFC 6225). The |cookie_line| is parsed, |
113 // normalized and validated. Invalid |cookie_line|s are ignored. The logic | 108 // normalized and validated. Invalid |cookie_line|s are ignored. The logic |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void AddCookie(const GURL& frame_url, | 154 void AddCookie(const GURL& frame_url, |
160 const net::CanonicalCookie& cookie); | 155 const net::CanonicalCookie& cookie); |
161 | 156 |
162 // Map that contains the cookie sets for all frame origins. | 157 // Map that contains the cookie sets for all frame origins. |
163 OriginCookieSetMap origin_cookie_set_map_; | 158 OriginCookieSetMap origin_cookie_set_map_; |
164 | 159 |
165 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataCookieHelper); | 160 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataCookieHelper); |
166 }; | 161 }; |
167 | 162 |
168 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ | 163 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ |
OLD | NEW |