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

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

Issue 2263933002: Make FormFetcher a PasswordStoreConsumer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@621355_form_fetcher
Patch Set: Also operator= is now default Created 4 years 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/form_fetcher_impl.h
diff --git a/components/password_manager/core/browser/form_fetcher_impl.h b/components/password_manager/core/browser/form_fetcher_impl.h
index e46438697bd698d3e07dac2ec5c14552eee7cd4e..096bd618d5e3a35e9fe380cbf09ed941e0bfcc8e 100644
--- a/components/password_manager/core/browser/form_fetcher_impl.h
+++ b/components/password_manager/core/browser/form_fetcher_impl.h
@@ -11,6 +11,8 @@
#include "base/macros.h"
#include "components/password_manager/core/browser/form_fetcher.h"
+#include "components/password_manager/core/browser/password_store.h"
+#include "components/password_manager/core/browser/password_store_consumer.h"
namespace password_manager {
@@ -18,10 +20,12 @@ class PasswordManagerClient;
// Production implementation of FormFetcher. Fetches credentials associated
// with a particular origin.
-// TODO(crbug.com/621355): This class should ultimately work with PasswordStore.
-class FormFetcherImpl : public FormFetcher {
+class FormFetcherImpl : public FormFetcher, public PasswordStoreConsumer {
public:
- explicit FormFetcherImpl(const PasswordManagerClient* client);
+ // |form_digest| describes what credentials need to be retrieved and
+ // |client| serves the PasswordStore, the logging information etc.
+ FormFetcherImpl(PasswordStore::FormDigest form_digest,
+ const PasswordManagerClient* client);
~FormFetcherImpl() override;
@@ -32,23 +36,18 @@ class FormFetcherImpl : public FormFetcher {
const override;
const std::vector<const autofill::PasswordForm*>& GetFederatedMatches()
const override;
+ void Fetch() override;
- // TODO(crbug.com/621355): Remove this once FormFetcher becomes a
- // PasswordStoreConsumer.
- void set_state(State state) { state_ = state; }
-
- // TODO(crbug.com/621355): Remove this once FormFetcher becomes a
- // PasswordStoreConsumer.
- // Resets the results owned by |this| with new results from PasswordStore and
- // sets the state to NOT_WAITING.
- void SetResults(std::vector<std::unique_ptr<autofill::PasswordForm>> results);
-
- // TODO(crbug.com/621355): Remove this once FormFetcher becomes a
- // PasswordStoreConsumer.
- // Resets the stats owned by |this| with new stats from PasswordStore.
- void SetStats(std::vector<std::unique_ptr<InteractionsStats>> stats);
+ // PasswordStoreConsumer:
+ void OnGetPasswordStoreResults(
+ std::vector<std::unique_ptr<autofill::PasswordForm>> results) override;
+ void OnGetSiteStatistics(
+ std::vector<std::unique_ptr<InteractionsStats>> stats) override;
private:
+ // PasswordStore results will be fetched for this description.
+ const PasswordStore::FormDigest form_digest_;
+
// Results obtained from PasswordStore:
std::vector<std::unique_ptr<autofill::PasswordForm>> non_federated_;
@@ -78,6 +77,10 @@ class FormFetcherImpl : public FormFetcher {
// State of the fetcher.
State state_ = State::NOT_WAITING;
+ // False unless FetchDataFromPasswordStore has been called again without the
+ // password store returning results in the meantime.
+ bool need_to_refetch_ = false;
+
DISALLOW_COPY_AND_ASSIGN(FormFetcherImpl);
};
« no previous file with comments | « components/password_manager/core/browser/form_fetcher.h ('k') | components/password_manager/core/browser/form_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698