Commit 40d13ba1 authored by sebsg's avatar sebsg Committed by Commit Bot

[AF] Add section annotation to the Autofill prediction title.

Bug: 835994
Change-Id: I817b6ced87513054339397f825f695019cd68a36
Reviewed-on: https://chromium-review.googlesource.com/1025043Reviewed-by: default avatarEmily Stark <estark@chromium.org>
Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Commit-Queue: Sebastien Seguin-Gagnon <sebsg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553620}
parent 805c043e
......@@ -151,6 +151,7 @@ struct FormFieldDataPredictions {
string server_type;
string overall_type;
string parseable_name;
string section;
};
// autofill::FormDataPredictions
......
......@@ -643,6 +643,8 @@ bool StructTraits<autofill::mojom::FormFieldDataPredictionsDataView,
return false;
if (!data.ReadParseableName(&out->parseable_name))
return false;
if (!data.ReadSection(&out->section))
return false;
return true;
}
......
......@@ -287,6 +287,11 @@ struct StructTraits<autofill::mojom::FormFieldDataPredictionsDataView,
return r.parseable_name;
}
static const std::string& section(
const autofill::FormFieldDataPredictions& r) {
return r.section;
}
static bool Read(autofill::mojom::FormFieldDataPredictionsDataView data,
autofill::FormFieldDataPredictions* out);
};
......
......@@ -31,6 +31,7 @@ void CreateTestFieldDataPredictions(const std::string& signature,
field_predict->server_type = "TestServerType";
field_predict->overall_type = "TestOverallType";
field_predict->parseable_name = "TestParseableName";
field_predict->section = "TestSection";
}
void CreateTestPasswordFormFillData(PasswordFormFillData* fill_data) {
......
......@@ -437,6 +437,8 @@ bool FormCache::ShowPredictions(const FormDataPredictions& form,
title += base::UTF16ToUTF8(truncated_label);
title += "\nparseable name: ";
title += field.parseable_name;
title += "\nsection: ";
title += field.section;
title += "\nfield signature: ";
title += field.signature;
title += "\nform signature: ";
......
......@@ -583,6 +583,7 @@ std::vector<FormDataPredictions> FormStructure::GetFieldTypePredictions(
annotated_field.overall_type = field->Type().ToString();
annotated_field.parseable_name =
base::UTF16ToUTF8(field->parseable_name());
annotated_field.section = field->section();
form.fields.push_back(annotated_field);
}
......
......@@ -16,8 +16,8 @@ FormFieldDataPredictions::FormFieldDataPredictions(
heuristic_type(other.heuristic_type),
server_type(other.server_type),
overall_type(other.overall_type),
parseable_name(other.parseable_name) {
}
parseable_name(other.parseable_name),
section(other.section) {}
FormFieldDataPredictions::~FormFieldDataPredictions() {
}
......@@ -29,7 +29,8 @@ bool FormFieldDataPredictions::operator==(
heuristic_type == predictions.heuristic_type &&
server_type == predictions.server_type &&
overall_type == predictions.overall_type &&
parseable_name == predictions.parseable_name);
parseable_name == predictions.parseable_name &&
section == predictions.section);
}
bool FormFieldDataPredictions::operator!=(
......
......@@ -24,6 +24,7 @@ struct FormFieldDataPredictions {
std::string server_type;
std::string overall_type;
std::string parseable_name;
std::string section;
// Added for the sake of testing.
bool operator==(const FormFieldDataPredictions& predictions) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment