Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: chrome/browser/extensions/api/file_system/file_entry_picker.h

Issue 2967223002: Move fileSystem API FilePicker class to own file (Closed)
Patch Set: CHECK web_contents Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_ENTRY_PICKER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_ENTRY_PICKER_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "ui/shell_dialogs/select_file_dialog.h"
13
14 namespace base {
15 class FilePath;
16 } // namespace base
17
18 namespace content {
19 class WebContents;
20 } // namespace content
21
22 namespace extensions {
23
24 // Shows a dialog to the user to ask for the filename for a file to save or
25 // open. Deletes itself once the dialog is closed.
26 class FileEntryPicker : public ui::SelectFileDialog::Listener {
27 public:
28 using FilesSelectedCallback =
29 base::OnceCallback<void(const std::vector<base::FilePath>& paths)>;
30
31 // Creates a file picker. After the user picks file(s) or cancels, the
32 // relevant callback is called and this object deletes itself.
33 // The dialog is modal to the |web_contents|'s window.
34 // See SelectFileDialog::SelectFile for the other parameters.
35 FileEntryPicker(content::WebContents* web_contents,
36 const base::FilePath& suggested_name,
37 const ui::SelectFileDialog::FileTypeInfo& file_type_info,
38 ui::SelectFileDialog::Type picker_type,
39 FilesSelectedCallback files_selected_callback,
40 base::OnceClosure file_selection_canceled_callback);
41
42 private:
43 ~FileEntryPicker() override; // FileEntryPicker deletes itself.
44
45 // ui::SelectFileDialog::Listener implementation.
46 void FileSelected(const base::FilePath& path,
47 int index,
48 void* params) override;
49 void FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file,
50 int index,
51 void* params) override;
52 void MultiFilesSelected(const std::vector<base::FilePath>& files,
53 void* params) override;
54 void MultiFilesSelectedWithExtraInfo(
55 const std::vector<ui::SelectedFileInfo>& files,
56 void* params) override;
57 void FileSelectionCanceled(void* params) override;
58
59 FilesSelectedCallback files_selected_callback_;
60 base::OnceClosure file_selection_canceled_callback_;
61 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
62
63 DISALLOW_COPY_AND_ASSIGN(FileEntryPicker);
64 };
65
66 } // namespace extensions
67
68 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_ENTRY_PICKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/BUILD.gn ('k') | chrome/browser/extensions/api/file_system/file_entry_picker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698