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

Unified Diff: components/autofill/core/common/form_data.cc

Issue 980583002: Serialize form_data in Gnome keyring password store service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style fix Created 5 years, 9 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 | « components/autofill/core/common/form_data.h ('k') | components/autofill/core/common/form_data_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/common/form_data.cc
diff --git a/components/autofill/core/common/form_data.cc b/components/autofill/core/common/form_data.cc
index 2edd5ecc526009dc32eea6108436e514e0720a69..8842f0f42bb22af3b9869a96e059fe6cf374db10 100644
--- a/components/autofill/core/common/form_data.cc
+++ b/components/autofill/core/common/form_data.cc
@@ -4,6 +4,7 @@
#include "components/autofill/core/common/form_data.h"
+#include "base/base64.h"
#include "base/pickle.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -124,6 +125,15 @@ void SerializeFormData(const FormData& form_data, Pickle* pickle) {
pickle->WriteBool(form_data.is_form_tag);
}
+void SerializeFormDataToBase64String(const FormData& form_data,
+ std::string* output) {
+ Pickle pickle;
+ SerializeFormData(form_data, &pickle);
+ Base64Encode(
+ base::StringPiece(static_cast<const char*>(pickle.data()), pickle.size()),
+ output);
+}
+
bool DeserializeFormData(PickleIterator* iter, FormData* form_data) {
int version;
if (!iter->ReadInt(&version)) {
@@ -169,4 +179,15 @@ bool DeserializeFormData(PickleIterator* iter, FormData* form_data) {
return true;
}
+bool DeserializeFormDataFromBase64String(const base::StringPiece& input,
+ FormData* form_data) {
+ if (input.empty())
+ return false;
+ std::string pickle_data;
+ Base64Decode(input, &pickle_data);
+ Pickle pickle(pickle_data.data(), static_cast<int>(pickle_data.size()));
+ PickleIterator iter(pickle);
+ return DeserializeFormData(&iter, form_data);
+}
+
} // namespace autofill
« no previous file with comments | « components/autofill/core/common/form_data.h ('k') | components/autofill/core/common/form_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698