Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 std::vector<CookieMap::iterator>* cookie_its); | 206 std::vector<CookieMap::iterator>* cookie_its); |
| 207 | 207 |
| 208 bool HasCookieableScheme(const GURL& url); | 208 bool HasCookieableScheme(const GURL& url); |
| 209 | 209 |
| 210 CookieMap cookies_; | 210 CookieMap cookies_; |
| 211 | 211 |
| 212 // Indicates whether the cookie store has been initialized. This happens | 212 // Indicates whether the cookie store has been initialized. This happens |
| 213 // lazily in InitStoreIfNecessary(). | 213 // lazily in InitStoreIfNecessary(). |
| 214 bool initialized_; | 214 bool initialized_; |
| 215 | 215 |
| 216 PersistentCookieStore* store_; | 216 scoped_refptr<PersistentCookieStore> store_; |
| 217 | 217 |
| 218 // The resolution of our time isn't enough, so we do something | 218 // The resolution of our time isn't enough, so we do something |
| 219 // ugly and increment when we've seen the same time twice. | 219 // ugly and increment when we've seen the same time twice. |
| 220 base::Time CurrentTime(); | 220 base::Time CurrentTime(); |
| 221 base::Time last_time_seen_; | 221 base::Time last_time_seen_; |
| 222 | 222 |
| 223 // Minimum delay after updating a cookie's LastAccessDate before we will | 223 // Minimum delay after updating a cookie's LastAccessDate before we will |
| 224 // update it again. | 224 // update it again. |
| 225 const base::TimeDelta last_access_threshold_; | 225 const base::TimeDelta last_access_threshold_; |
| 226 | 226 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 std::string value_; | 360 std::string value_; |
| 361 std::string path_; | 361 std::string path_; |
| 362 base::Time creation_date_; | 362 base::Time creation_date_; |
| 363 base::Time last_access_date_; | 363 base::Time last_access_date_; |
| 364 base::Time expiry_date_; | 364 base::Time expiry_date_; |
| 365 bool has_expires_; | 365 bool has_expires_; |
| 366 bool secure_; | 366 bool secure_; |
| 367 bool httponly_; | 367 bool httponly_; |
| 368 }; | 368 }; |
| 369 | 369 |
| 370 class CookieMonster::PersistentCookieStore { | 370 typedef base::RefCountedThreadSafe<CookieMonster::PersistentCookieStore> |
|
eroman
2009/09/04 23:13:24
hehe.
| |
| 371 RefcountedPersistentCookieStore; | |
| 372 | |
| 373 class CookieMonster::PersistentCookieStore | |
| 374 : public RefcountedPersistentCookieStore { | |
| 371 public: | 375 public: |
| 372 virtual ~PersistentCookieStore() { } | 376 virtual ~PersistentCookieStore() { } |
| 373 | 377 |
| 374 // Initializes the store and retrieves the existing cookies. This will be | 378 // Initializes the store and retrieves the existing cookies. This will be |
| 375 // called only once at startup. | 379 // called only once at startup. |
| 376 virtual bool Load(std::vector<CookieMonster::KeyedCanonicalCookie>*) = 0; | 380 virtual bool Load(std::vector<CookieMonster::KeyedCanonicalCookie>*) = 0; |
| 377 | 381 |
| 378 virtual void AddCookie(const std::string&, const CanonicalCookie&) = 0; | 382 virtual void AddCookie(const std::string&, const CanonicalCookie&) = 0; |
| 379 virtual void UpdateCookieAccessTime(const CanonicalCookie&) = 0; | 383 virtual void UpdateCookieAccessTime(const CanonicalCookie&) = 0; |
| 380 virtual void DeleteCookie(const CanonicalCookie&) = 0; | 384 virtual void DeleteCookie(const CanonicalCookie&) = 0; |
| 381 | 385 |
| 382 protected: | 386 protected: |
| 383 PersistentCookieStore() { } | 387 PersistentCookieStore() { } |
| 384 | 388 |
| 385 private: | 389 private: |
| 386 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 390 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
| 387 }; | 391 }; |
| 388 | 392 |
| 389 } // namespace net | 393 } // namespace net |
| 390 | 394 |
| 391 #endif // NET_BASE_COOKIE_MONSTER_H_ | 395 #endif // NET_BASE_COOKIE_MONSTER_H_ |
| OLD | NEW |