[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 1 | // Copyright (c) 2011 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_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_ | ||||
6 | #define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_ | ||||
7 | #pragma once | ||||
8 | |||||
9 | #include "base/memory/ref_counted.h" | ||||
[email protected] | 680d2d4 | 2011-07-18 22:58:21 | [diff] [blame] | 10 | #include "base/memory/weak_ptr.h" |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 11 | #include "chrome/browser/ui/shell_dialogs.h" |
12 | |||||
[email protected] | e7557f17 | 2011-08-19 23:42:01 | [diff] [blame^] | 13 | class DownloadPrefs; |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 14 | class FilePath; |
15 | class SavePackage; | ||||
16 | |||||
17 | // Handles showing a dialog to the user to ask for the filename to save a page. | ||||
18 | class SavePackageFilePicker : public SelectFileDialog::Listener { | ||||
19 | public: | ||||
[email protected] | 680d2d4 | 2011-07-18 22:58:21 | [diff] [blame] | 20 | SavePackageFilePicker(const base::WeakPtr<SavePackage>& save_package, |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 21 | const FilePath& suggested_path, |
[email protected] | e7557f17 | 2011-08-19 23:42:01 | [diff] [blame^] | 22 | bool can_save_as_complete, |
23 | DownloadPrefs* download_prefs); | ||||
[email protected] | d089c60 | 2011-07-14 23:49:56 | [diff] [blame] | 24 | virtual ~SavePackageFilePicker(); |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 25 | |
26 | // Used to disable prompting the user for a directory/filename of the saved | ||||
27 | // web page. This is available for testing. | ||||
28 | static void SetShouldPromptUser(bool should_prompt); | ||||
29 | |||||
30 | private: | ||||
31 | // SelectFileDialog::Listener implementation. | ||||
32 | virtual void FileSelected(const FilePath& path, int index, void* params); | ||||
33 | virtual void FileSelectionCanceled(void* params); | ||||
34 | |||||
[email protected] | 680d2d4 | 2011-07-18 22:58:21 | [diff] [blame] | 35 | base::WeakPtr<SavePackage> save_package_; |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 36 | |
37 | // For managing select file dialogs. | ||||
38 | scoped_refptr<SelectFileDialog> select_file_dialog_; | ||||
39 | |||||
40 | DISALLOW_COPY_AND_ASSIGN(SavePackageFilePicker); | ||||
41 | }; | ||||
42 | |||||
43 | #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_ |