| 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 // about why the contains_sensitive_info() field is being explicitly |
| 770 // deserialized. |
| 771 result->set_contains_sensitive_info(ReadBoolean(&obj)); |
| 768 return obj.parse_error ? nullptr : result; | 772 return obj.parse_error ? nullptr : result; |
| 769 } | 773 } |
| 770 | 774 |
| 771 std::string EncodeResourceRequestBody( | 775 std::string EncodeResourceRequestBody( |
| 772 const ResourceRequestBodyImpl& resource_request_body) { | 776 const ResourceRequestBodyImpl& resource_request_body) { |
| 773 SerializeObject obj; | 777 SerializeObject obj; |
| 774 obj.version = kCurrentVersion; | 778 obj.version = kCurrentVersion; |
| 775 WriteResourceRequestBody(resource_request_body, &obj); | 779 WriteResourceRequestBody(resource_request_body, &obj); |
| 780 // EncodeResourceRequestBody() is different from WriteResourceRequestBody() |
| 781 // because it covers additional data (e.g.|contains_sensitive_info|) which |
| 782 // is marshaled between native code and java. WriteResourceRequestBody() |
| 783 // serializes data which needs to be saved out to disk. |
| 784 WriteBoolean(resource_request_body.contains_sensitive_info(), &obj); |
| 776 return obj.GetAsString(); | 785 return obj.GetAsString(); |
| 777 } | 786 } |
| 778 | 787 |
| 779 #endif | 788 #endif |
| 780 | 789 |
| 781 } // namespace content | 790 } // namespace content |
| OLD | NEW |