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