| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 const std::string& cookie_line, | 119 const std::string& cookie_line, |
| 120 const net::CookieOptions& options); | 120 const net::CookieOptions& options); |
| 121 | 121 |
| 122 // Clears the list of canned cookies. | 122 // Clears the list of canned cookies. |
| 123 void Reset(); | 123 void Reset(); |
| 124 | 124 |
| 125 // True if no cookie are currently stored. | 125 // True if no cookie are currently stored. |
| 126 bool empty() const; | 126 bool empty() const; |
| 127 | 127 |
| 128 // BrowsingDataCookieHelper methods. | 128 // BrowsingDataCookieHelper methods. |
| 129 virtual void StartFetching( | 129 void StartFetching( |
| 130 const net::CookieMonster::GetCookieListCallback& callback) override; | 130 const net::CookieMonster::GetCookieListCallback& callback) override; |
| 131 virtual void DeleteCookie(const net::CanonicalCookie& cookie) override; | 131 void DeleteCookie(const net::CanonicalCookie& cookie) override; |
| 132 | 132 |
| 133 // Returns the number of stored cookies. | 133 // Returns the number of stored cookies. |
| 134 size_t GetCookieCount() const; | 134 size_t GetCookieCount() const; |
| 135 | 135 |
| 136 // Returns the map that contains the cookie lists for all frame urls. | 136 // Returns the map that contains the cookie lists for all frame urls. |
| 137 const OriginCookieSetMap& origin_cookie_set_map() { | 137 const OriginCookieSetMap& origin_cookie_set_map() { |
| 138 return origin_cookie_set_map_; | 138 return origin_cookie_set_map_; |
| 139 } | 139 } |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 // Check if the cookie set contains a cookie with the same name, | 142 // Check if the cookie set contains a cookie with the same name, |
| 143 // domain, and path as the newly created cookie. Delete the old cookie | 143 // domain, and path as the newly created cookie. Delete the old cookie |
| 144 // if does. | 144 // if does. |
| 145 bool DeleteMatchingCookie(const net::CanonicalCookie& add_cookie, | 145 bool DeleteMatchingCookie(const net::CanonicalCookie& add_cookie, |
| 146 canonical_cookie::CookieHashSet* cookie_set); | 146 canonical_cookie::CookieHashSet* cookie_set); |
| 147 | 147 |
| 148 virtual ~CannedBrowsingDataCookieHelper(); | 148 ~CannedBrowsingDataCookieHelper() override; |
| 149 | 149 |
| 150 // Returns the |CookieSet| for the given |origin|. | 150 // Returns the |CookieSet| for the given |origin|. |
| 151 canonical_cookie::CookieHashSet* GetCookiesFor(const GURL& origin); | 151 canonical_cookie::CookieHashSet* GetCookiesFor(const GURL& origin); |
| 152 | 152 |
| 153 // Adds the |cookie| to the cookie set for the given |frame_url|. | 153 // Adds the |cookie| to the cookie set for the given |frame_url|. |
| 154 void AddCookie(const GURL& frame_url, | 154 void AddCookie(const GURL& frame_url, |
| 155 const net::CanonicalCookie& cookie); | 155 const net::CanonicalCookie& cookie); |
| 156 | 156 |
| 157 // Map that contains the cookie sets for all frame origins. | 157 // Map that contains the cookie sets for all frame origins. |
| 158 OriginCookieSetMap origin_cookie_set_map_; | 158 OriginCookieSetMap origin_cookie_set_map_; |
| 159 | 159 |
| 160 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataCookieHelper); | 160 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataCookieHelper); |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ | 163 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ |
| OLD | NEW |