Commit 5c9e6b5a authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[Passwords] Add PasswordForm alias to password_manager namespace

This change adds a PasswordForm alias to the password_manager namespace
and drops last references to PasswordForm in the autofill component.

Bug: 1067347
Change-Id: I1afc94f08fa4e18859baf9f233890f1a392148f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424304Reviewed-by: default avatarVadym Doroshenko  <dvadym@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809741}
parent 9c164b00
...@@ -56,10 +56,6 @@ mojom("mojo_types") { ...@@ -56,10 +56,6 @@ mojom("mojo_types") {
mojom = "autofill.mojom.PasswordAndMetadata" mojom = "autofill.mojom.PasswordAndMetadata"
cpp = "::autofill::PasswordAndMetadata" cpp = "::autofill::PasswordAndMetadata"
}, },
{
mojom = "autofill.mojom.PasswordForm"
cpp = "::autofill::PasswordForm"
},
{ {
mojom = "autofill.mojom.PasswordFormFieldPredictionMap" mojom = "autofill.mojom.PasswordFormFieldPredictionMap"
cpp = "::autofill::PasswordFormFieldPredictionMap" cpp = "::autofill::PasswordFormFieldPredictionMap"
......
...@@ -239,13 +239,6 @@ void ExpectPasswordGenerationUIData( ...@@ -239,13 +239,6 @@ void ExpectPasswordGenerationUIData(
std::move(closure).Run(); std::move(closure).Run();
} }
void ExpectPasswordForm(const PasswordForm& expected,
base::OnceClosure closure,
const PasswordForm& passed) {
EXPECT_EQ(expected, passed);
std::move(closure).Run();
}
TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldData) { TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldData) {
FormFieldData input; FormFieldData input;
test::CreateTestSelectField("TestLabel", "TestName", "TestValue", kOptions, test::CreateTestSelectField("TestLabel", "TestName", "TestValue", kOptions,
......
...@@ -84,6 +84,16 @@ std::string ToString(const T& obj) { ...@@ -84,6 +84,16 @@ std::string ToString(const T& obj) {
return ostream.str(); return ostream.str();
} }
base::string16 ValueElementVectorToString(
const ValueElementVector& value_element_pairs) {
std::vector<base::string16> pairs(value_element_pairs.size());
std::transform(value_element_pairs.begin(), value_element_pairs.end(),
pairs.begin(), [](const ValueElementPair& p) {
return p.first + base::ASCIIToUTF16("+") + p.second;
});
return base::JoinString(pairs, base::ASCIIToUTF16(", "));
}
// Serializes a PasswordForm to a JSON object. Used only for logging in tests. // Serializes a PasswordForm to a JSON object. Used only for logging in tests.
void PasswordFormToJSON(const PasswordForm& form, void PasswordFormToJSON(const PasswordForm& form,
base::DictionaryValue* target) { base::DictionaryValue* target) {
...@@ -256,16 +266,6 @@ bool ArePasswordFormUniqueKeysEqual(const PasswordForm& left, ...@@ -256,16 +266,6 @@ bool ArePasswordFormUniqueKeysEqual(const PasswordForm& left,
left.password_element == right.password_element); left.password_element == right.password_element);
} }
base::string16 ValueElementVectorToString(
const ValueElementVector& value_element_pairs) {
std::vector<base::string16> pairs(value_element_pairs.size());
std::transform(value_element_pairs.begin(), value_element_pairs.end(),
pairs.begin(), [](const ValueElementPair& p) {
return p.first + base::ASCIIToUTF16("+") + p.second;
});
return base::JoinString(pairs, base::ASCIIToUTF16(", "));
}
std::ostream& operator<<(std::ostream& os, PasswordForm::Scheme scheme) { std::ostream& operator<<(std::ostream& os, PasswordForm::Scheme scheme) {
return os << ToString(scheme); return os << ToString(scheme);
} }
......
...@@ -48,7 +48,8 @@ using ValueElementVector = std::vector<ValueElementPair>; ...@@ -48,7 +48,8 @@ using ValueElementVector = std::vector<ValueElementPair>;
// The field descriptions in the struct specification below are intended to // The field descriptions in the struct specification below are intended to
// describe which fields are not strictly required when adding a saved password // describe which fields are not strictly required when adding a saved password
// entry to the database and how they can affect the matching process. // entry to the database and how they can affect the matching process.
//
// TODO(crbug.com/1067347): Move complete class to password_manager namespace.
struct PasswordForm { struct PasswordForm {
// Enum to differentiate between HTML form based authentication, and dialogs // Enum to differentiate between HTML form based authentication, and dialogs
// using basic or digest schemes. Default is kHtml. Only PasswordForms of the // using basic or digest schemes. Default is kHtml. Only PasswordForms of the
...@@ -377,10 +378,6 @@ struct PasswordForm { ...@@ -377,10 +378,6 @@ struct PasswordForm {
bool ArePasswordFormUniqueKeysEqual(const PasswordForm& left, bool ArePasswordFormUniqueKeysEqual(const PasswordForm& left,
const PasswordForm& right); const PasswordForm& right);
// Converts a vector of ValueElementPair to string.
base::string16 ValueElementVectorToString(
const ValueElementVector& value_element_pairs);
// For testing. // For testing.
std::ostream& operator<<(std::ostream& os, PasswordForm::Scheme scheme); std::ostream& operator<<(std::ostream& os, PasswordForm::Scheme scheme);
std::ostream& operator<<(std::ostream& os, const PasswordForm& form); std::ostream& operator<<(std::ostream& os, const PasswordForm& form);
......
...@@ -148,6 +148,7 @@ static_library("browser") { ...@@ -148,6 +148,7 @@ static_library("browser") {
"password_feature_manager.h", "password_feature_manager.h",
"password_feature_manager_impl.cc", "password_feature_manager_impl.cc",
"password_feature_manager_impl.h", "password_feature_manager_impl.h",
"password_form.h",
"password_form_filling.cc", "password_form_filling.cc",
"password_form_filling.h", "password_form_filling.h",
"password_form_manager.cc", "password_form_manager.cc",
......
// Copyright 2020 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.
#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_H_
#include "components/autofill/core/common/password_form.h"
namespace password_manager {
// TODO(crbug.com/1067347): Move complete class to password_manager, once all
// references to `autofill::PasswordForm` are dropped.
using PasswordForm = autofill::PasswordForm;
} // namespace password_manager
#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_H_
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