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

Unified Diff: content/public/common/page_state.cc

Issue 1987053002: Deduplicating code performing WebHTTPBody::Element conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/data/test_body/g 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/history_serialization.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/common/page_state.cc
diff --git a/content/public/common/page_state.cc b/content/public/common/page_state.cc
index 01240db98591f4823406af4833a69b5d4adba135..74f65df7b97383ed190a6412f334d0ead3a7667f 100644
--- a/content/public/common/page_state.cc
+++ b/content/public/common/page_state.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/files/file_path.h"
+#include "base/strings/nullable_string16.h"
#include "base/strings/utf_string_conversions.h"
#include "content/common/page_state_serialization.h"
@@ -87,17 +88,15 @@ PageState PageState::CreateForTesting(
state.top.http_body.is_null = false;
if (optional_body_data) {
ExplodedHttpBodyElement element;
- element.type = blink::WebHTTPBody::Element::TypeData;
- element.data = optional_body_data;
+ std::string body_data(optional_body_data);
+ element.SetToBytes(body_data.data(), body_data.size());
state.top.http_body.elements.push_back(element);
}
if (optional_body_file_path) {
ExplodedHttpBodyElement element;
- element.type = blink::WebHTTPBody::Element::TypeFile;
- element.file_path =
- ToNullableString16(optional_body_file_path->AsUTF8Unsafe());
- state.top.http_body.elements.push_back(element);
- state.referenced_files.push_back(element.file_path);
+ element.SetToFilePath(*optional_body_file_path);
+ state.referenced_files.push_back(base::NullableString16(
+ optional_body_file_path->AsUTF16Unsafe(), false));
}
state.top.http_body.contains_passwords =
body_contains_password_data;
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/history_serialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698