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

Unified Diff: components/autofill/content/public/cpp/autofill_types_struct_traits.cc

Issue 1999623002: [Autofill] Add typemap for autofill:FormFieldData and autofill::FormData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gyp 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
Index: components/autofill/content/public/cpp/autofill_types_struct_traits.cc
diff --git a/components/autofill/content/public/cpp/autofill_types_struct_traits.cc b/components/autofill/content/public/cpp/autofill_types_struct_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..522a87c03ae3065e7a1c08441a0c3f4db01502a9
--- /dev/null
+++ b/components/autofill/content/public/cpp/autofill_types_struct_traits.cc
@@ -0,0 +1,71 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/autofill/content/public/cpp/autofill_types_struct_traits.h"
+
+#include "url/mojo/url_gurl_struct_traits.h"
+
+namespace mojo {
+
+// static
+bool StructTraits<autofill::mojom::FormFieldData, autofill::FormFieldData>::
+ Read(autofill::mojom::FormFieldDataDataView data,
+ autofill::FormFieldData* out) {
+ if (!data.ReadLabel(&out->label))
+ return false;
+ if (!data.ReadName(&out->name))
+ return false;
+ if (!data.ReadValue(&out->value))
+ return false;
+
+ if (!data.ReadFormControlType(&out->form_control_type))
+ return false;
+ if (!data.ReadAutocompleteAttribute(&out->autocomplete_attribute))
+ return false;
+
+ if (!data.ReadPlaceholder(&out->placeholder))
+ return false;
+
+ out->max_length = data.max_length();
+ out->is_autofilled = data.is_autofilled();
+ out->is_checked = data.is_checked();
+ out->is_checkable = data.is_checkable();
+ out->is_focusable = data.is_focusable();
+ out->should_autocomplete = data.should_autocomplete();
+
+ // TODO(leonhsl): enum translation.
+ out->role = static_cast<autofill::FormFieldData::RoleAttribute>(data.role());
dcheng 2016/05/23 20:43:44 Is this being used already? It looks like it's jus
leonhsl(Using Gerrit) 2016/05/24 06:38:20 Yeah it's just introduced. Addressed all TODOs of
+ // TODO(leonhsl): enum translation.
+ out->text_direction =
+ static_cast<base::i18n::TextDirection>(data.text_direction());
+
+ if (!data.ReadOptionValues(&out->option_values))
+ return false;
+ if (!data.ReadOptionContents(&out->option_contents))
+ return false;
+
+ return true;
+}
+
+// static
+bool StructTraits<autofill::mojom::FormData, autofill::FormData>::Read(
+ autofill::mojom::FormDataDataView data,
+ autofill::FormData* out) {
+ if (!data.ReadName(&out->name))
+ return false;
+ if (!data.ReadOrigin(&out->origin))
+ return false;
+ if (!data.ReadAction(&out->action))
+ return false;
+
+ out->is_form_tag = data.is_form_tag();
+ out->is_formless_checkout = data.is_formless_checkout();
+
+ if (!data.ReadFields(&out->fields))
+ return false;
+
+ return true;
+}
+
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698