web_dialog_helper.h 1.3 KB

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