Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: net/cookies/cookie_monster.h

Issue 2903213004: Refactor transmission of security of source and http_only mods in cookie_monster.cc. (Closed)
Patch Set: Tweak ordering in header file. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/cookies/cookie_monster.cc » ('j') | net/cookies/cookie_monster.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 the letter D and the number 2. 5 // Brought to you by the letter D and the number 2.
6 6
7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_ 7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_
8 #define NET_COOKIES_COOKIE_MONSTER_H_ 8 #define NET_COOKIES_COOKIE_MONSTER_H_
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 const CookieOptions& options, 494 const CookieOptions& options,
495 std::vector<CanonicalCookie*>* cookies); 495 std::vector<CanonicalCookie*>* cookies);
496 496
497 void FindCookiesForKey(const std::string& key, 497 void FindCookiesForKey(const std::string& key,
498 const GURL& url, 498 const GURL& url,
499 const CookieOptions& options, 499 const CookieOptions& options,
500 const base::Time& current, 500 const base::Time& current,
501 std::vector<CanonicalCookie*>* cookies); 501 std::vector<CanonicalCookie*>* cookies);
502 502
503 // Delete any cookies that are equivalent to |ecc| (same path, domain, etc). 503 // Delete any cookies that are equivalent to |ecc| (same path, domain, etc).
504 // |source_url| is the URL that is attempting to set the cookie. 504 // |source_secure| indicates if the source may override existing secure
505 // cookies.
505 // If |skip_httponly| is true, httponly cookies will not be deleted. The 506 // If |skip_httponly| is true, httponly cookies will not be deleted. The
506 // return value will be true if |skip_httponly| skipped an httponly cookie or 507 // return value will be true if |skip_httponly| skipped an httponly cookie or
507 // the cookie to delete was Secure and the scheme of |ecc| is insecure. |key| 508 // the cookie to delete was Secure and the scheme of |ecc| is insecure. |key|
508 // is the key to find the cookie in cookies_; see the comment before the 509 // is the key to find the cookie in cookies_; see the comment before the
509 // CookieMap typedef for details. 510 // CookieMap typedef for details.
510 // NOTE: There should never be more than a single matching equivalent cookie. 511 // NOTE: There should never be more than a single matching equivalent cookie.
511 bool DeleteAnyEquivalentCookie(const std::string& key, 512 bool DeleteAnyEquivalentCookie(const std::string& key,
512 const CanonicalCookie& ecc, 513 const CanonicalCookie& ecc,
513 const GURL& source_url, 514 bool source_secure,
514 bool skip_httponly, 515 bool skip_httponly,
515 bool already_expired); 516 bool already_expired);
516 517
517 // Inserts |cc| into cookies_. Returns an iterator that points to the inserted 518 // Inserts |cc| into cookies_. Returns an iterator that points to the inserted
518 // cookie in cookies_. Guarantee: all iterators to cookies_ remain valid. 519 // cookie in cookies_. Guarantee: all iterators to cookies_ remain valid.
520 // |secure_source| indicates if the setting of the canonical cookie is
521 // coming from a secure source (e.g. a cryptographically schemed URL).
519 CookieMap::iterator InternalInsertCookie(const std::string& key, 522 CookieMap::iterator InternalInsertCookie(const std::string& key,
520 std::unique_ptr<CanonicalCookie> cc, 523 std::unique_ptr<CanonicalCookie> cc,
521 const GURL& source_url, 524 bool source_secure,
522 bool sync_to_store); 525 bool sync_to_store);
523 526
524 // Helper function that sets cookies with more control. 527 // Helper function that sets cookies with more control.
525 // Not exposed as we don't want callers to have the ability 528 // Not exposed as we don't want callers to have the ability
526 // to specify (potentially duplicate) creation times. 529 // to specify (potentially duplicate) creation times.
527 bool SetCookieWithCreationTimeAndOptions(const GURL& url, 530 bool SetCookieWithCreationTimeAndOptions(const GURL& url,
528 const std::string& cookie_line, 531 const std::string& cookie_line,
529 const base::Time& creation_time, 532 const base::Time& creation_time,
530 const CookieOptions& options); 533 const CookieOptions& options);
531 534
532 // Helper function that sets a canonical cookie, deleting equivalents and 535 // Sets a canonical cookie, deletes equivalents and performs garbage
533 // performing garbage collection. 536 // collection. |source_secure| indicates if the cookie is being set
534 // |source_url| is the URL that's attempting to set the cookie. 537 // from a secure source (e.g. a cryptographic scheme).
535 bool SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cc, 538 // |modify_http_only| indicates if this setting operation is allowed
536 const GURL& source_url, 539 // to affect http_only cookies.
537 const CookieOptions& options); 540 bool SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cookie,
541 bool secure_source,
542 bool can_modify_httponly);
538 543
539 // Helper function calling SetCanonicalCookie() for all cookies in |list|. 544 // Helper function calling SetCanonicalCookie() for all cookies in |list|.
540 bool SetCanonicalCookies(const CookieList& list); 545 bool SetCanonicalCookies(const CookieList& list);
541 546
542 void InternalUpdateCookieAccessTime(CanonicalCookie* cc, 547 void InternalUpdateCookieAccessTime(CanonicalCookie* cc,
543 const base::Time& current_time); 548 const base::Time& current_time);
544 549
545 // |deletion_cause| argument is used for collecting statistics and choosing 550 // |deletion_cause| argument is used for collecting statistics and choosing
546 // the correct CookieStore::ChangeCause for OnCookieChanged 551 // the correct CookieStore::ChangeCause for OnCookieChanged
547 // notifications. Guarantee: All iterators to cookies_ except to the 552 // notifications. Guarantee: All iterators to cookies_ except to the
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 virtual ~PersistentCookieStore() {} 807 virtual ~PersistentCookieStore() {}
803 808
804 private: 809 private:
805 friend class base::RefCountedThreadSafe<PersistentCookieStore>; 810 friend class base::RefCountedThreadSafe<PersistentCookieStore>;
806 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); 811 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore);
807 }; 812 };
808 813
809 } // namespace net 814 } // namespace net
810 815
811 #endif // NET_COOKIES_COOKIE_MONSTER_H_ 816 #endif // NET_COOKIES_COOKIE_MONSTER_H_
OLDNEW
« no previous file with comments | « no previous file | net/cookies/cookie_monster.cc » ('j') | net/cookies/cookie_monster.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698