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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #ifdef UNIT_TEST | 62 #ifdef UNIT_TEST |
63 CookieMonster(int last_access_threshold_milliseconds) | 63 CookieMonster(int last_access_threshold_milliseconds) |
64 : initialized_(false), | 64 : initialized_(false), |
65 store_(NULL), | 65 store_(NULL), |
66 last_access_threshold_(base::TimeDelta::FromMilliseconds( | 66 last_access_threshold_(base::TimeDelta::FromMilliseconds( |
67 last_access_threshold_milliseconds)) { | 67 last_access_threshold_milliseconds)) { |
68 SetDefaultCookieableSchemes(); | 68 SetDefaultCookieableSchemes(); |
69 } | 69 } |
70 #endif | 70 #endif |
71 | 71 |
72 ~CookieMonster(); | |
73 | |
74 // Parse the string with the cookie time (very forgivingly). | 72 // Parse the string with the cookie time (very forgivingly). |
75 static base::Time ParseCookieTime(const std::string& time_string); | 73 static base::Time ParseCookieTime(const std::string& time_string); |
76 | 74 |
77 // CookieStore implementation. | 75 // CookieStore implementation. |
78 virtual bool SetCookie(const GURL& url, const std::string& cookie_line); | 76 virtual bool SetCookie(const GURL& url, const std::string& cookie_line); |
79 virtual bool SetCookieWithOptions(const GURL& url, | 77 virtual bool SetCookieWithOptions(const GURL& url, |
80 const std::string& cookie_line, | 78 const std::string& cookie_line, |
81 const CookieOptions& options); | 79 const CookieOptions& options); |
82 virtual bool SetCookieWithCreationTime(const GURL& url, | 80 virtual bool SetCookieWithCreationTime(const GURL& url, |
83 const std::string& cookie_line, | 81 const std::string& cookie_line, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 void SetCookieableSchemes(const char* schemes[], size_t num_schemes); | 127 void SetCookieableSchemes(const char* schemes[], size_t num_schemes); |
130 | 128 |
131 // There are some unknowns about how to correctly handle file:// cookies, | 129 // There are some unknowns about how to correctly handle file:// cookies, |
132 // and our implementation for this is not robust enough. This allows you | 130 // and our implementation for this is not robust enough. This allows you |
133 // to enable support, but it should only be used for testing. Bug 1157243. | 131 // to enable support, but it should only be used for testing. Bug 1157243. |
134 // Must be called before creating a CookieMonster instance. | 132 // Must be called before creating a CookieMonster instance. |
135 static void EnableFileScheme(); | 133 static void EnableFileScheme(); |
136 static bool enable_file_scheme_; | 134 static bool enable_file_scheme_; |
137 | 135 |
138 private: | 136 private: |
| 137 ~CookieMonster(); |
| 138 |
139 // Called by all non-static functions to ensure that the cookies store has | 139 // Called by all non-static functions to ensure that the cookies store has |
140 // been initialized. This is not done during creating so it doesn't block | 140 // been initialized. This is not done during creating so it doesn't block |
141 // the window showing. | 141 // the window showing. |
142 // Note: this method should always be called with lock_ held. | 142 // Note: this method should always be called with lock_ held. |
143 void InitIfNecessary() { | 143 void InitIfNecessary() { |
144 if (!initialized_) { | 144 if (!initialized_) { |
145 if (store_) | 145 if (store_) |
146 InitStore(); | 146 InitStore(); |
147 initialized_ = true; | 147 initialized_ = true; |
148 } | 148 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 protected: | 389 protected: |
390 PersistentCookieStore() { } | 390 PersistentCookieStore() { } |
391 | 391 |
392 private: | 392 private: |
393 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 393 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
394 }; | 394 }; |
395 | 395 |
396 } // namespace net | 396 } // namespace net |
397 | 397 |
398 #endif // NET_BASE_COOKIE_MONSTER_H_ | 398 #endif // NET_BASE_COOKIE_MONSTER_H_ |
OLD | NEW |