Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/callback.h" | |
| 10 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/ui/select_file_dialog.h" | 10 #include "chrome/browser/ui/select_file_dialog.h" |
| 12 #include "content/public/browser/download_manager_delegate.h" | 11 #include "content/public/browser/download_manager_delegate.h" |
| 13 | 12 |
| 14 class DownloadPrefs; | 13 class DownloadPrefs; |
| 15 | 14 |
| 16 // Handles showing a dialog to the user to ask for the filename to save a page. | 15 // Handles showing a dialog to the user to ask for the filename to save a page. |
| 17 class SavePackageFilePicker : public SelectFileDialog::Listener { | 16 class SavePackageFilePicker : public SelectFileDialog::Listener { |
| 18 public: | 17 public: |
| 19 SavePackageFilePicker(content::WebContents* web_contents, | 18 SavePackageFilePicker(content::WebContents* web_contents, |
| 20 const FilePath& suggested_path, | 19 FilePath suggested_path, |
|
asanka
2012/04/26 16:06:20
Why do this? This will trigger a Coverity warning.
benjhayden
2012/04/26 16:33:36
Which/what kind of warning? Can you elaborate?
asanka
2012/04/26 18:15:25
The warning is "Big parameter passed by value". Gr
benjhayden
2012/04/26 19:00:48
Done.
| |
| 21 const FilePath::StringType& default_extension, | 20 FilePath::StringType default_extension, |
| 22 bool can_save_as_complete, | 21 bool can_save_as_complete, |
| 23 DownloadPrefs* download_prefs, | 22 DownloadPrefs* download_prefs, |
| 24 content::SaveFilePathPickedCallback callback); | 23 content::SaveFilePathPickedCallback callback); |
| 25 virtual ~SavePackageFilePicker(); | 24 virtual ~SavePackageFilePicker(); |
| 26 | 25 |
| 27 // Used to disable prompting the user for a directory/filename of the saved | 26 // Used to disable prompting the user for a directory/filename of the saved |
| 28 // web page. This is available for testing. | 27 // web page. This is available for testing. |
| 29 static void SetShouldPromptUser(bool should_prompt); | 28 static void SetShouldPromptUser(bool should_prompt); |
| 30 | 29 |
| 31 private: | 30 private: |
| 32 // SelectFileDialog::Listener implementation. | 31 // SelectFileDialog::Listener implementation. |
| 33 virtual void FileSelected(const FilePath& path, | 32 virtual void FileSelected(const FilePath& path, |
| 34 int index, | 33 int index, |
| 35 void* params) OVERRIDE; | 34 void* unused_params) OVERRIDE; |
| 36 virtual void FileSelectionCanceled(void* params) OVERRIDE; | 35 virtual void FileSelectionCanceled(void* unused_params) OVERRIDE; |
| 36 | |
| 37 bool ShouldSaveAsMHTML() const; | |
| 37 | 38 |
| 38 // Used to look up the renderer process for this request to get the context. | 39 // Used to look up the renderer process for this request to get the context. |
| 39 int render_process_id_; | 40 int render_process_id_; |
| 40 | 41 |
| 42 // Whether the web page can be saved as a complete HTML file. | |
| 43 bool can_save_as_complete_; | |
| 44 | |
| 41 content::SaveFilePathPickedCallback callback_; | 45 content::SaveFilePathPickedCallback callback_; |
| 42 | 46 |
| 43 // For managing select file dialogs. | 47 // For managing select file dialogs. |
| 44 scoped_refptr<SelectFileDialog> select_file_dialog_; | 48 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 45 | 49 |
| 46 DISALLOW_COPY_AND_ASSIGN(SavePackageFilePicker); | 50 DISALLOW_COPY_AND_ASSIGN(SavePackageFilePicker); |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_ | 53 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_H_ |
| OLD | NEW |