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

Side by Side Diff: content/public/common/page_state.cc

Issue 2181753002: Simplify EncodePageState to return no value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/public/common/page_state.h" 5 #include "content/public/common/page_state.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/nullable_string16.h" 10 #include "base/strings/nullable_string16.h"
(...skipping 14 matching lines...) Expand all
25 void ToFilePathVector(const std::vector<base::NullableString16>& input, 25 void ToFilePathVector(const std::vector<base::NullableString16>& input,
26 std::vector<base::FilePath>* output) { 26 std::vector<base::FilePath>* output) {
27 output->clear(); 27 output->clear();
28 output->reserve(input.size()); 28 output->reserve(input.size());
29 for (size_t i = 0; i < input.size(); ++i) 29 for (size_t i = 0; i < input.size(); ++i)
30 output->push_back(ToFilePath(input[i])); 30 output->push_back(ToFilePath(input[i]));
31 } 31 }
32 32
33 PageState ToPageState(const ExplodedPageState& state) { 33 PageState ToPageState(const ExplodedPageState& state) {
34 std::string encoded_data; 34 std::string encoded_data;
35 if (!EncodePageState(state, &encoded_data)) 35 EncodePageState(state, &encoded_data);
36 return PageState();
37
38 return PageState::CreateFromEncodedData(encoded_data); 36 return PageState::CreateFromEncodedData(encoded_data);
39 } 37 }
40 38
41 void RecursivelyRemovePasswordData(ExplodedFrameState* state) { 39 void RecursivelyRemovePasswordData(ExplodedFrameState* state) {
42 if (state->http_body.contains_passwords) 40 if (state->http_body.contains_passwords)
43 state->http_body = ExplodedHttpBody(); 41 state->http_body = ExplodedHttpBody();
44 } 42 }
45 43
46 void RecursivelyRemoveScrollOffset(ExplodedFrameState* state) { 44 void RecursivelyRemoveScrollOffset(ExplodedFrameState* state) {
47 state->scroll_offset = gfx::Point(); 45 state->scroll_offset = gfx::Point();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 164 }
167 165
168 PageState::PageState(const std::string& data) 166 PageState::PageState(const std::string& data)
169 : data_(data) { 167 : data_(data) {
170 // TODO(darin): Enable this DCHECK once tests have been fixed up to not pass 168 // TODO(darin): Enable this DCHECK once tests have been fixed up to not pass
171 // bogus encoded data to CreateFromEncodedData. 169 // bogus encoded data to CreateFromEncodedData.
172 //DCHECK(IsValid()); 170 //DCHECK(IsValid());
173 } 171 }
174 172
175 } // namespace content 173 } // namespace content
OLDNEW
« no previous file with comments | « content/common/page_state_serialization_unittest.cc ('k') | content/renderer/history_serialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698