web_dialog_helper.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (c) 2014 GitHub, Inc. All rights reserved.
  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_WEB_DIALOG_HELPER_H_
  5. #define SHELL_BROWSER_WEB_DIALOG_HELPER_H_
  6. #include <memory>
  7. #include <vector>
  8. #include "base/memory/weak_ptr.h"
  9. #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
  10. namespace base {
  11. class FilePath;
  12. }
  13. namespace content {
  14. class FileSelectListener;
  15. class RenderFrameHost;
  16. class WebContents;
  17. } // namespace content
  18. namespace electron {
  19. class NativeWindow;
  20. class WebDialogHelper {
  21. public:
  22. WebDialogHelper(NativeWindow* window, bool offscreen);
  23. ~WebDialogHelper();
  24. void RunFileChooser(content::RenderFrameHost* render_frame_host,
  25. std::unique_ptr<content::FileSelectListener> listener,
  26. const blink::mojom::FileChooserParams& params);
  27. void EnumerateDirectory(content::WebContents* web_contents,
  28. std::unique_ptr<content::FileSelectListener> listener,
  29. const base::FilePath& path);
  30. private:
  31. NativeWindow* window_;
  32. bool offscreen_;
  33. base::WeakPtrFactory<WebDialogHelper> weak_factory_;
  34. DISALLOW_COPY_AND_ASSIGN(WebDialogHelper);
  35. };
  36. } // namespace electron
  37. #endif // SHELL_BROWSER_WEB_DIALOG_HELPER_H_