blob: 5e370521427b4f8e4d1dd52d4385fef9d6ccfe08 [file] [log] [blame]
[email protected]6474b112012-05-04 19:35:271// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]0ffaa482011-07-14 23:41:282// 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_
[email protected]0ffaa482011-07-14 23:41:287
8#include "base/memory/ref_counted.h"
[email protected]a53209b2012-01-20 16:48:169#include "content/public/browser/download_manager_delegate.h"
[email protected]4344a3c2013-01-17 23:49:2010#include "ui/shell_dialogs/select_file_dialog.h"
[email protected]0ffaa482011-07-14 23:41:2811
[email protected]e7557f172011-08-19 23:42:0112class DownloadPrefs;
[email protected]0ffaa482011-07-14 23:41:2813
14// Handles showing a dialog to the user to ask for the filename to save a page.
[email protected]92f54082012-07-31 01:43:1415class SavePackageFilePicker : public ui::SelectFileDialog::Listener {
[email protected]0ffaa482011-07-14 23:41:2816 public:
[email protected]50641fcd2013-05-30 14:15:4517 SavePackageFilePicker(
18 content::WebContents* web_contents,
19 const base::FilePath& suggested_path,
20 const base::FilePath::StringType& default_extension,
21 bool can_save_as_complete,
22 DownloadPrefs* download_prefs,
23 const content::SavePackagePathPickedCallback& callback);
[email protected]d089c602011-07-14 23:49:5624 virtual ~SavePackageFilePicker();
[email protected]0ffaa482011-07-14 23:41:2825
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.
[email protected]650b2d52013-02-10 03:41:4532 virtual void FileSelected(const base::FilePath& path,
[email protected]0d5c08e2011-11-21 16:51:0633 int index,
[email protected]6474b112012-05-04 19:35:2734 void* unused_params) OVERRIDE;
35 virtual void FileSelectionCanceled(void* unused_params) OVERRIDE;
36
37 bool ShouldSaveAsMHTML() const;
[email protected]0ffaa482011-07-14 23:41:2838
[email protected]a53209b2012-01-20 16:48:1639 // Used to look up the renderer process for this request to get the context.
40 int render_process_id_;
41
[email protected]6474b112012-05-04 19:35:2742 // Whether the web page can be saved as a complete HTML file.
43 bool can_save_as_complete_;
44
[email protected]50641fcd2013-05-30 14:15:4545 DownloadPrefs* download_prefs_;
46
[email protected]6474b112012-05-04 19:35:2747 content::SavePackagePathPickedCallback callback_;
[email protected]0ffaa482011-07-14 23:41:2848
49 // For managing select file dialogs.
[email protected]92f54082012-07-31 01:43:1450 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
[email protected]0ffaa482011-07-14 23:41:2851
52 DISALLOW_COPY_AND_ASSIGN(SavePackageFilePicker);
53};
54
55#endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_