Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
[email protected] | 6e1fcd1 | 2012-07-02 17:14:20 | [diff] [blame] | 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_UI_CHROME_SELECT_FILE_POLICY_H_ | ||||
6 | #define CHROME_BROWSER_UI_CHROME_SELECT_FILE_POLICY_H_ | ||||
7 | |||||
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 8 | #include "base/memory/raw_ptr.h" |
[email protected] | 4344a3c | 2013-01-17 23:49:20 | [diff] [blame] | 9 | #include "ui/shell_dialogs/select_file_policy.h" |
[email protected] | 6e1fcd1 | 2012-07-02 17:14:20 | [diff] [blame] | 10 | |
11 | namespace content { | ||||
12 | class WebContents; | ||||
13 | } | ||||
14 | |||||
15 | // A chrome specific SelectFilePolicy that checks local_state(), and will | ||||
16 | // display an infobar on the weakly owned |source_contents|. | ||||
17 | class ChromeSelectFilePolicy : public ui::SelectFilePolicy { | ||||
18 | public: | ||||
19 | explicit ChromeSelectFilePolicy(content::WebContents* source_contents); | ||||
Peter Boström | 53c6c595 | 2021-09-17 09:41:26 | [diff] [blame] | 20 | |
21 | ChromeSelectFilePolicy(const ChromeSelectFilePolicy&) = delete; | ||||
22 | ChromeSelectFilePolicy& operator=(const ChromeSelectFilePolicy&) = delete; | ||||
23 | |||||
dcheng | 5dd5ff6 | 2014-10-21 12:42:38 | [diff] [blame] | 24 | ~ChromeSelectFilePolicy() override; |
[email protected] | 6e1fcd1 | 2012-07-02 17:14:20 | [diff] [blame] | 25 | |
26 | // Overridden from ui::SelectFilePolicy: | ||||
dcheng | 5dd5ff6 | 2014-10-21 12:42:38 | [diff] [blame] | 27 | bool CanOpenSelectFileDialog() override; |
28 | void SelectFileDenied() override; | ||||
[email protected] | 6e1fcd1 | 2012-07-02 17:14:20 | [diff] [blame] | 29 | |
[email protected] | f1e0be7 | 2012-08-23 21:35:00 | [diff] [blame] | 30 | // Returns true if local state allows showing file pickers. |
31 | static bool FileSelectDialogsAllowed(); | ||||
32 | |||||
[email protected] | 6e1fcd1 | 2012-07-02 17:14:20 | [diff] [blame] | 33 | private: |
Pâris | e6361d0 | 2023-07-19 09:00:43 | [diff] [blame] | 34 | raw_ptr<content::WebContents, AcrossTasksDanglingUntriaged> source_contents_; |
[email protected] | 6e1fcd1 | 2012-07-02 17:14:20 | [diff] [blame] | 35 | }; |
36 | |||||
37 | #endif // CHROME_BROWSER_UI_CHROME_SELECT_FILE_POLICY_H_ |