Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / download / save_package_file_picker.h
blob5e370521427b4f8e4d1dd52d4385fef9d6ccfe08
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_
6 #define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_
8 #include "base/memory/ref_counted.h"
9 #include "content/public/browser/download_manager_delegate.h"
10 #include "ui/shell_dialogs/select_file_dialog.h"
12 class DownloadPrefs;
14 // Handles showing a dialog to the user to ask for the filename to save a page.
15 class SavePackageFilePicker : public ui::SelectFileDialog::Listener {
16 public:
17 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);
24 virtual ~SavePackageFilePicker();
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);
30 private:
31 // SelectFileDialog::Listener implementation.
32 virtual void FileSelected(const base::FilePath& path,
33 int index,
34 void* unused_params) OVERRIDE;
35 virtual void FileSelectionCanceled(void* unused_params) OVERRIDE;
37 bool ShouldSaveAsMHTML() const;
39 // Used to look up the renderer process for this request to get the context.
40 int render_process_id_;
42 // Whether the web page can be saved as a complete HTML file.
43 bool can_save_as_complete_;
45 DownloadPrefs* download_prefs_;
47 content::SavePackagePathPickedCallback callback_;
49 // For managing select file dialogs.
50 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
52 DISALLOW_COPY_AND_ASSIGN(SavePackageFilePicker);
55 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_