electron_autofill_driver.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2019 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef SHELL_BROWSER_ELECTRON_AUTOFILL_DRIVER_H_
  5. #define SHELL_BROWSER_ELECTRON_AUTOFILL_DRIVER_H_
  6. #include <memory>
  7. #include <vector>
  8. #if defined(TOOLKIT_VIEWS)
  9. #include "shell/browser/ui/autofill_popup.h"
  10. #endif
  11. #include "mojo/public/cpp/bindings/associated_receiver.h"
  12. #include "mojo/public/cpp/bindings/pending_associated_receiver.h"
  13. #include "shell/common/api/api.mojom.h"
  14. namespace electron {
  15. class AutofillDriver : public mojom::ElectronAutofillDriver {
  16. public:
  17. AutofillDriver(
  18. content::RenderFrameHost* render_frame_host,
  19. mojo::PendingAssociatedReceiver<mojom::ElectronAutofillDriver> request);
  20. ~AutofillDriver() override;
  21. void ShowAutofillPopup(const gfx::RectF& bounds,
  22. const std::vector<std::u16string>& values,
  23. const std::vector<std::u16string>& labels) override;
  24. void HideAutofillPopup() override;
  25. private:
  26. content::RenderFrameHost* const render_frame_host_;
  27. #if defined(TOOLKIT_VIEWS)
  28. std::unique_ptr<AutofillPopup> autofill_popup_;
  29. #endif
  30. mojo::AssociatedReceiver<mojom::ElectronAutofillDriver> receiver_;
  31. };
  32. } // namespace electron
  33. #endif // SHELL_BROWSER_ELECTRON_AUTOFILL_DRIVER_H_