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

Unified Diff: components/password_manager/core/common/credential_manager_types.cc

Issue 1785273002: CREDENTIAL: Persist PasswordForm's primary key through CredentialInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another test Created 4 years, 9 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/password_manager/core/common/credential_manager_types.cc
diff --git a/components/password_manager/core/common/credential_manager_types.cc b/components/password_manager/core/common/credential_manager_types.cc
index b3978432ea0b7e61b76b4d80c59e1c8c184c6d31..1766c8e178b924e332d049a7d5648730fc815363 100644
--- a/components/password_manager/core/common/credential_manager_types.cc
+++ b/components/password_manager/core/common/credential_manager_types.cc
@@ -19,7 +19,10 @@ CredentialInfo::CredentialInfo(const autofill::PasswordForm& form,
name(form.display_name),
icon(form.icon_url),
password(form.password_value),
- federation(form.federation_origin) {
+ federation(form.federation_origin),
+ username_element(form.username_element),
+ password_element(form.password_element),
+ signon_realm(form.signon_realm) {
switch (form_type) {
case CredentialType::CREDENTIAL_TYPE_EMPTY:
password = base::string16();
@@ -55,12 +58,17 @@ scoped_ptr<autofill::PasswordForm> CreatePasswordFormFromCredentialInfo(
form->username_value = info.id;
form->scheme = autofill::PasswordForm::SCHEME_HTML;
form->type = autofill::PasswordForm::TYPE_API;
-
- form->signon_realm =
- info.type == CredentialType::CREDENTIAL_TYPE_PASSWORD
- ? origin.spec()
- : "federation://" + origin.host() + "/" + info.federation.host();
+ if (info.signon_realm.empty()) {
vasilii 2016/03/11 14:29:48 How can it be empty?
+ form->signon_realm =
+ info.type == CredentialType::CREDENTIAL_TYPE_PASSWORD
+ ? origin.spec()
+ : "federation://" + origin.host() + "/" + info.federation.host();
+ } else {
+ form->signon_realm = info.signon_realm;
+ }
form->username_value = info.id;
+ form->username_element = info.username_element;
+ form->password_element = info.password_element;
return form;
}
bool CredentialInfo::operator==(const CredentialInfo& rhs) const {

Powered by Google App Engine
This is Rietveld 408576698