ios_password_manager_driver.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_PASSWORD_MANAGER_IOS_IOS_PASSWORD_MANAGER_DRIVER_H_
  5. #define COMPONENTS_PASSWORD_MANAGER_IOS_IOS_PASSWORD_MANAGER_DRIVER_H_
  6. #include <vector>
  7. #include "components/password_manager/core/browser/password_generation_frame_helper.h"
  8. #include "components/password_manager/core/browser/password_manager_driver.h"
  9. #include "components/password_manager/ios/password_manager_driver_bridge.h"
  10. namespace autofill {
  11. struct PasswordFormFillData;
  12. } // namespace autofill
  13. namespace password_manager {
  14. class PasswordAutofillManager;
  15. class PasswordManager;
  16. } // namespace password_manager
  17. // An iOS implementation of password_manager::PasswordManagerDriver.
  18. class IOSPasswordManagerDriver
  19. : public password_manager::PasswordManagerDriver {
  20. public:
  21. explicit IOSPasswordManagerDriver(
  22. id<PasswordManagerDriverBridge> bridge,
  23. password_manager::PasswordManager* password_manager);
  24. IOSPasswordManagerDriver(const IOSPasswordManagerDriver&) = delete;
  25. IOSPasswordManagerDriver& operator=(const IOSPasswordManagerDriver&) = delete;
  26. ~IOSPasswordManagerDriver() override;
  27. // password_manager::PasswordManagerDriver implementation.
  28. int GetId() const override;
  29. void FillPasswordForm(
  30. const autofill::PasswordFormFillData& form_data) override;
  31. void InformNoSavedCredentials(
  32. bool should_show_popup_without_passwords) override;
  33. void FormEligibleForGenerationFound(
  34. const autofill::PasswordFormGenerationData& form) override;
  35. void GeneratedPasswordAccepted(const std::u16string& password) override;
  36. void FillSuggestion(const std::u16string& username,
  37. const std::u16string& password) override;
  38. void PreviewSuggestion(const std::u16string& username,
  39. const std::u16string& password) override;
  40. void ClearPreviewedForm() override;
  41. password_manager::PasswordGenerationFrameHelper* GetPasswordGenerationHelper()
  42. override;
  43. password_manager::PasswordManager* GetPasswordManager() override;
  44. password_manager::PasswordAutofillManager* GetPasswordAutofillManager()
  45. override;
  46. ::ui::AXTreeID GetAxTreeId() const override;
  47. bool IsInPrimaryMainFrame() const override;
  48. bool CanShowAutofillUi() const override;
  49. const GURL& GetLastCommittedURL() const override;
  50. private:
  51. __weak id<PasswordManagerDriverBridge> bridge_; // (weak)
  52. password_manager::PasswordManager* password_manager_;
  53. std::unique_ptr<password_manager::PasswordGenerationFrameHelper>
  54. password_generation_helper_;
  55. };
  56. #endif // COMPONENTS_PASSWORD_MANAGER_IOS_IOS_PASSWORD_MANAGER_DRIVER_H_