| 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 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
| 6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
| 7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
| 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 9 * | 9 * |
| 10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } | 417 } |
| 418 } | 418 } |
| 419 | 419 |
| 420 bool ParsedCookie::SetBool(size_t* index, | 420 bool ParsedCookie::SetBool(size_t* index, |
| 421 const std::string& key, | 421 const std::string& key, |
| 422 bool value) { | 422 bool value) { |
| 423 if (!value) { | 423 if (!value) { |
| 424 ClearAttributePair(*index); | 424 ClearAttributePair(*index); |
| 425 return true; | 425 return true; |
| 426 } else { | 426 } else { |
| 427 return SetAttributePair(index, key, ""); | 427 return SetAttributePair(index, key, std::string()); |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 | 430 |
| 431 bool ParsedCookie::SetAttributePair(size_t* index, | 431 bool ParsedCookie::SetAttributePair(size_t* index, |
| 432 const std::string& key, | 432 const std::string& key, |
| 433 const std::string& value) { | 433 const std::string& value) { |
| 434 if (!IsValidToken(key) || !IsValidCookieAttributeValue(value)) | 434 if (!IsValidToken(key) || !IsValidCookieAttributeValue(value)) |
| 435 return false; | 435 return false; |
| 436 if (!IsValid()) | 436 if (!IsValid()) |
| 437 return false; | 437 return false; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 456 for (size_t i = 0; i < arraysize(indexes); ++i) { | 456 for (size_t i = 0; i < arraysize(indexes); ++i) { |
| 457 if (*indexes[i] == index) | 457 if (*indexes[i] == index) |
| 458 *indexes[i] = 0; | 458 *indexes[i] = 0; |
| 459 else if (*indexes[i] > index) | 459 else if (*indexes[i] > index) |
| 460 --*indexes[i]; | 460 --*indexes[i]; |
| 461 } | 461 } |
| 462 pairs_.erase(pairs_.begin() + index); | 462 pairs_.erase(pairs_.begin() + index); |
| 463 } | 463 } |
| 464 | 464 |
| 465 } // namespace | 465 } // namespace |
| OLD | NEW |