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 #include "content/common/page_state_serialization.h" | 5 #include "content/common/page_state_serialization.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 758 g_device_scale_factor_for_testing = 0.0; | 758 g_device_scale_factor_for_testing = 0.0; |
| 759 return rv; | 759 return rv; |
| 760 } | 760 } |
| 761 | 761 |
| 762 scoped_refptr<ResourceRequestBodyImpl> DecodeResourceRequestBody( | 762 scoped_refptr<ResourceRequestBodyImpl> DecodeResourceRequestBody( |
| 763 const char* data, | 763 const char* data, |
| 764 size_t size) { | 764 size_t size) { |
| 765 scoped_refptr<ResourceRequestBodyImpl> result = new ResourceRequestBodyImpl(); | 765 scoped_refptr<ResourceRequestBodyImpl> result = new ResourceRequestBodyImpl(); |
| 766 SerializeObject obj(data, static_cast<int>(size)); | 766 SerializeObject obj(data, static_cast<int>(size)); |
| 767 ReadResourceRequestBody(&obj, result); | 767 ReadResourceRequestBody(&obj, result); |
| 768 // Please see the EncodeResourceRequestBody() function below for information | |
| 769 // this is being explicitl deserialized. | |
|
Łukasz Anforowicz
2016/10/15 00:02:27
nit:explicitly
nit:s/this/that/
ananta
2016/10/15 00:23:31
Done.
| |
| 770 result->set_contains_sensitive_info(ReadBoolean(&obj)); | |
| 768 return obj.parse_error ? nullptr : result; | 771 return obj.parse_error ? nullptr : result; |
| 769 } | 772 } |
| 770 | 773 |
| 771 std::string EncodeResourceRequestBody( | 774 std::string EncodeResourceRequestBody( |
| 772 const ResourceRequestBodyImpl& resource_request_body) { | 775 const ResourceRequestBodyImpl& resource_request_body) { |
| 773 SerializeObject obj; | 776 SerializeObject obj; |
| 774 obj.version = kCurrentVersion; | 777 obj.version = kCurrentVersion; |
| 775 WriteResourceRequestBody(resource_request_body, &obj); | 778 WriteResourceRequestBody(resource_request_body, &obj); |
| 779 // We are serializing the contains_sensitive_info() field explicitly to avoid | |
| 780 // changing the WriteResourceRequestBody function which would require a | |
| 781 // PageState version update. | |
|
Łukasz Anforowicz
2016/10/15 00:02:27
Maybe we could tweak the comment to say why Encode
ananta
2016/10/15 00:23:31
Done.
| |
| 782 WriteBoolean(resource_request_body.contains_sensitive_info(), &obj); | |
| 776 return obj.GetAsString(); | 783 return obj.GetAsString(); |
| 777 } | 784 } |
| 778 | 785 |
| 779 #endif | 786 #endif |
| 780 | 787 |
| 781 } // namespace content | 788 } // namespace content |
| OLD | NEW |