OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_WIN_CHROME_SELECT_FILE_DIALOG_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_WIN_CHROME_SELECT_FILE_DIALOG_FACTORY_H_ |
6 #define CHROME_BROWSER_WIN_CHROME_SELECT_FILE_DIALOG_FACTORY_H_ | 6 #define CHROME_BROWSER_WIN_CHROME_SELECT_FILE_DIALOG_FACTORY_H_ |
7 | 7 |
| 8 #include "base/compiler_specific.h" |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" |
9 #include "ui/shell_dialogs/select_file_dialog_factory.h" | 11 #include "ui/shell_dialogs/select_file_dialog_factory.h" |
10 | 12 |
| 13 namespace base { |
| 14 class SequencedTaskRunner; |
| 15 } // namespace base |
| 16 |
11 // Implements a Select File dialog that delegates to a Metro file picker on | 17 // Implements a Select File dialog that delegates to a Metro file picker on |
12 // Metro and to a utility process otherwise. The utility process is used in | 18 // Metro and to a utility process otherwise. The utility process is used in |
13 // order to isolate the Chrome browser process from potential instability | 19 // order to isolate the Chrome browser process from potential instability |
14 // caused by Shell extension modules loaded by GetOpenFileName. | 20 // caused by Shell extension modules loaded by GetOpenFileName. |
15 class ChromeSelectFileDialogFactory : public ui::SelectFileDialogFactory { | 21 class ChromeSelectFileDialogFactory : public ui::SelectFileDialogFactory { |
16 public: | 22 public: |
17 ChromeSelectFileDialogFactory(); | 23 // Uses |blocking_task_runner| to perform IPC with the utility process. |
| 24 explicit ChromeSelectFileDialogFactory( |
| 25 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); |
18 ~ChromeSelectFileDialogFactory() override; | 26 ~ChromeSelectFileDialogFactory() override; |
19 | 27 |
20 // ui::SelectFileDialogFactory implementation | 28 // ui::SelectFileDialogFactory implementation |
21 ui::SelectFileDialog* Create(ui::SelectFileDialog::Listener* listener, | 29 ui::SelectFileDialog* Create(ui::SelectFileDialog::Listener* listener, |
22 ui::SelectFilePolicy* policy) override; | 30 ui::SelectFilePolicy* policy) override; |
23 | 31 |
24 private: | 32 private: |
| 33 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 34 |
25 DISALLOW_COPY_AND_ASSIGN(ChromeSelectFileDialogFactory); | 35 DISALLOW_COPY_AND_ASSIGN(ChromeSelectFileDialogFactory); |
26 }; | 36 }; |
27 | 37 |
28 #endif // CHROME_BROWSER_WIN_CHROME_SELECT_FILE_DIALOG_FACTORY_H_ | 38 #endif // CHROME_BROWSER_WIN_CHROME_SELECT_FILE_DIALOG_FACTORY_H_ |
OLD | NEW |