summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/save_package.h
diff options
context:
space:
mode:
authorpaul@chromium.org <paul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 22:47:08 +0000
committerpaul@chromium.org <paul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 22:47:08 +0000
commit4e58b466275032dd9cdf3b7416015c025d85622d (patch)
tree94ec2250f805f3ab3e1a40882f3f095942c275bf /chrome/browser/download/save_package.h
parent905075182a7867d5345284951980fb5ceb09bff7 (diff)
downloadchromium_src-4e58b466275032dd9cdf3b7416015c025d85622d.zip
chromium_src-4e58b466275032dd9cdf3b7416015c025d85622d.tar.gz
chromium_src-4e58b466275032dd9cdf3b7416015c025d85622d.tar.bz2
Ensure proper paths when saving pages with no title.
When saving a page with no title, such as a text file, attempt to use a sane value for the save name by retrieving the last component of the URL (if one exists). This prevents the case where a page http://www.foo.com/a/path/name.txt is saved as file "http www" with extension type "foo.com a path name.txt". This change also makes the SavePackage code a little more flexible and simpler to test. BUG=none TEST=Covered by unittest. Review URL: http://codereview.chromium.org/155266 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/save_package.h')
-rw-r--r--chrome/browser/download/save_package.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/chrome/browser/download/save_package.h b/chrome/browser/download/save_package.h
index 8d120602..c448bef 100644
--- a/chrome/browser/download/save_package.h
+++ b/chrome/browser/download/save_package.h
@@ -236,11 +236,13 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage>,
saved_failed_items_.size());
}
+ // Retrieve the preference for the directory to save pages to.
+ static FilePath GetSaveDirPreference(PrefService* prefs);
+
// Helper function for preparing suggested name for the SaveAs Dialog. The
- // suggested name is composed of the default save path and the web document's
- // title.
- static FilePath GetSuggestNameForSaveAs(
- PrefService* prefs, const FilePath& name, bool can_save_as_complete);
+ // suggested name is determined by the web document's title.
+ static FilePath GetSuggestedNameForSaveAs(const FilePath& name,
+ bool can_save_as_complete);
// Ensure that the file name has a proper extension for HTML by adding ".htm"
// if necessary.
@@ -306,6 +308,7 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage>,
scoped_refptr<SelectFileDialog> select_file_dialog_;
friend class SavePackageTest;
+
DISALLOW_COPY_AND_ASSIGN(SavePackage);
};