| OLD | NEW |
| 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 #ifndef NET_COOKIES_PARSED_COOKIE_H_ | 5 #ifndef NET_COOKIES_PARSED_COOKIE_H_ |
| 6 #define NET_COOKIES_PARSED_COOKIE_H_ | 6 #define NET_COOKIES_PARSED_COOKIE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 15 #include "net/cookies/cookie_constants.h" | 15 #include "net/cookies/cookie_constants.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class NET_EXPORT ParsedCookie { | 19 class NET_EXPORT ParsedCookie { |
| 20 public: | 20 public: |
| 21 typedef std::pair<std::string, std::string> TokenValuePair; | 21 typedef std::pair<std::string, std::string> TokenValuePair; |
| 22 typedef std::vector<TokenValuePair> PairList; | 22 typedef std::vector<TokenValuePair> PairList; |
| 23 | 23 |
| 24 // The maximum length of a cookie string we will try to parse | 24 // The maximum length of a cookie string we will try to parse |
| 25 static const size_t kMaxCookieSize = 4096; | 25 static const size_t kMaxCookieSize = 4096; |
| 26 // The maximum number of Token/Value pairs. Shouldn't have more than 8. | |
| 27 static const int kMaxPairs = 16; | |
| 28 | 26 |
| 29 // Construct from a cookie string like "BLAH=1; path=/; domain=.google.com" | 27 // Construct from a cookie string like "BLAH=1; path=/; domain=.google.com" |
| 30 // Format is according to RFC 6265. Cookies with both name and value empty | 28 // Format is according to RFC 6265. Cookies with both name and value empty |
| 31 // will be considered invalid. | 29 // will be considered invalid. |
| 32 ParsedCookie(const std::string& cookie_line); | 30 ParsedCookie(const std::string& cookie_line); |
| 33 ~ParsedCookie(); | 31 ~ParsedCookie(); |
| 34 | 32 |
| 35 // You should not call any other methods except for SetName/SetValue on the | 33 // You should not call any other methods except for SetName/SetValue on the |
| 36 // class if !IsValid. | 34 // class if !IsValid. |
| 37 bool IsValid() const; | 35 bool IsValid() const; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 size_t httponly_index_; | 145 size_t httponly_index_; |
| 148 size_t same_site_index_; | 146 size_t same_site_index_; |
| 149 size_t priority_index_; | 147 size_t priority_index_; |
| 150 | 148 |
| 151 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); | 149 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); |
| 152 }; | 150 }; |
| 153 | 151 |
| 154 } // namespace net | 152 } // namespace net |
| 155 | 153 |
| 156 #endif // NET_COOKIES_PARSED_COOKIE_H_ | 154 #endif // NET_COOKIES_PARSED_COOKIE_H_ |
| OLD | NEW |