Commit 6e9bf823 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[Passwords] Include all Server Predictions in Internals Log

This change adds all server predictions to the log output in
chrome://password-manager-internals.

Before:
  Server predictions: {
  Signature of form: 8608767706003284200 - 193
  Origin: https://www.dkb.de/
  Action: https://www.dkb.de/
  Form fields:
  j_username: 94183295, type=text, renderer_id = 59, autocomplete=off,
    SERVER_PREDICTION: NAME_FULL
  j_password: 1796512061, type=password, renderer_id = 60, autocomplete=off,
    SERVER_PREDICTION: PASSWORD
  }

After:
  Server predictions: {
  Signature of form: 8608767706003284200 - 193
  Origin: https://www.dkb.de/
  Action: https://www.dkb.de/
  Form fields:
  j_username: 94183295, type=text, renderer_id = 31, autocomplete=off,
    Server Type: NAME_FULL, All Server Predictions: [NAME_FULL, USERNAME]
  j_password: 1796512061, type=password, renderer_id = 32, autocomplete=off,
    Server Type: PASSWORD, All Server Predictions: [PASSWORD]
  }

Bug: 1140493
Change-Id: I3a6e685e02e7d960d4df053cd1b9885c1f509a33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2540610Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827836}
parent cc244f13
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
#include "components/password_manager/core/browser/browser_save_password_progress_logger.h" #include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
#include <string>
#include <utility> #include <utility>
#include <vector>
#include "base/strings/strcat.h" #include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
...@@ -22,6 +24,7 @@ ...@@ -22,6 +24,7 @@
using autofill::AutofillUploadContents; using autofill::AutofillUploadContents;
using autofill::FieldPropertiesFlags; using autofill::FieldPropertiesFlags;
using autofill::FieldTypeToStringPiece;
using autofill::FormStructure; using autofill::FormStructure;
using autofill::PasswordAttribute; using autofill::PasswordAttribute;
using autofill::ServerFieldType; using autofill::ServerFieldType;
...@@ -208,16 +211,23 @@ std::string BrowserSavePasswordProgressLogger::FormStructureToFieldsLogString( ...@@ -208,16 +211,23 @@ std::string BrowserSavePasswordProgressLogger::FormStructureToFieldsLogString(
", autocomplete=" + ScrubElementID(field->autocomplete_attribute); ", autocomplete=" + ScrubElementID(field->autocomplete_attribute);
if (field->server_type() != autofill::NO_SERVER_DATA) { if (field->server_type() != autofill::NO_SERVER_DATA) {
base::StrAppend(
&field_info,
{", Server Type: ", FieldTypeToStringPiece(field->server_type())});
std::vector<std::string> all_predictions;
for (const auto& p : field->server_predictions()) {
all_predictions.emplace_back(
FieldTypeToStringPiece(static_cast<ServerFieldType>(p.type())));
}
base::StrAppend(&field_info, base::StrAppend(&field_info,
{", SERVER_PREDICTION: ", {", All Server Predictions: [",
autofill::AutofillType::ServerFieldTypeToString( base::JoinString(all_predictions, ", "), "]"});
field->server_type())});
} }
for (ServerFieldType type : field->possible_types()) for (ServerFieldType type : field->possible_types())
base::StrAppend( base::StrAppend(&field_info, {", VOTE: ", FieldTypeToStringPiece(type)});
&field_info,
{", VOTE: ", autofill::AutofillType::ServerFieldTypeToString(type)});
if (field->vote_type()) if (field->vote_type())
field_info += ", vote_type=" + VoteTypeToString(field->vote_type()); field_info += ", vote_type=" + VoteTypeToString(field->vote_type());
......
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