// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_PASSWORD_MANAGER_ANDROID_PASSWORD_STORE_EMPTY_BACKEND_H_
#define CHROME_BROWSER_PASSWORD_MANAGER_ANDROID_PASSWORD_STORE_EMPTY_BACKEND_H_

#include "components/password_manager/core/browser/password_store/password_store_backend.h"

namespace password_manager {

// This password store backend doesn't store any data. It doesn't allow for
// saving passwords and all attempts to read from it will receive an empty list
// as a response. Used if the criteria for using the android backend are not
// fulfilled (e.g. because the Google Play Services version installed on the
// device is too old).
class PasswordStoreEmptyBackend
    : public password_manager::PasswordStoreBackend {
 public:
  PasswordStoreEmptyBackend();
  ~PasswordStoreEmptyBackend() override;

 private:
  void InitBackend(RemoteChangesReceived remote_form_changes_received,
                   base::RepeatingClosure sync_enabled_or_disabled_cb,
                   base::OnceCallback<void(bool)> completion) override;
  void Shutdown(base::OnceClosure shutdown_completed) override;
  ActionableError GetError() override;
  void GetAllLoginsAsync(BackendLoginsOrErrorReply callback) override;
  void GetAllLoginsWithAffiliationAndBrandingAsync(
      BackendLoginsOrErrorReply callback) override;
  void GetAutofillableLoginsAsync(BackendLoginsOrErrorReply callback) override;
  void FillMatchingLoginsAsync(
      BackendLoginsOrErrorReply callback,
      bool include_psl,
      const std::vector<PasswordFormDigest>& forms) override;
  void GetGroupedMatchingLoginsAsync(
      const PasswordFormDigest& form_digest,
      BackendLoginsOrErrorReply callback) override;
  void AddLoginAsync(StoredCredential cred,
                     PasswordChangesOrErrorReply callback) override;
  void UpdateLoginAsync(StoredCredential cred,
                        PasswordChangesOrErrorReply callback) override;
  void RemoveLoginAsync(const base::Location& location,
                        StoredCredential cred,
                        PasswordChangesOrErrorReply callback) override;
  void RemoveLoginsCreatedBetweenAsync(
      const base::Location& location,
      base::Time delete_begin,
      base::Time delete_end,
      PasswordChangesOrErrorReply callback) override;
  void DisableAutoSignInForOriginsAsync(
      const base::RepeatingCallback<bool(const GURL&)>& origin_filter,
      base::OnceClosure completion) override;
  SmartBubbleStatsStore* GetSmartBubbleStatsStore() override;
  std::unique_ptr<syncer::DataTypeControllerDelegate>
  CreateSyncControllerDelegate() override;
  void OnSyncServiceInitialized(syncer::SyncService* sync_service) override;
  base::WeakPtr<PasswordStoreBackend> AsWeakPtr() override;

  base::WeakPtrFactory<PasswordStoreEmptyBackend> weak_ptr_factory_{this};
};

}  // namespace password_manager
#endif  // CHROME_BROWSER_PASSWORD_MANAGER_ANDROID_PASSWORD_STORE_EMPTY_BACKEND_H_
