electron_autofill_driver.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 "base/memory/raw_ptr.h"
  12. #include "mojo/public/cpp/bindings/associated_receiver.h"
  13. #include "mojo/public/cpp/bindings/pending_associated_receiver.h"
  14. #include "shell/common/api/api.mojom.h"
  15. namespace electron {
  16. class AutofillDriver : public mojom::ElectronAutofillDriver {
  17. public:
  18. explicit AutofillDriver(content::RenderFrameHost* render_frame_host);
  19. AutofillDriver(const AutofillDriver&) = delete;
  20. AutofillDriver& operator=(const AutofillDriver&) = delete;
  21. ~AutofillDriver() override;
  22. void BindPendingReceiver(
  23. mojo::PendingAssociatedReceiver<mojom::ElectronAutofillDriver>
  24. pending_receiver);
  25. void ShowAutofillPopup(const gfx::RectF& bounds,
  26. const std::vector<std::u16string>& values,
  27. const std::vector<std::u16string>& labels) override;
  28. void HideAutofillPopup() override;
  29. private:
  30. raw_ptr<content::RenderFrameHost> const render_frame_host_;
  31. #if defined(TOOLKIT_VIEWS)
  32. std::unique_ptr<AutofillPopup> autofill_popup_;
  33. #endif
  34. mojo::AssociatedReceiver<mojom::ElectronAutofillDriver> receiver_{this};
  35. };
  36. } // namespace electron
  37. #endif // ELECTRON_SHELL_BROWSER_ELECTRON_AUTOFILL_DRIVER_H_