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

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

Issue 8533013: SessionRestore: Store session cookies and restore them if chrome crashes or auto-restarts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BASE_COOKIE_MONSTER_H_ 7 #ifndef NET_BASE_COOKIE_MONSTER_H_
8 #define NET_BASE_COOKIE_MONSTER_H_ 8 #define NET_BASE_COOKIE_MONSTER_H_
9 #pragma once 9 #pragma once
10 10
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 virtual CookieMonster* GetCookieMonster() OVERRIDE; 276 virtual CookieMonster* GetCookieMonster() OVERRIDE;
277 277
278 // Debugging method to perform various validation checks on the map. 278 // Debugging method to perform various validation checks on the map.
279 // Currently just checking that there are no null CanonicalCookie pointers 279 // Currently just checking that there are no null CanonicalCookie pointers
280 // in the map. 280 // in the map.
281 // Argument |arg| is to allow retaining of arbitrary data if the CHECKs 281 // Argument |arg| is to allow retaining of arbitrary data if the CHECKs
282 // in the function trip. TODO(rdsmith):Remove hack. 282 // in the function trip. TODO(rdsmith):Remove hack.
283 void ValidateMap(int arg); 283 void ValidateMap(int arg);
284 284
285 // Adds cookies in |session_cookie_monster| as session cookies to this cookie
286 // monster.
287 void MergeSessionCookies(CookieMonster* session_cookie_monster);
288
285 // The default list of schemes the cookie monster can handle. 289 // The default list of schemes the cookie monster can handle.
286 static const char* kDefaultCookieableSchemes[]; 290 static const char* kDefaultCookieableSchemes[];
287 static const int kDefaultCookieableSchemesCount; 291 static const int kDefaultCookieableSchemesCount;
288 292
289 private: 293 private:
290 // For queueing the cookie monster calls. 294 // For queueing the cookie monster calls.
291 class CookieMonsterTask; 295 class CookieMonsterTask;
292 class DeleteAllCreatedBetweenTask; 296 class DeleteAllCreatedBetweenTask;
293 class DeleteAllForHostTask; 297 class DeleteAllForHostTask;
294 class DeleteAllTask; 298 class DeleteAllTask;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 593
590 // Runs the task if, or defers the task until, the full cookie database is 594 // Runs the task if, or defers the task until, the full cookie database is
591 // loaded. 595 // loaded.
592 void DoCookieTask(const scoped_refptr<CookieMonsterTask>& task_item); 596 void DoCookieTask(const scoped_refptr<CookieMonsterTask>& task_item);
593 597
594 // Runs the task if, or defers the task until, the cookies for the given URL 598 // Runs the task if, or defers the task until, the cookies for the given URL
595 // are loaded. 599 // are loaded.
596 void DoCookieTaskForURL(const scoped_refptr<CookieMonsterTask>& task_item, 600 void DoCookieTaskForURL(const scoped_refptr<CookieMonsterTask>& task_item,
597 const GURL& url); 601 const GURL& url);
598 602
603 // Callback used for merging session cookies.
604 void OnGotSessionCookies(const net::CookieList& cookie_list);
605
599 // Histogram variables; see CookieMonster::InitializeHistograms() in 606 // Histogram variables; see CookieMonster::InitializeHistograms() in
600 // cookie_monster.cc for details. 607 // cookie_monster.cc for details.
601 base::Histogram* histogram_expiration_duration_minutes_; 608 base::Histogram* histogram_expiration_duration_minutes_;
602 base::Histogram* histogram_between_access_interval_minutes_; 609 base::Histogram* histogram_between_access_interval_minutes_;
603 base::Histogram* histogram_evicted_last_access_minutes_; 610 base::Histogram* histogram_evicted_last_access_minutes_;
604 base::Histogram* histogram_count_; 611 base::Histogram* histogram_count_;
605 base::Histogram* histogram_domain_count_; 612 base::Histogram* histogram_domain_count_;
606 base::Histogram* histogram_etldp1_count_; 613 base::Histogram* histogram_etldp1_count_;
607 base::Histogram* histogram_domain_per_etldp1_count_; 614 base::Histogram* histogram_domain_per_etldp1_count_;
608 base::Histogram* histogram_number_duplicate_db_cookies_; 615 base::Histogram* histogram_number_duplicate_db_cookies_;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // account, but the RFC doesn't specify this. 773 // account, but the RFC doesn't specify this.
767 // NOTE: Keep this logic in-sync with TrimDuplicateCookiesForHost(). 774 // NOTE: Keep this logic in-sync with TrimDuplicateCookiesForHost().
768 return (name_ == ecc.Name() && domain_ == ecc.Domain() 775 return (name_ == ecc.Name() && domain_ == ecc.Domain()
769 && path_ == ecc.Path()); 776 && path_ == ecc.Path());
770 } 777 }
771 778
772 void SetLastAccessDate(const base::Time& date) { 779 void SetLastAccessDate(const base::Time& date) {
773 last_access_date_ = date; 780 last_access_date_ = date;
774 } 781 }
775 782
783 void SetPersistent(bool is_persistent) {
784 is_persistent_ = is_persistent;
785 }
786
776 bool IsOnPath(const std::string& url_path) const; 787 bool IsOnPath(const std::string& url_path) const;
777 bool IsDomainMatch(const std::string& scheme, const std::string& host) const; 788 bool IsDomainMatch(const std::string& scheme, const std::string& host) const;
778 789
779 std::string DebugString() const; 790 std::string DebugString() const;
780 791
781 // Returns the cookie source when cookies are set for |url|. This function 792 // Returns the cookie source when cookies are set for |url|. This function
782 // is public for unit test purposes only. 793 // is public for unit test purposes only.
783 static std::string GetCookieSourceFromURL(const GURL& url); 794 static std::string GetCookieSourceFromURL(const GURL& url);
784 795
785 private: 796 private:
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 private: 1001 private:
991 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); 1002 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore);
992 }; 1003 };
993 1004
994 class CookieList : public std::vector<CookieMonster::CanonicalCookie> { 1005 class CookieList : public std::vector<CookieMonster::CanonicalCookie> {
995 }; 1006 };
996 1007
997 } // namespace net 1008 } // namespace net
998 1009
999 #endif // NET_BASE_COOKIE_MONSTER_H_ 1010 #endif // NET_BASE_COOKIE_MONSTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698