Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1455)

Side by Side Diff: chrome/browser/download/save_package_file_picker.h

Issue 12662032: Merge SavePackageFilePicker{,ChromeOS} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r196175 Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_
6 #define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_ 6 #define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "content/public/browser/download_manager_delegate.h" 9 #include "content/public/browser/download_manager_delegate.h"
10 #include "ui/shell_dialogs/select_file_dialog.h" 10 #include "ui/shell_dialogs/select_file_dialog.h"
11 11
12 class DownloadPrefs; 12 class DownloadPrefs;
13 13
14 // Handles showing a dialog to the user to ask for the filename to save a page. 14 // Handles showing a dialog to the user to ask for the filename to save a page.
15 class SavePackageFilePicker : public ui::SelectFileDialog::Listener { 15 class SavePackageFilePicker : public ui::SelectFileDialog::Listener {
16 public: 16 public:
17 SavePackageFilePicker(content::WebContents* web_contents, 17 SavePackageFilePicker(
18 const base::FilePath& suggested_path, 18 content::WebContents* web_contents,
19 const base::FilePath::StringType& default_extension, 19 const base::FilePath& suggested_path,
20 bool can_save_as_complete, 20 const base::FilePath::StringType& default_extension,
21 DownloadPrefs* download_prefs, 21 bool can_save_as_complete,
22 const content::SavePackagePathPickedCallback& callback); 22 DownloadPrefs* download_prefs,
23 const base::Callback<void(const base::FilePath&)>& on_chosen,
24 const content::SavePackagePathPickedCallback& callback);
Randy Smith (Not in Mondays) 2013/04/25 17:58:55 Documentation somewhere explaining the difference
benjhayden 2013/04/30 21:11:12 Moot.
23 virtual ~SavePackageFilePicker(); 25 virtual ~SavePackageFilePicker();
24 26
25 // Used to disable prompting the user for a directory/filename of the saved 27 // Used to disable prompting the user for a directory/filename of the saved
26 // web page. This is available for testing. 28 // web page. This is available for testing.
27 static void SetShouldPromptUser(bool should_prompt); 29 static void SetShouldPromptUser(bool should_prompt);
28 30
29 private: 31 private:
30 // SelectFileDialog::Listener implementation. 32 // SelectFileDialog::Listener implementation.
31 virtual void FileSelected(const base::FilePath& path, 33 virtual void FileSelected(const base::FilePath& path,
32 int index, 34 int index,
33 void* unused_params) OVERRIDE; 35 void* unused_params) OVERRIDE;
34 virtual void FileSelectionCanceled(void* unused_params) OVERRIDE; 36 virtual void FileSelectionCanceled(void* unused_params) OVERRIDE;
35 37
36 bool ShouldSaveAsMHTML() const; 38 bool ShouldSaveAsMHTML() const;
37 39
38 // Used to look up the renderer process for this request to get the context. 40 // Used to look up the renderer process for this request to get the context.
39 int render_process_id_; 41 int render_process_id_;
40 42
41 // Whether the web page can be saved as a complete HTML file. 43 // Whether the web page can be saved as a complete HTML file.
42 bool can_save_as_complete_; 44 bool can_save_as_complete_;
43 45
46 base::Callback<void(const base::FilePath&)> on_chosen_;
47
44 content::SavePackagePathPickedCallback callback_; 48 content::SavePackagePathPickedCallback callback_;
45 49
46 // For managing select file dialogs. 50 // For managing select file dialogs.
47 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; 51 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
48 52
49 DISALLOW_COPY_AND_ASSIGN(SavePackageFilePicker); 53 DISALLOW_COPY_AND_ASSIGN(SavePackageFilePicker);
50 }; 54 };
51 55
52 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_ 56 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698