| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/password_manager/native_backend_libsecret.h" | 5 #include "chrome/browser/password_manager/native_backend_libsecret.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <libsecret/secret.h> | 10 #include <libsecret/secret.h> |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 bool NativeBackendLibsecret::GetLogins( | 301 bool NativeBackendLibsecret::GetLogins( |
| 302 const PasswordStore::FormDigest& form, | 302 const PasswordStore::FormDigest& form, |
| 303 ScopedVector<autofill::PasswordForm>* forms) { | 303 ScopedVector<autofill::PasswordForm>* forms) { |
| 304 return GetLoginsList(&form, ALL_LOGINS, forms); | 304 return GetLoginsList(&form, ALL_LOGINS, forms); |
| 305 } | 305 } |
| 306 | 306 |
| 307 bool NativeBackendLibsecret::AddUpdateLoginSearch( | 307 bool NativeBackendLibsecret::AddUpdateLoginSearch( |
| 308 const autofill::PasswordForm& lookup_form, | 308 const autofill::PasswordForm& lookup_form, |
| 309 ScopedVector<autofill::PasswordForm>* forms) { | 309 ScopedVector<autofill::PasswordForm>* forms) { |
| 310 LibsecretLoader::EnsureKeyringUnlocked(); |
| 311 |
| 310 LibsecretAttributesBuilder attrs; | 312 LibsecretAttributesBuilder attrs; |
| 311 attrs.Append("origin_url", lookup_form.origin.spec()); | 313 attrs.Append("origin_url", lookup_form.origin.spec()); |
| 312 attrs.Append("username_element", UTF16ToUTF8(lookup_form.username_element)); | 314 attrs.Append("username_element", UTF16ToUTF8(lookup_form.username_element)); |
| 313 attrs.Append("username_value", UTF16ToUTF8(lookup_form.username_value)); | 315 attrs.Append("username_value", UTF16ToUTF8(lookup_form.username_value)); |
| 314 attrs.Append("password_element", UTF16ToUTF8(lookup_form.password_element)); | 316 attrs.Append("password_element", UTF16ToUTF8(lookup_form.password_element)); |
| 315 attrs.Append("signon_realm", lookup_form.signon_realm); | 317 attrs.Append("signon_realm", lookup_form.signon_realm); |
| 316 attrs.Append("application", app_string_); | 318 attrs.Append("application", app_string_); |
| 317 | 319 |
| 318 GError* error = nullptr; | 320 GError* error = nullptr; |
| 319 GList* found = LibsecretLoader::secret_service_search_sync( | 321 GList* found = LibsecretLoader::secret_service_search_sync( |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 403 |
| 402 bool NativeBackendLibsecret::GetAllLogins( | 404 bool NativeBackendLibsecret::GetAllLogins( |
| 403 ScopedVector<autofill::PasswordForm>* forms) { | 405 ScopedVector<autofill::PasswordForm>* forms) { |
| 404 return GetLoginsList(nullptr, ALL_LOGINS, forms); | 406 return GetLoginsList(nullptr, ALL_LOGINS, forms); |
| 405 } | 407 } |
| 406 | 408 |
| 407 bool NativeBackendLibsecret::GetLoginsList( | 409 bool NativeBackendLibsecret::GetLoginsList( |
| 408 const PasswordStore::FormDigest* lookup_form, | 410 const PasswordStore::FormDigest* lookup_form, |
| 409 GetLoginsListOptions options, | 411 GetLoginsListOptions options, |
| 410 ScopedVector<autofill::PasswordForm>* forms) { | 412 ScopedVector<autofill::PasswordForm>* forms) { |
| 413 LibsecretLoader::EnsureKeyringUnlocked(); |
| 414 |
| 411 LibsecretAttributesBuilder attrs; | 415 LibsecretAttributesBuilder attrs; |
| 412 attrs.Append("application", app_string_); | 416 attrs.Append("application", app_string_); |
| 413 if (options != ALL_LOGINS) | 417 if (options != ALL_LOGINS) |
| 414 attrs.Append("blacklisted_by_user", options == BLACKLISTED_LOGINS); | 418 attrs.Append("blacklisted_by_user", options == BLACKLISTED_LOGINS); |
| 415 if (lookup_form && | 419 if (lookup_form && |
| 416 !password_manager::ShouldPSLDomainMatchingApply( | 420 !password_manager::ShouldPSLDomainMatchingApply( |
| 417 password_manager::GetRegistryControlledDomain( | 421 password_manager::GetRegistryControlledDomain( |
| 418 GURL(lookup_form->signon_realm))) && | 422 GURL(lookup_form->signon_realm))) && |
| 419 lookup_form->scheme != PasswordForm::SCHEME_HTML) | 423 lookup_form->scheme != PasswordForm::SCHEME_HTML) |
| 420 attrs.Append("signon_realm", lookup_form->signon_realm); | 424 attrs.Append("signon_realm", lookup_form->signon_realm); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 if (lookup_form) { | 564 if (lookup_form) { |
| 561 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", | 565 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", |
| 562 allow_psl_match | 566 allow_psl_match |
| 563 ? psl_domain_match_metric | 567 ? psl_domain_match_metric |
| 564 : password_manager::PSL_DOMAIN_MATCH_NOT_USED, | 568 : password_manager::PSL_DOMAIN_MATCH_NOT_USED, |
| 565 password_manager::PSL_DOMAIN_MATCH_COUNT); | 569 password_manager::PSL_DOMAIN_MATCH_COUNT); |
| 566 } | 570 } |
| 567 g_list_free(found); | 571 g_list_free(found); |
| 568 return forms; | 572 return forms; |
| 569 } | 573 } |
| OLD | NEW |