[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 | |||||
[email protected] | a53209b | 2012-01-20 16:48:16 | [diff] [blame^] | 9 | #include "base/callback.h" |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 10 | #include "base/memory/ref_counted.h" |
[email protected] | 8fd0337 | 2011-11-15 18:51:09 | [diff] [blame] | 11 | #include "chrome/browser/ui/select_file_dialog.h" |
[email protected] | a53209b | 2012-01-20 16:48:16 | [diff] [blame^] | 12 | #include "content/public/browser/download_manager_delegate.h" |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 13 | |
[email protected] | e7557f17 | 2011-08-19 23:42:01 | [diff] [blame] | 14 | class DownloadPrefs; |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 15 | |
16 | // Handles showing a dialog to the user to ask for the filename to save a page. | ||||
17 | class SavePackageFilePicker : public SelectFileDialog::Listener { | ||||
18 | public: | ||||
[email protected] | a53209b | 2012-01-20 16:48:16 | [diff] [blame^] | 19 | SavePackageFilePicker(content::WebContents* web_contents, |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 20 | const FilePath& suggested_path, |
[email protected] | a53209b | 2012-01-20 16:48:16 | [diff] [blame^] | 21 | const FilePath::StringType& default_extension, |
[email protected] | e7557f17 | 2011-08-19 23:42:01 | [diff] [blame] | 22 | bool can_save_as_complete, |
[email protected] | a53209b | 2012-01-20 16:48:16 | [diff] [blame^] | 23 | DownloadPrefs* download_prefs, |
24 | content::SaveFilePathPickedCallback callback); | ||||
[email protected] | d089c60 | 2011-07-14 23:49:56 | [diff] [blame] | 25 | virtual ~SavePackageFilePicker(); |
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 26 | |
27 | // Used to disable prompting the user for a directory/filename of the saved | ||||
28 | // web page. This is available for testing. | ||||
29 | static void SetShouldPromptUser(bool should_prompt); | ||||
30 | |||||
31 | private: | ||||
32 | // SelectFileDialog::Listener implementation. | ||||
[email protected] | 0d5c08e | 2011-11-21 16:51:06 | [diff] [blame] | 33 | virtual void FileSelected(const FilePath& path, |
34 | int index, | ||||
35 | void* params) OVERRIDE; | ||||
36 | virtual void FileSelectionCanceled(void* params) OVERRIDE; | ||||
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 37 | |
[email protected] | a53209b | 2012-01-20 16:48:16 | [diff] [blame^] | 38 | // Used to look up the renderer process for this request to get the context. |
39 | int render_process_id_; | ||||
40 | |||||
41 | content::SaveFilePathPickedCallback callback_; | ||||
[email protected] | 0ffaa48 | 2011-07-14 23:41:28 | [diff] [blame] | 42 | |
43 | // For managing select file dialogs. | ||||
44 | scoped_refptr<SelectFileDialog> select_file_dialog_; | ||||
45 | |||||
46 | DISALLOW_COPY_AND_ASSIGN(SavePackageFilePicker); | ||||
47 | }; | ||||
48 | |||||
49 | #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_ |