Chromium Code Reviews| 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 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
| 6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
| 7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
| 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 9 * | 9 * |
| 10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 | 267 |
| 268 // Mapping between DeletionCause and CookieStore::ChangeCause; the | 268 // Mapping between DeletionCause and CookieStore::ChangeCause; the |
| 269 // mapping also provides a boolean that specifies whether or not an | 269 // mapping also provides a boolean that specifies whether or not an |
| 270 // OnCookieChanged notification ought to be generated. | 270 // OnCookieChanged notification ought to be generated. |
| 271 typedef struct ChangeCausePair_struct { | 271 typedef struct ChangeCausePair_struct { |
| 272 CookieStore::ChangeCause cause; | 272 CookieStore::ChangeCause cause; |
| 273 bool notify; | 273 bool notify; |
| 274 } ChangeCausePair; | 274 } ChangeCausePair; |
| 275 const ChangeCausePair kChangeCauseMapping[] = { | 275 const ChangeCausePair kChangeCauseMapping[] = { |
| 276 // DELETE_COOKIE_EXPLICIT | 276 // DELETE_COOKIE_EXPLICIT |
| 277 {CookieStore::ChangeCause::EXPLICIT, true}, | 277 {CookieStore::ChangeCause::EXPLICIT1, true}, |
| 278 // DELETE_COOKIE_OVERWRITE | 278 // DELETE_COOKIE_OVERWRITE |
| 279 {CookieStore::ChangeCause::OVERWRITE, true}, | 279 {CookieStore::ChangeCause::OVERWRITE, true}, |
| 280 // DELETE_COOKIE_EXPIRED | 280 // DELETE_COOKIE_EXPIRED |
| 281 {CookieStore::ChangeCause::EXPIRED, true}, | 281 {CookieStore::ChangeCause::EXPIRED, true}, |
| 282 // DELETE_COOKIE_EVICTED | 282 // DELETE_COOKIE_EVICTED |
| 283 {CookieStore::ChangeCause::EVICTED, true}, | 283 {CookieStore::ChangeCause::EVICTED, true}, |
| 284 // DELETE_COOKIE_DUPLICATE_IN_BACKING_STORE | 284 // DELETE_COOKIE_DUPLICATE_IN_BACKING_STORE |
| 285 {CookieStore::ChangeCause::EXPLICIT, false}, | 285 {CookieStore::ChangeCause::EXPLICIT2, false}, |
|
Mike West
2016/12/22 07:31:09
Why not name them to match the cause in CookieMons
nharper
2016/12/23 01:42:55
Done.
| |
| 286 // DELETE_COOKIE_DONT_RECORD | 286 // DELETE_COOKIE_DONT_RECORD |
| 287 {CookieStore::ChangeCause::EXPLICIT, false}, | 287 {CookieStore::ChangeCause::EXPLICIT3, false}, |
| 288 // DELETE_COOKIE_EVICTED_DOMAIN | 288 // DELETE_COOKIE_EVICTED_DOMAIN |
| 289 {CookieStore::ChangeCause::EVICTED, true}, | 289 {CookieStore::ChangeCause::EVICTED, true}, |
| 290 // DELETE_COOKIE_EVICTED_GLOBAL | 290 // DELETE_COOKIE_EVICTED_GLOBAL |
| 291 {CookieStore::ChangeCause::EVICTED, true}, | 291 {CookieStore::ChangeCause::EVICTED, true}, |
| 292 // DELETE_COOKIE_EVICTED_DOMAIN_PRE_SAFE | 292 // DELETE_COOKIE_EVICTED_DOMAIN_PRE_SAFE |
| 293 {CookieStore::ChangeCause::EVICTED, true}, | 293 {CookieStore::ChangeCause::EVICTED, true}, |
| 294 // DELETE_COOKIE_EVICTED_DOMAIN_POST_SAFE | 294 // DELETE_COOKIE_EVICTED_DOMAIN_POST_SAFE |
| 295 {CookieStore::ChangeCause::EVICTED, true}, | 295 {CookieStore::ChangeCause::EVICTED, true}, |
| 296 // DELETE_COOKIE_EXPIRED_OVERWRITE | 296 // DELETE_COOKIE_EXPIRED_OVERWRITE |
| 297 {CookieStore::ChangeCause::EXPIRED_OVERWRITE, true}, | 297 {CookieStore::ChangeCause::EXPIRED_OVERWRITE, true}, |
| 298 // DELETE_COOKIE_CONTROL_CHAR | 298 // DELETE_COOKIE_CONTROL_CHAR |
| 299 {CookieStore::ChangeCause::EVICTED, true}, | 299 {CookieStore::ChangeCause::EVICTED, true}, |
| 300 // DELETE_COOKIE_NON_SECURE | 300 // DELETE_COOKIE_NON_SECURE |
| 301 {CookieStore::ChangeCause::EVICTED, true}, | 301 {CookieStore::ChangeCause::EVICTED, true}, |
| 302 // DELETE_COOKIE_LAST_ENTRY | 302 // DELETE_COOKIE_LAST_ENTRY |
| 303 {CookieStore::ChangeCause::EXPLICIT, false}}; | 303 {CookieStore::ChangeCause::EXPLICIT4, false}}; |
| 304 | 304 |
| 305 void RunAsync(scoped_refptr<base::TaskRunner> proxy, | 305 void RunAsync(scoped_refptr<base::TaskRunner> proxy, |
| 306 const CookieStore::CookieChangedCallback& callback, | 306 const CookieStore::CookieChangedCallback& callback, |
| 307 const CanonicalCookie& cookie, | 307 const CanonicalCookie& cookie, |
| 308 CookieStore::ChangeCause cause) { | 308 CookieStore::ChangeCause cause) { |
| 309 proxy->PostTask(FROM_HERE, base::Bind(callback, cookie, cause)); | 309 proxy->PostTask(FROM_HERE, base::Bind(callback, cookie, cause)); |
| 310 } | 310 } |
| 311 | 311 |
| 312 bool IsCookieEligibleForEviction(CookiePriority current_priority_level, | 312 bool IsCookieEligibleForEviction(CookiePriority current_priority_level, |
| 313 bool protect_secure_cookies, | 313 bool protect_secure_cookies, |
| (...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2386 it != hook_map_.end(); ++it) { | 2386 it != hook_map_.end(); ++it) { |
| 2387 std::pair<GURL, std::string> key = it->first; | 2387 std::pair<GURL, std::string> key = it->first; |
| 2388 if (cookie.IncludeForRequestURL(key.first, opts) && | 2388 if (cookie.IncludeForRequestURL(key.first, opts) && |
| 2389 cookie.Name() == key.second) { | 2389 cookie.Name() == key.second) { |
| 2390 it->second->Notify(cookie, cause); | 2390 it->second->Notify(cookie, cause); |
| 2391 } | 2391 } |
| 2392 } | 2392 } |
| 2393 } | 2393 } |
| 2394 | 2394 |
| 2395 } // namespace net | 2395 } // namespace net |
| OLD | NEW |