electron_autofill_driver.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 ELECTRON_SHELL_BROWSER_ELECTRON_AUTOFILL_DRIVER_H_
  5. #define ELECTRON_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. explicit AutofillDriver(content::RenderFrameHost* render_frame_host);
  18. AutofillDriver(const AutofillDriver&) = delete;
  19. AutofillDriver& operator=(const AutofillDriver&) = delete;
  20. ~AutofillDriver() override;
  21. void BindPendingReceiver(
  22. mojo::PendingAssociatedReceiver<mojom::ElectronAutofillDriver>
  23. pending_receiver);
  24. void ShowAutofillPopup(const gfx::RectF& bounds,
  25. const std::vector<std::u16string>& values,
  26. const std::vector<std::u16string>& labels) override;
  27. void HideAutofillPopup() override;
  28. private:
  29. content::RenderFrameHost* const render_frame_host_;
  30. #if defined(TOOLKIT_VIEWS)
  31. std::unique_ptr<AutofillPopup> autofill_popup_;
  32. #endif
  33. mojo::AssociatedReceiver<mojom::ElectronAutofillDriver> receiver_{this};
  34. };
  35. } // namespace electron
  36. #endif // ELECTRON_SHELL_BROWSER_ELECTRON_AUTOFILL_DRIVER_H_