| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // Sets a key/value pair for a cookie. |index| has to point to one of the | 105 // Sets a key/value pair for a cookie. |index| has to point to one of the |
| 106 // |*_index_| fields in ParsedCookie and is updated to the position where | 106 // |*_index_| fields in ParsedCookie and is updated to the position where |
| 107 // the key/value pair is set in |pairs_|. Accordingly, |key| has to correspond | 107 // the key/value pair is set in |pairs_|. Accordingly, |key| has to correspond |
| 108 // to the token matching |index|. If |value| contains invalid characters, the | 108 // to the token matching |index|. If |value| contains invalid characters, the |
| 109 // cookie parameter is not changed and the function returns false. | 109 // cookie parameter is not changed and the function returns false. |
| 110 // If |value| is empty/false the key/value pair is removed. | 110 // If |value| is empty/false the key/value pair is removed. |
| 111 bool SetString(size_t* index, | 111 bool SetString(size_t* index, |
| 112 const std::string& key, | 112 const std::string& key, |
| 113 const std::string& value); | 113 const std::string& value); |
| 114 bool SetBool(size_t* index, | 114 bool SetBool(size_t* index, const std::string& key, bool value); |
| 115 const std::string& key, | |
| 116 bool value); | |
| 117 | 115 |
| 118 // Helper function for SetString and SetBool handling the case that the | 116 // Helper function for SetString and SetBool handling the case that the |
| 119 // key/value pair shall not be removed. | 117 // key/value pair shall not be removed. |
| 120 bool SetAttributePair(size_t* index, | 118 bool SetAttributePair(size_t* index, |
| 121 const std::string& key, | 119 const std::string& key, |
| 122 const std::string& value); | 120 const std::string& value); |
| 123 | 121 |
| 124 // Removes the key/value pair from a cookie that is identified by |index|. | 122 // Removes the key/value pair from a cookie that is identified by |index|. |
| 125 // |index| refers to a position in |pairs_|. | 123 // |index| refers to a position in |pairs_|. |
| 126 void ClearAttributePair(size_t index); | 124 void ClearAttributePair(size_t index); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 138 size_t secure_index_; | 136 size_t secure_index_; |
| 139 size_t httponly_index_; | 137 size_t httponly_index_; |
| 140 size_t priority_index_; | 138 size_t priority_index_; |
| 141 | 139 |
| 142 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); | 140 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); |
| 143 }; | 141 }; |
| 144 | 142 |
| 145 } // namespace net | 143 } // namespace net |
| 146 | 144 |
| 147 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 145 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
| OLD | NEW |