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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 676 | 676 |
| 677 ExplodedHttpBodyElement::~ExplodedHttpBodyElement() { | 677 ExplodedHttpBodyElement::~ExplodedHttpBodyElement() { |
| 678 } | 678 } |
| 679 | 679 |
| 680 ExplodedHttpBody::ExplodedHttpBody() | 680 ExplodedHttpBody::ExplodedHttpBody() |
| 681 : identifier(0), | 681 : identifier(0), |
| 682 contains_passwords(false), | 682 contains_passwords(false), |
| 683 is_null(true) { | 683 is_null(true) { |
| 684 } | 684 } |
| 685 | 685 |
| 686 ExplodedHttpBody::ExplodedHttpBody(const ExplodedHttpBody& other) = default; | |
| 687 | |
| 686 ExplodedHttpBody::~ExplodedHttpBody() { | 688 ExplodedHttpBody::~ExplodedHttpBody() { |
| 687 } | 689 } |
| 688 | 690 |
| 689 ExplodedFrameState::ExplodedFrameState() | 691 ExplodedFrameState::ExplodedFrameState() |
| 690 : scroll_restoration_type(blink::WebHistoryScrollRestorationAuto), | 692 : scroll_restoration_type(blink::WebHistoryScrollRestorationAuto), |
| 691 item_sequence_number(0), | 693 item_sequence_number(0), |
| 692 document_sequence_number(0), | 694 document_sequence_number(0), |
| 693 page_scale_factor(0.0), | 695 page_scale_factor(0.0), |
| 694 referrer_policy(blink::WebReferrerPolicyDefault) { | 696 referrer_policy(blink::WebReferrerPolicyDefault) { |
| 695 } | 697 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 } | 743 } |
| 742 | 744 |
| 743 bool EncodePageState(const ExplodedPageState& exploded, std::string* encoded) { | 745 bool EncodePageState(const ExplodedPageState& exploded, std::string* encoded) { |
| 744 SerializeObject obj; | 746 SerializeObject obj; |
| 745 obj.version = kCurrentVersion; | 747 obj.version = kCurrentVersion; |
| 746 WritePageState(exploded, &obj); | 748 WritePageState(exploded, &obj); |
| 747 *encoded = obj.GetAsString(); | 749 *encoded = obj.GetAsString(); |
| 748 return true; | 750 return true; |
| 749 } | 751 } |
| 750 | 752 |
| 753 bool GeneratePostData(const ExplodedHttpBody exploded, | |
|
Charlie Reis
2016/04/27 23:00:55
I'm not following why we need this. Was this code
clamy
2016/04/29 16:07:16
We need it because we have code to generate a WebH
| |
| 754 ResourceRequestBody* http_body) { | |
| 755 if (exploded.is_null) | |
| 756 return false; | |
| 757 | |
| 758 http_body->set_identifier(exploded.identifier); | |
| 759 for (auto element : exploded.elements) | |
| 760 http_body->AppendExplodedHTTPBodyElement(element); | |
| 761 | |
| 762 return true; | |
| 763 } | |
| 764 | |
| 751 #if defined(OS_ANDROID) | 765 #if defined(OS_ANDROID) |
| 752 bool DecodePageStateWithDeviceScaleFactorForTesting( | 766 bool DecodePageStateWithDeviceScaleFactorForTesting( |
| 753 const std::string& encoded, | 767 const std::string& encoded, |
| 754 float device_scale_factor, | 768 float device_scale_factor, |
| 755 ExplodedPageState* exploded) { | 769 ExplodedPageState* exploded) { |
| 756 g_device_scale_factor_for_testing = device_scale_factor; | 770 g_device_scale_factor_for_testing = device_scale_factor; |
| 757 bool rv = DecodePageState(encoded, exploded); | 771 bool rv = DecodePageState(encoded, exploded); |
| 758 g_device_scale_factor_for_testing = 0.0; | 772 g_device_scale_factor_for_testing = 0.0; |
| 759 return rv; | 773 return rv; |
| 760 } | 774 } |
| 761 #endif | 775 #endif |
| 762 | 776 |
| 763 } // namespace content | 777 } // namespace content |
| OLD | NEW |