Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef NET_COOKIES_COOKIE_CONSTANTS_H_ | 5 #ifndef NET_COOKIES_COOKIE_CONSTANTS_H_ | 
| 6 #define NET_COOKIES_COOKIE_CONSTANTS_H_ | 6 #define NET_COOKIES_COOKIE_CONSTANTS_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" | 
| 11 | 11 | 
| 12 namespace net { | 12 namespace net { | 
| 13 | 13 | 
| 14 enum CookiePriority { | 14 enum CookiePriority { | 
| 15 COOKIE_PRIORITY_LOW = 0, | 15 COOKIE_PRIORITY_LOW = 0, | 
| 16 COOKIE_PRIORITY_MEDIUM = 1, | 16 COOKIE_PRIORITY_MEDIUM = 1, | 
| 17 COOKIE_PRIORITY_HIGH = 2, | 17 COOKIE_PRIORITY_HIGH = 2, | 
| 18 COOKIE_PRIORITY_DEFAULT = COOKIE_PRIORITY_MEDIUM | 18 COOKIE_PRIORITY_DEFAULT = COOKIE_PRIORITY_MEDIUM | 
| 19 }; | 19 }; | 
| 20 | 20 | 
| 21 enum CookieSameSite { | |
| 
 
mmenke
2016/03/11 18:08:30
Can we make this an enum class instead?  Seems sim
 
Mike West
2016/03/14 10:18:54
Sure.
 
 | |
| 22 COOKIE_SAME_SITE_NONE = 0, | |
| 
 
mmenke
2016/03/11 18:08:30
SAME_SITE_NONE seems kinda weird as a property of
 
Mike West
2016/03/14 10:18:53
`CookieSameSite::NO_RESTRICTION`?
 
 | |
| 23 COOKIE_SAME_SITE_LAX = 1, | |
| 24 COOKIE_SAME_SITE_STRICT = 2, | |
| 25 COOKIE_SAME_SITE_DEFAULT = COOKIE_SAME_SITE_NONE | |
| 26 }; | |
| 27 | |
| 21 // Returns the Set-Cookie header priority token corresponding to |priority|. | 28 // Returns the Set-Cookie header priority token corresponding to |priority|. | 
| 22 NET_EXPORT const std::string CookiePriorityToString(CookiePriority priority); | 29 NET_EXPORT const std::string CookiePriorityToString(CookiePriority priority); | 
| 23 | 30 | 
| 24 // Converts the Set-Cookie header priority token |priority| to a CookiePriority. | 31 // Converts the Set-Cookie header priority token |priority| to a CookiePriority. | 
| 25 // Defaults to COOKIE_PRIORITY_DEFAULT for empty or unrecognized strings. | 32 // Defaults to COOKIE_PRIORITY_DEFAULT for empty or unrecognized strings. | 
| 26 NET_EXPORT CookiePriority StringToCookiePriority(const std::string& priority); | 33 NET_EXPORT CookiePriority StringToCookiePriority(const std::string& priority); | 
| 27 | 34 | 
| 35 // Returns the Set-Cookie header SameSite token corresponding to |samesite|. | |
| 36 NET_EXPORT const std::string CookieSameSiteToString(CookieSameSite samesite); | |
| 
 
mmenke
2016/03/11 18:08:30
This const seems weird (As does the one in CookieP
 
mmenke
2016/03/11 18:08:30
same_site is what we use everywhere else (x4, for
 
Mike West
2016/03/14 10:18:54
Removed.
 
 | |
| 37 | |
| 38 // Converst the Set-Cookie header SameSite token |samesite| to a CookieSameSite. | |
| 39 // Defaults to COOKIE_SAME_SITE_DEFAULT for empty or unrecognized strings. | |
| 40 NET_EXPORT CookieSameSite StringToCookieSameSite(const std::string& samesite); | |
| 41 | |
| 28 } // namespace net | 42 } // namespace net | 
| 29 | 43 | 
| 30 #endif // NET_COOKIES_COOKIE_CONSTANTS_H_ | 44 #endif // NET_COOKIES_COOKIE_CONSTANTS_H_ | 
| OLD | NEW |