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

Unified Diff: components/password_manager/core/browser/password_store.h

Issue 1066543004: Update affiliated web credentials when Android credentials are updated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed first round of comments from mkwst@. Created 5 years, 8 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/browser/password_store.h
diff --git a/components/password_manager/core/browser/password_store.h b/components/password_manager/core/browser/password_store.h
index 852a51e5eea80a9dddcde4cb1e73b82b075221f1..0cfa55a55dddf8d579e937c2aa50cd891d54a815 100644
--- a/components/password_manager/core/browser/password_store.h
+++ b/components/password_manager/core/browser/password_store.h
@@ -6,6 +6,7 @@
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_H_
#include "base/callback.h"
+#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
@@ -181,16 +182,6 @@ class PasswordStore : protected PasswordStoreSync,
virtual void ReportMetricsImpl(const std::string& sync_username,
bool custom_passphrase_sync_enabled) = 0;
- // Bring PasswordStoreSync methods to the scope of PasswordStore. Otherwise,
- // base::Bind can't be used with them because it fails to cast PasswordStore
- // to PasswordStoreSync.
- PasswordStoreChangeList AddLoginImpl(
- const autofill::PasswordForm& form) override = 0;
- PasswordStoreChangeList UpdateLoginImpl(
- const autofill::PasswordForm& form) override = 0;
- PasswordStoreChangeList RemoveLoginImpl(
- const autofill::PasswordForm& form) override = 0;
-
// Synchronous implementation to remove the given logins.
virtual PasswordStoreChangeList RemoveLoginsCreatedBetweenImpl(
base::Time delete_begin,
@@ -211,6 +202,20 @@ class PasswordStore : protected PasswordStoreSync,
AuthorizationPromptPolicy prompt_policy,
scoped_ptr<GetLoginsRequest> request);
+ // Synchronous implementation provided by subclasses to add the given login.
+ virtual PasswordStoreChangeList AddLoginImpl(
+ const autofill::PasswordForm& form) = 0;
+
+ // Synchronous implementation provided by subclasses to update the given
+ // login.
+ virtual PasswordStoreChangeList UpdateLoginImpl(
+ const autofill::PasswordForm& form) = 0;
+
+ // Synchronous implementation provided by subclasses to remove the given
+ // login.
+ virtual PasswordStoreChangeList RemoveLoginImpl(
+ const autofill::PasswordForm& form) = 0;
+
// Finds and returns all PasswordForms with the same signon_realm as |form|,
// or with a signon_realm that is a PSL-match to that of |form|.
virtual ScopedVector<autofill::PasswordForm> FillMatchingLogins(
@@ -232,6 +237,13 @@ class PasswordStore : protected PasswordStoreSync,
void LogStatsForBulkDeletionDuringRollback(int num_deletions);
// PasswordStoreSync:
+ PasswordStoreChangeList AddLoginSync(
+ const autofill::PasswordForm& form) override;
+ PasswordStoreChangeList UpdateLoginSync(
+ const autofill::PasswordForm& form) override;
+ PasswordStoreChangeList RemoveLoginSync(
+ const autofill::PasswordForm& form) override;
+
// Called by WrapModificationTask() once the underlying data-modifying
// operation has been performed. Notifies observers that password store data
// may have been changed.
@@ -245,6 +257,9 @@ class PasswordStore : protected PasswordStoreSync,
scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner_;
private:
+ FRIEND_TEST_ALL_PREFIXES(PasswordStoreTest,
+ UpdatePasswordsStoredForAffiliatedWebsites);
+
// Schedule the given |func| to be run in the PasswordStore's own thread with
// responses delivered to |consumer| on the current thread.
void Schedule(void (PasswordStore::*func)(scoped_ptr<GetLoginsRequest>),
@@ -286,6 +301,34 @@ class PasswordStore : protected PasswordStoreSync,
scoped_ptr<GetLoginsRequest> request,
const std::vector<std::string>& additional_android_realms);
+ // Retrieves the currently stored form, if any, with the same primary key as
+ // |form|, that is, with the same signon_realm, origin, username_element,
+ // username_value and password_element attributes.
+ scoped_ptr<autofill::PasswordForm> GetLoginImpl(
+ const autofill::PasswordForm& primary_key);
+
+ // Called when a password is added or updated for an Android application, and
+ // triggers finding web sites affiliated with the Android application and
+ // propagating the new password to credentials for those web sites, if any.
+ void FindAndUpdateAffiliatedWebLogins(
+ const autofill::PasswordForm& added_or_updated_android_form);
+
+ // Posts FindAndUpdateAffiliatedWebLogins() to the main thread.
+ void ScheduleFindAndUpdateAffiliatedWebLogins(
+ const autofill::PasswordForm& added_or_updated_android_form);
+
+ // Called when a password is added or updated for an Android application, and
+ // propagates these changes to credentials stored for |affiliated_web_realms|
+ // under the same username, if there are any.
+ void UpdateAffiliatedWebLoginsImpl(
+ const autofill::PasswordForm& updated_android_form,
+ const std::vector<std::string>& affiliated_web_realms);
+
+ // Schedules UpdateAffiliatedWebLoginsImpl() to run on the DB thread.
+ void ScheduleUpdateAffiliatedWebLoginsImpl(
+ const autofill::PasswordForm& updated_android_form,
+ const std::vector<std::string>& affiliated_web_realms);
+
// Creates PasswordSyncableService instance on the background thread.
void InitSyncableService(
const syncer::SyncableService::StartSyncFlare& flare);

Powered by Google App Engine
This is Rietveld 408576698