Commit 3bbb69a8 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[Passwords] Remove autofill::PasswordForm from //chrome/*/importer

This change replaces most usage of autofill::PasswordForm in the
importer code and uses a new importer::ImportedPasswordForm struct
instead.

This is necessary, because PasswordForm is being moved to the //browser
component, and thus is no longer accessible from other components like
//common or //utility.

Bug: 1067347
Change-Id: I3789dc48d85837b75162c7b58e5ef8908b6f99eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2513220
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823461}
parent ce54b897
......@@ -212,7 +212,7 @@ void ExternalProcessImporterClient::OnFaviconsImportGroup(
}
void ExternalProcessImporterClient::OnPasswordFormImportReady(
const password_manager::PasswordForm& form) {
const importer::ImportedPasswordForm& form) {
if (cancelled_)
return;
......
......@@ -33,6 +33,7 @@ class InProcessImporterBridge;
namespace importer {
struct ImporterAutofillFormDataEntry;
struct ImportedPasswordForm;
struct SearchEngineInfo;
}
......@@ -73,7 +74,7 @@ class ExternalProcessImporterClient
void OnFaviconsImportGroup(
const favicon_base::FaviconUsageDataList& favicons_group) override;
void OnPasswordFormImportReady(
const password_manager::PasswordForm& form) override;
const importer::ImportedPasswordForm& form) override;
void OnKeywordsImportReady(
const std::vector<importer::SearchEngineInfo>& search_engines,
bool unique_on_host_and_path) override;
......
......@@ -59,9 +59,33 @@ history::VisitSource ConvertImporterVisitSourceToHistoryVisitSource(
return history::SOURCE_SYNCED;
}
} // namespace
password_manager::PasswordForm::Scheme ConvertToPasswordFormScheme(
importer::ImportedPasswordForm::Scheme scheme) {
switch (scheme) {
case importer::ImportedPasswordForm::Scheme::kHtml:
return password_manager::PasswordForm::Scheme::kHtml;
case importer::ImportedPasswordForm::Scheme::kBasic:
return password_manager::PasswordForm::Scheme::kBasic;
}
namespace {
NOTREACHED();
return password_manager::PasswordForm::Scheme::kHtml;
}
password_manager::PasswordForm ConvertImportedPasswordForm(
const importer::ImportedPasswordForm& form) {
password_manager::PasswordForm result;
result.scheme = ConvertToPasswordFormScheme(form.scheme);
result.signon_realm = form.signon_realm;
result.url = form.url;
result.action = form.action;
result.username_element = form.username_element;
result.username_value = form.username_value;
result.password_element = form.password_element;
result.password_value = form.password_value;
result.blocked_by_user = form.blocked_by_user;
return result;
}
// Attempts to create a TemplateURL from the provided data. |title| is optional.
// If TemplateURL creation fails, returns null.
......@@ -126,8 +150,8 @@ void InProcessImporterBridge::SetKeywords(
}
void InProcessImporterBridge::SetPasswordForm(
const password_manager::PasswordForm& form) {
writer_->AddPasswordForm(form);
const importer::ImportedPasswordForm& form) {
writer_->AddPasswordForm(ConvertImportedPasswordForm(form));
}
void InProcessImporterBridge::SetAutofillFormData(
......
......@@ -43,7 +43,7 @@ class InProcessImporterBridge : public ImporterBridge {
const std::vector<importer::SearchEngineInfo>& search_engines,
bool unique_on_host_and_path) override;
void SetPasswordForm(const password_manager::PasswordForm& form) override;
void SetPasswordForm(const importer::ImportedPasswordForm& form) override;
void SetAutofillFormData(
const std::vector<ImporterAutofillFormDataEntry>& entries) override;
......
......@@ -8,7 +8,6 @@ mojom("interfaces") {
sources = [ "profile_import.mojom" ]
public_deps = [
"//components/autofill/core/common/mojom:mojo_types",
"//mojo/public/mojom/base",
"//url/mojom:url_mojom_gurl",
]
......@@ -50,7 +49,7 @@ mojom("interfaces") {
},
{
mojom = "chrome.mojom.ImportedPasswordForm"
cpp = "::autofill::PasswordForm"
cpp = "::importer::ImportedPasswordForm"
},
]
traits_headers = [
......@@ -58,7 +57,6 @@ mojom("interfaces") {
"//chrome/common/importer/importer_autofill_form_data_entry.h",
"//chrome/common/importer/importer_data_types.h",
"//chrome/common/importer/importer_url_row.h",
"//components/autofill/core/common/password_form.h",
"//components/favicon_base/favicon_usage_data.h",
]
traits_private_headers = [
......@@ -116,7 +114,6 @@ source_set("importer") {
"//base",
"//chrome/app:generated_resources",
"//chrome/common:ini_parser",
"//components/autofill/core/common",
"//components/favicon_base",
"//content/public/common",
"//ui/base",
......
......@@ -20,10 +20,6 @@ class GURL;
struct ImportedBookmarkEntry;
struct ImporterAutofillFormDataEntry;
namespace autofill {
struct PasswordForm;
}
namespace importer {
struct SearchEngineInfo;
}
......@@ -48,7 +44,7 @@ class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> {
const std::vector<importer::SearchEngineInfo>& search_engines,
bool unique_on_host_and_path) = 0;
virtual void SetPasswordForm(const autofill::PasswordForm& form) = 0;
virtual void SetPasswordForm(const importer::ImportedPasswordForm& form) = 0;
virtual void SetAutofillFormData(
const std::vector<ImporterAutofillFormDataEntry>& entries) = 0;
......
......@@ -29,4 +29,20 @@ ImporterIE7PasswordInfo::~ImporterIE7PasswordInfo() {
ImporterIE7PasswordInfo& ImporterIE7PasswordInfo::operator=(
const ImporterIE7PasswordInfo& other) = default;
ImportedPasswordForm::ImportedPasswordForm() = default;
ImportedPasswordForm::ImportedPasswordForm(const ImportedPasswordForm& form) =
default;
ImportedPasswordForm::ImportedPasswordForm(ImportedPasswordForm&& form) =
default;
ImportedPasswordForm& ImportedPasswordForm::operator=(
const ImportedPasswordForm& form) = default;
ImportedPasswordForm& ImportedPasswordForm::operator=(
ImportedPasswordForm&& form) = default;
ImportedPasswordForm::~ImportedPasswordForm() = default;
} // namespace importer
......@@ -78,6 +78,33 @@ struct ImporterIE7PasswordInfo {
base::Time date_created;
};
// Represents information about an imported password form.
struct ImportedPasswordForm {
// Enum to differentiate between HTML form based authentication, and dialogs
// using basic or digest schemes. Default is kHtml.
enum class Scheme {
kHtml,
kBasic,
};
ImportedPasswordForm();
ImportedPasswordForm(const ImportedPasswordForm& other);
ImportedPasswordForm(ImportedPasswordForm&& other) noexcept;
ImportedPasswordForm& operator=(const ImportedPasswordForm& other);
ImportedPasswordForm& operator=(ImportedPasswordForm&& other);
~ImportedPasswordForm();
Scheme scheme = Scheme::kHtml;
std::string signon_realm;
GURL url;
GURL action;
base::string16 username_element;
base::string16 username_value;
base::string16 password_element;
base::string16 password_value;
bool blocked_by_user = false;
};
// Mapped to history::VisitSource after import in the browser.
enum VisitSource {
VISIT_SOURCE_BROWSED = 0,
......
......@@ -11,7 +11,6 @@
#include "chrome/common/importer/imported_bookmark_entry.h"
#include "chrome/common/importer/importer_autofill_form_data_entry.h"
#include "chrome/common/importer/importer_bridge.h"
#include "components/autofill/core/common/password_form.h"
#include "testing/gmock/include/gmock/gmock.h"
class MockImporterBridge : public ImporterBridge {
......@@ -27,7 +26,7 @@ class MockImporterBridge : public ImporterBridge {
void(const std::vector<ImporterURLRow>&, importer::VisitSource));
MOCK_METHOD2(SetKeywords,
void(const std::vector<importer::SearchEngineInfo>&, bool));
MOCK_METHOD1(SetPasswordForm, void(const autofill::PasswordForm&));
MOCK_METHOD1(SetPasswordForm, void(const importer::ImportedPasswordForm&));
MOCK_METHOD1(SetAutofillFormData,
void(const std::vector<ImporterAutofillFormDataEntry>&));
MOCK_METHOD0(NotifyStarted, void());
......
......@@ -32,7 +32,7 @@ struct ImporterIE7PasswordInfo;
enum ImportItem;
// Represents information about an imported password form. Typemapped to
// autofill::PasswordForm.
// importer::ImportedPasswordForm.
struct ImportedPasswordForm {
// Enum to differentiate between HTML form based authentication, and dialogs
// using basic or digest schemes. Default is kHtml.
......
......@@ -40,9 +40,9 @@ namespace mojo {
// static
bool StructTraits<chrome::mojom::ImportedPasswordFormDataView,
autofill::PasswordForm>::
importer::ImportedPasswordForm>::
Read(chrome::mojom::ImportedPasswordFormDataView data,
autofill::PasswordForm* out) {
importer::ImportedPasswordForm* out) {
if (!data.ReadScheme(&out->scheme) ||
!data.ReadSignonRealm(&out->signon_realm) || !data.ReadUrl(&out->url) ||
!data.ReadAction(&out->action) ||
......
......@@ -6,6 +6,7 @@
#define CHROME_COMMON_IMPORTER_PROFILE_IMPORT_PROCESS_PARAM_TRAITS_H_
#include "base/strings/string16.h"
#include "chrome/common/importer/importer_data_types.h"
#include "chrome/common/importer/profile_import.mojom.h"
#include "chrome/common/importer/profile_import_process_param_traits_macros.h"
#include "mojo/public/cpp/bindings/enum_traits.h"
......@@ -15,13 +16,13 @@ namespace mojo {
template <>
struct EnumTraits<chrome::mojom::ImportedPasswordForm::Scheme,
autofill::PasswordForm::Scheme> {
importer::ImportedPasswordForm::Scheme> {
static chrome::mojom::ImportedPasswordForm::Scheme ToMojom(
autofill::PasswordForm::Scheme input) {
importer::ImportedPasswordForm::Scheme input) {
switch (input) {
case autofill::PasswordForm::Scheme::kHtml:
case importer::ImportedPasswordForm::Scheme::kHtml:
return chrome::mojom::ImportedPasswordForm::Scheme::kHtml;
case autofill::PasswordForm::Scheme::kBasic:
case importer::ImportedPasswordForm::Scheme::kBasic:
return chrome::mojom::ImportedPasswordForm::Scheme::kBasic;
default:
break;
......@@ -31,13 +32,13 @@ struct EnumTraits<chrome::mojom::ImportedPasswordForm::Scheme,
}
static bool FromMojom(chrome::mojom::ImportedPasswordForm::Scheme input,
autofill::PasswordForm::Scheme* out) {
importer::ImportedPasswordForm::Scheme* out) {
switch (input) {
case chrome::mojom::ImportedPasswordForm::Scheme::kHtml:
*out = autofill::PasswordForm::Scheme::kHtml;
*out = importer::ImportedPasswordForm::Scheme::kHtml;
return true;
case chrome::mojom::ImportedPasswordForm::Scheme::kBasic:
*out = autofill::PasswordForm::Scheme::kBasic;
*out = importer::ImportedPasswordForm::Scheme::kBasic;
return true;
}
NOTREACHED();
......@@ -47,46 +48,51 @@ struct EnumTraits<chrome::mojom::ImportedPasswordForm::Scheme,
template <>
struct StructTraits<chrome::mojom::ImportedPasswordFormDataView,
autofill::PasswordForm> {
static autofill::PasswordForm::Scheme scheme(
const autofill::PasswordForm& r) {
importer::ImportedPasswordForm> {
static importer::ImportedPasswordForm::Scheme scheme(
const importer::ImportedPasswordForm& r) {
return r.scheme;
}
static const std::string& signon_realm(const autofill::PasswordForm& r) {
static const std::string& signon_realm(
const importer::ImportedPasswordForm& r) {
return r.signon_realm;
}
static const GURL& url(const autofill::PasswordForm& r) { return r.url; }
static const GURL& url(const importer::ImportedPasswordForm& r) {
return r.url;
}
static const GURL& action(const autofill::PasswordForm& r) {
static const GURL& action(const importer::ImportedPasswordForm& r) {
return r.action;
}
static const base::string16& username_element(
const autofill::PasswordForm& r) {
const importer::ImportedPasswordForm& r) {
return r.username_element;
}
static const base::string16& username_value(const autofill::PasswordForm& r) {
static const base::string16& username_value(
const importer::ImportedPasswordForm& r) {
return r.username_value;
}
static const base::string16& password_element(
const autofill::PasswordForm& r) {
const importer::ImportedPasswordForm& r) {
return r.password_element;
}
static const base::string16& password_value(const autofill::PasswordForm& r) {
static const base::string16& password_value(
const importer::ImportedPasswordForm& r) {
return r.password_value;
}
static bool blocked_by_user(const autofill::PasswordForm& r) {
static bool blocked_by_user(const importer::ImportedPasswordForm& r) {
return r.blocked_by_user;
}
static bool Read(chrome::mojom::ImportedPasswordFormDataView data,
autofill::PasswordForm* out);
importer::ImportedPasswordForm* out);
};
} // namespace mojo
......
......@@ -18,7 +18,6 @@
#include "chrome/common/importer/importer_autofill_form_data_entry.h"
#include "chrome/common/importer/importer_data_types.h"
#include "chrome/common/importer/importer_url_row.h"
#include "components/autofill/core/common/password_form.h"
#include "components/favicon_base/favicon_usage_data.h"
#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
......
......@@ -17,7 +17,6 @@
#include "chrome/common/importer/imported_bookmark_entry.h"
#include "chrome/common/importer/importer_autofill_form_data_entry.h"
#include "chrome/common/importer/importer_data_types.h"
#include "components/autofill/core/common/password_form.h"
namespace {
......@@ -110,7 +109,7 @@ void ExternalProcessImporterBridge::SetKeywords(
}
void ExternalProcessImporterBridge::SetPasswordForm(
const autofill::PasswordForm& form) {
const importer::ImportedPasswordForm& form) {
observer_->OnPasswordFormImportReady(form);
}
......
......@@ -55,7 +55,7 @@ class ExternalProcessImporterBridge : public ImporterBridge {
const std::vector<importer::SearchEngineInfo>& search_engines,
bool unique_on_host_and_path) override;
void SetPasswordForm(const autofill::PasswordForm& form) override;
void SetPasswordForm(const importer::ImportedPasswordForm& form) override;
void SetAutofillFormData(
const std::vector<ImporterAutofillFormDataEntry>& entries) override;
......
......@@ -18,12 +18,12 @@
#include "chrome/common/importer/imported_bookmark_entry.h"
#include "chrome/common/importer/importer_autofill_form_data_entry.h"
#include "chrome/common/importer/importer_bridge.h"
#include "chrome/common/importer/importer_data_types.h"
#include "chrome/common/importer/importer_url_row.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/utility/importer/bookmark_html_reader.h"
#include "chrome/utility/importer/favicon_reencode.h"
#include "chrome/utility/importer/nss_decryptor.h"
#include "components/autofill/core/common/password_form.h"
#include "sql/database.h"
#include "sql/statement.h"
#include "url/gurl.h"
......@@ -380,7 +380,7 @@ void FirefoxImporter::ImportPasswords() {
return;
}
std::vector<autofill::PasswordForm> forms;
std::vector<importer::ImportedPasswordForm> forms;
base::FilePath source_path = source_path_;
const base::FilePath sqlite_file = source_path.AppendASCII("signons.sqlite");
const base::FilePath json_file = source_path.AppendASCII("logins.json");
......
......@@ -104,8 +104,8 @@ TEST(FirefoxImporterTest, MAYBE_NSS(Firefox3NSS3Decryptor)) {
// The following test verifies proper detection of authentication scheme in
// firefox's signons db. We insert two entries into moz_logins table. The first
// has httpRealm column filled with non-empty string, therefore resulting
// PasswordForm should have SCHEME_BASIC in scheme. The second entry has NULL
// httpRealm, so it should produce a SCHEME_HTML PasswordForm.
// ImportedPasswordForm should have SCHEME_BASIC in scheme. The second entry has
// NULL httpRealm, so it should produce a SCHEME_HTML ImportedPasswordForm.
TEST(FirefoxImporterTest, MAYBE_NSS(FirefoxNSSDecryptorDeduceAuthScheme)) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
......@@ -155,12 +155,12 @@ TEST(FirefoxImporterTest, MAYBE_NSS(FirefoxNSSDecryptorDeduceAuthScheme)) {
ASSERT_TRUE(decryptor_proxy.Setup(nss_path));
ASSERT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path));
std::vector<autofill::PasswordForm> forms =
std::vector<importer::ImportedPasswordForm> forms =
decryptor_proxy.ParseSignons(signons_path);
ASSERT_EQ(2u, forms.size());
EXPECT_EQ(autofill::PasswordForm::Scheme::kBasic, forms[0].scheme);
EXPECT_EQ(autofill::PasswordForm::Scheme::kHtml, forms[1].scheme);
EXPECT_EQ(importer::ImportedPasswordForm::Scheme::kBasic, forms[0].scheme);
EXPECT_EQ(importer::ImportedPasswordForm::Scheme::kHtml, forms[1].scheme);
}
TEST(FirefoxImporterTest, ImportBookmarks_Firefox48) {
......
......@@ -11,8 +11,8 @@
#include "base/macros.h"
#include "base/process/process.h"
#include "build/build_config.h"
#include "chrome/common/importer/importer_data_types.h"
#include "chrome/utility/importer/nss_decryptor.h"
#include "components/autofill/core/common/password_form.h"
class FFDecryptorServerChannelListener;
......@@ -37,7 +37,7 @@ class FFUnitTestDecryptorProxy {
bool DecryptorInit(const base::FilePath& dll_path,
const base::FilePath& db_path);
base::string16 Decrypt(const std::string& crypt);
std::vector<autofill::PasswordForm> ParseSignons(
std::vector<importer::ImportedPasswordForm> ParseSignons(
const base::FilePath& signons_path);
private:
......@@ -73,13 +73,13 @@ base::string16 FFUnitTestDecryptorProxy::Decrypt(const std::string& crypt) {
return decryptor_.Decrypt(crypt);
}
std::vector<autofill::PasswordForm> FFUnitTestDecryptorProxy::ParseSignons(
const base::FilePath& signons_path) {
std::vector<autofill::PasswordForm> signons;
std::vector<importer::ImportedPasswordForm>
FFUnitTestDecryptorProxy::ParseSignons(const base::FilePath& signons_path) {
std::vector<importer::ImportedPasswordForm> signons;
if (decryptor_.ReadAndParseSignons(signons_path, &signons))
return signons;
return std::vector<autofill::PasswordForm>();
return std::vector<importer::ImportedPasswordForm>();
}
#endif // !OS_MAC
......
......@@ -92,7 +92,7 @@ class FFDecryptorClientListener
void ParseSignons(const base::FilePath& sqlite_file,
ParseSignonsCallback callback) override {
std::vector<autofill::PasswordForm> forms;
std::vector<importer::ImportedPasswordForm> forms;
decryptor_.ReadAndParseSignons(sqlite_file, &forms);
std::move(callback).Run(forms);
}
......@@ -153,7 +153,7 @@ class FFDecryptorServerChannelListener {
// Results of the calls.
base::string16 result_string_;
std::vector<autofill::PasswordForm> result_vector_;
std::vector<importer::ImportedPasswordForm> result_vector_;
bool result_bool_;
// True if mojo call succeeded and data in above variables is valid.
bool got_result_;
......@@ -172,8 +172,9 @@ class FFDecryptorServerChannelListener {
std::move(quit_closure).Run();
}
void ParseSignonsReply(base::OnceClosure quit_closure,
const std::vector<autofill::PasswordForm>& forms) {
void ParseSignonsReply(
base::OnceClosure quit_closure,
const std::vector<importer::ImportedPasswordForm>& forms) {
result_vector_ = forms;
got_result_ = true;
std::move(quit_closure).Run();
......@@ -240,12 +241,12 @@ base::string16 FFUnitTestDecryptorProxy::Decrypt(const std::string& crypt) {
return base::string16();
}
std::vector<autofill::PasswordForm> FFUnitTestDecryptorProxy::ParseSignons(
const base::FilePath& signons_path) {
std::vector<importer::ImportedPasswordForm>
FFUnitTestDecryptorProxy::ParseSignons(const base::FilePath& signons_path) {
listener_->ParseSignons(signons_path);
if (listener_->got_result_)
return listener_->result_vector_;
return std::vector<autofill::PasswordForm>();
return std::vector<importer::ImportedPasswordForm>();
}
// Entry function in child process.
......
......@@ -17,7 +17,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "components/autofill/core/common/password_form.h"
#include "chrome/common/importer/importer_data_types.h"
#include "sql/database.h"
#include "sql/statement.h"
......@@ -80,7 +80,7 @@ struct FirefoxRawPasswordInfo {
namespace {
autofill::PasswordForm CreateBlockedPasswordForm(
importer::ImportedPasswordForm CreateBlockedPasswordForm(
const std::string& blocked_host) {
GURL::Replacements rep;
rep.ClearQuery();
......@@ -88,7 +88,7 @@ autofill::PasswordForm CreateBlockedPasswordForm(
rep.ClearUsername();
rep.ClearPassword();
autofill::PasswordForm form;
importer::ImportedPasswordForm form;
form.url = GURL(blocked_host).ReplaceComponents(rep);
form.signon_realm = form.url.GetOrigin().spec();
form.blocked_by_user = true;
......@@ -151,8 +151,9 @@ base::string16 NSSDecryptor::Decrypt(const std::string& crypt) const {
// http://kb.mozillazine.org/Signons.txt
// http://kb.mozillazine.org/Signons2.txt
// http://kb.mozillazine.org/Signons3.txt
void NSSDecryptor::ParseSignons(const base::FilePath& signon_file,
std::vector<autofill::PasswordForm>* forms) {
void NSSDecryptor::ParseSignons(
const base::FilePath& signon_file,
std::vector<importer::ImportedPasswordForm>* forms) {
forms->clear();
std::string content;
......@@ -242,7 +243,7 @@ void NSSDecryptor::ParseSignons(const base::FilePath& signon_file,
if (version == 3)
++begin;
autofill::PasswordForm form;
importer::ImportedPasswordForm form;
if (CreatePasswordFormFromRawInfo(raw_password_info, &form))
forms->push_back(form);
}
......@@ -251,7 +252,7 @@ void NSSDecryptor::ParseSignons(const base::FilePath& signon_file,
bool NSSDecryptor::ReadAndParseSignons(
const base::FilePath& sqlite_file,
std::vector<autofill::PasswordForm>* forms) {
std::vector<importer::ImportedPasswordForm>* forms) {
sql::Database db;
if (!db.Open(sqlite_file))
return false;
......@@ -283,7 +284,7 @@ bool NSSDecryptor::ReadAndParseSignons(
raw_password_info.password_element = s2.ColumnString16(4);
raw_password_info.encrypted_password = s2.ColumnString(6);
raw_password_info.form_action = s2.ColumnString(2);
autofill::PasswordForm form;
importer::ImportedPasswordForm form;
if (CreatePasswordFormFromRawInfo(raw_password_info, &form))
forms->push_back(form);
}
......@@ -292,7 +293,7 @@ bool NSSDecryptor::ReadAndParseSignons(
bool NSSDecryptor::ReadAndParseLogins(
const base::FilePath& json_file,
std::vector<autofill::PasswordForm>* forms) {
std::vector<importer::ImportedPasswordForm>* forms) {
std::string json_content;
base::ReadFileToString(json_file, &json_content);
base::Optional<base::Value> parsed_json =
......@@ -341,7 +342,7 @@ bool NSSDecryptor::ReadAndParseLogins(
if (const std::string* realm = value.FindStringKey("httpRealm"))
raw_password_info.realm = *realm;
autofill::PasswordForm form;
importer::ImportedPasswordForm form;
if (CreatePasswordFormFromRawInfo(raw_password_info, &form))
forms->push_back(form);
}
......@@ -352,7 +353,7 @@ bool NSSDecryptor::ReadAndParseLogins(
bool NSSDecryptor::CreatePasswordFormFromRawInfo(
const FirefoxRawPasswordInfo& raw_password_info,
autofill::PasswordForm* form) {
importer::ImportedPasswordForm* form) {
GURL::Replacements rep;
rep.ClearQuery();
rep.ClearRef();
......@@ -378,7 +379,7 @@ bool NSSDecryptor::CreatePasswordFormFromRawInfo(
// Non-empty realm indicates that it's not html form authentication entry.
// Extracted data doesn't allow us to distinguish basic_auth entry from
// digest_auth entry, so let's assume basic_auth.
form->scheme = autofill::PasswordForm::Scheme::kBasic;
form->scheme = importer::ImportedPasswordForm::Scheme::kBasic;
}
form->username_element = raw_password_info.username_element;
form->username_value = Decrypt(raw_password_info.encrypted_username);
......
......@@ -109,8 +109,8 @@ typedef PRStatus (*PRCleanupFunc)(void);
struct FirefoxRawPasswordInfo;
namespace autofill {
struct PasswordForm;
namespace importer {
struct ImportedPasswordForm;
}
// A wrapper for Firefox NSS decrypt component.
......@@ -134,19 +134,19 @@ class NSSDecryptor {
// username/password and reads other related information.
// The result will be stored in |forms|.
void ParseSignons(const base::FilePath& signon_file,
std::vector<autofill::PasswordForm>* forms);
std::vector<importer::ImportedPasswordForm>* forms);
// Reads and parses the Firefox password sqlite db, decrypts the
// username/password and reads other related information.
// The result will be stored in |forms|.
bool ReadAndParseSignons(const base::FilePath& sqlite_file,
std::vector<autofill::PasswordForm>* forms);
std::vector<importer::ImportedPasswordForm>* forms);
// Reads and parses the Firefox password file logins.json, decrypts the
// username/password and reads other related information.
// The result will be stored in |forms|.
bool ReadAndParseLogins(const base::FilePath& json_file,
std::vector<autofill::PasswordForm>* forms);
std::vector<importer::ImportedPasswordForm>* forms);
private:
PK11SlotInfo* GetKeySlotForDB() const { return PK11_GetInternalKeySlot(); }
......@@ -154,10 +154,10 @@ class NSSDecryptor {
void FreeSlot(PK11SlotInfo* slot) const { PK11_FreeSlot(slot); }
// Turns unprocessed information extracted from Firefox's password file
// into PasswordForm.
// into ImportedPasswordForm.
bool CreatePasswordFormFromRawInfo(
const FirefoxRawPasswordInfo& raw_password_info,
autofill::PasswordForm* form);
importer::ImportedPasswordForm* form);
// Methods in Firefox security components.
NSSInitFunc NSS_Init;
......
......@@ -14,8 +14,8 @@
struct FirefoxRawPasswordInfo;
namespace autofill {
struct PasswordForm;
namespace importer {
struct ImportedPasswordForm;
}
namespace base {
......@@ -39,19 +39,19 @@ class NSSDecryptor {
// username/password and reads other related information.
// The result will be stored in |forms|.
void ParseSignons(const base::FilePath& signon_file,
std::vector<autofill::PasswordForm>* forms);
std::vector<importer::ImportedPasswordForm>* forms);
// Reads and parses the Firefox password sqlite db, decrypts the
// username/password and reads other related information.
// The result will be stored in |forms|.
bool ReadAndParseSignons(const base::FilePath& sqlite_file,
std::vector<autofill::PasswordForm>* forms);
std::vector<importer::ImportedPasswordForm>* forms);
// Reads and parses the Firefox password file logins.json, decrypts the
// username/password and reads other related information.
// The result will be stored in |forms|.
bool ReadAndParseLogins(const base::FilePath& json_file,
std::vector<autofill::PasswordForm>* forms);
std::vector<importer::ImportedPasswordForm>* forms);
private:
// Does not actually free the slot, since we'll free it when NSSDecryptor is
......@@ -59,10 +59,10 @@ class NSSDecryptor {
void FreeSlot(PK11SlotInfo* slot) const {}
// Turns unprocessed information extracted from Firefox's password file
// into PasswordForm.
// into ImportedPasswordForm.
bool CreatePasswordFormFromRawInfo(
const FirefoxRawPasswordInfo& raw_password_info,
autofill::PasswordForm* form);
importer::ImportedPasswordForm* form);
PK11SlotInfo* GetKeySlotForDB() const { return db_slot_; }
......
......@@ -106,8 +106,8 @@ typedef PRStatus (*PRCleanupFunc)(void);
struct FirefoxRawPasswordInfo;
namespace autofill {
struct PasswordForm;
namespace importer {
struct ImportedPasswordForm;
}
// A wrapper for Firefox NSS decrypt component.
......@@ -132,19 +132,19 @@ class NSSDecryptor {
// username/password and reads other related information.
// The result will be stored in |forms|.
void ParseSignons(const base::FilePath& signon_file,
std::vector<autofill::PasswordForm>* forms);
std::vector<importer::ImportedPasswordForm>* forms);
// Reads and parses the Firefox password sqlite db, decrypts the
// username/password and reads other related information.
// The result will be stored in |forms|.
bool ReadAndParseSignons(const base::FilePath& sqlite_file,
std::vector<autofill::PasswordForm>* forms);
std::vector<importer::ImportedPasswordForm>* forms);
// Reads and parses the Firefox password file logins.json, decrypts the
// username/password and reads other related information.
// The result will be stored in |forms|.
bool ReadAndParseLogins(const base::FilePath& json_file,
std::vector<autofill::PasswordForm>* forms);
std::vector<importer::ImportedPasswordForm>* forms);
private:
// Call NSS initialization funcs.
......@@ -157,10 +157,10 @@ class NSSDecryptor {
void FreeSlot(PK11SlotInfo* slot) const { PK11_FreeSlot(slot); }
// Turns unprocessed information extracted from Firefox's password file
// into PasswordForm.
// into ImportedPasswordForm.
bool CreatePasswordFormFromRawInfo(
const FirefoxRawPasswordInfo& raw_password_info,
autofill::PasswordForm* form);
importer::ImportedPasswordForm* form);
// Methods in Firefox security components.
NSSInitFunc NSS_Init;
......
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