Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: content/common/page_state_serialization.cc

Issue 1907443006: PlzNavigate: store POST data in the FrameNavigationEntry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + addressed comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/page_state_serialization.h ('k') | content/common/resource_request_body.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/pickle.h" 12 #include "base/pickle.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "content/common/resource_request_body.h"
17 #include "ui/display/display.h" 18 #include "ui/display/display.h"
18 #include "ui/display/screen.h" 19 #include "ui/display/screen.h"
19 20
20 namespace content { 21 namespace content {
21 namespace { 22 namespace {
22 23
23 #if defined(OS_ANDROID) 24 #if defined(OS_ANDROID)
24 float g_device_scale_factor_for_testing = 0.0; 25 float g_device_scale_factor_for_testing = 0.0;
25 #endif 26 #endif
26 27
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 } 744 }
744 745
745 bool EncodePageState(const ExplodedPageState& exploded, std::string* encoded) { 746 bool EncodePageState(const ExplodedPageState& exploded, std::string* encoded) {
746 SerializeObject obj; 747 SerializeObject obj;
747 obj.version = kCurrentVersion; 748 obj.version = kCurrentVersion;
748 WritePageState(exploded, &obj); 749 WritePageState(exploded, &obj);
749 *encoded = obj.GetAsString(); 750 *encoded = obj.GetAsString();
750 return true; 751 return true;
751 } 752 }
752 753
754 bool GeneratePostData(const ExplodedHttpBody& exploded,
755 ResourceRequestBody* http_body) {
756 if (exploded.is_null)
757 return false;
758
759 http_body->set_identifier(exploded.identifier);
760 for (auto element : exploded.elements)
761 http_body->AppendExplodedHTTPBodyElement(element);
762
763 return true;
764 }
765
753 #if defined(OS_ANDROID) 766 #if defined(OS_ANDROID)
754 bool DecodePageStateWithDeviceScaleFactorForTesting( 767 bool DecodePageStateWithDeviceScaleFactorForTesting(
755 const std::string& encoded, 768 const std::string& encoded,
756 float device_scale_factor, 769 float device_scale_factor,
757 ExplodedPageState* exploded) { 770 ExplodedPageState* exploded) {
758 g_device_scale_factor_for_testing = device_scale_factor; 771 g_device_scale_factor_for_testing = device_scale_factor;
759 bool rv = DecodePageState(encoded, exploded); 772 bool rv = DecodePageState(encoded, exploded);
760 g_device_scale_factor_for_testing = 0.0; 773 g_device_scale_factor_for_testing = 0.0;
761 return rv; 774 return rv;
762 } 775 }
763 #endif 776 #endif
764 777
765 } // namespace content 778 } // namespace content
OLDNEW
« no previous file with comments | « content/common/page_state_serialization.h ('k') | content/common/resource_request_body.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698