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

Unified Diff: chrome/browser/password_manager/native_backend_libsecret.cc

Issue 2465083002: Add a dummy entry with libsecret when initializing OSCrypt. (Closed)
Patch Set: Created 4 years, 1 month 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: chrome/browser/password_manager/native_backend_libsecret.cc
diff --git a/chrome/browser/password_manager/native_backend_libsecret.cc b/chrome/browser/password_manager/native_backend_libsecret.cc
index dab55dbe895a1dad495890b1e423cab41c75cf56..82976c219f6f659c094477cd9d3bdbac4f6e40c9 100644
--- a/chrome/browser/password_manager/native_backend_libsecret.cc
+++ b/chrome/browser/password_manager/native_backend_libsecret.cc
@@ -164,8 +164,8 @@ std::string GetProfileSpecificAppString(LocalProfileId id) {
} // namespace
NativeBackendLibsecret::NativeBackendLibsecret(LocalProfileId id)
- : app_string_(GetProfileSpecificAppString(id)) {
-}
+ : app_string_(GetProfileSpecificAppString(id)),
+ ensured_keyring_unlocked_(false) {}
NativeBackendLibsecret::~NativeBackendLibsecret() {
}
@@ -307,6 +307,11 @@ bool NativeBackendLibsecret::GetLogins(
bool NativeBackendLibsecret::AddUpdateLoginSearch(
const autofill::PasswordForm& lookup_form,
ScopedVector<autofill::PasswordForm>* forms) {
+ if (!ensured_keyring_unlocked_) {
+ LibsecretLoader::EnsureKeyringUnlocked();
+ ensured_keyring_unlocked_ = true;
+ }
+
LibsecretAttributesBuilder attrs;
attrs.Append("origin_url", lookup_form.origin.spec());
attrs.Append("username_element", UTF16ToUTF8(lookup_form.username_element));
@@ -408,6 +413,11 @@ bool NativeBackendLibsecret::GetLoginsList(
const PasswordStore::FormDigest* lookup_form,
GetLoginsListOptions options,
ScopedVector<autofill::PasswordForm>* forms) {
+ if (!ensured_keyring_unlocked_) {
+ LibsecretLoader::EnsureKeyringUnlocked();
+ ensured_keyring_unlocked_ = true;
+ }
+
LibsecretAttributesBuilder attrs;
attrs.Append("application", app_string_);
if (options != ALL_LOGINS)

Powered by Google App Engine
This is Rietveld 408576698