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

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

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Remove DownloadTest.DownloadFolder2 and SavePageBrowserTest.SaveFolder4 Created 9 years, 6 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) 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 // Download utilities. 5 // Download utilities.
6 6
7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
9 #pragma once 9 #pragma once
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 namespace gfx { 44 namespace gfx {
45 class Canvas; 45 class Canvas;
46 class Image; 46 class Image;
47 } 47 }
48 48
49 namespace download_util { 49 namespace download_util {
50 50
51 // Download temporary file creation -------------------------------------------- 51 // Download temporary file creation --------------------------------------------
52 52
53 // Return the default download directory. 53 // Chooses a writable directory from |website_save_dir|, |download_save_dir|
54 const FilePath& GetDefaultDownloadDirectory(); 54 // and |default_download_dir| in this order of priority.
55 // If none of them is writable, creates |download_save_dir| and
56 // chooses |download_save_dir|. The choosed directory is stored to |save_dir|.
57 // Returns true if neither |website_save_dir| nor |download_save_dir|
58 // is writable, which indicates the select file dialog should be displayed.
59 bool ChooseSavableDirectory(const FilePath& website_save_dir,
60 const FilePath& download_save_dir,
61 const FilePath& default_download_dir,
62 FilePath* save_dir);
55 63
56 // Create a temporary file for a download in the user's default download 64 // Returns the user's default "Downloads" folder provided by PathService.
57 // directory and return true if was successful in creating the file. 65 // This method always returns the folder provided by PathService
58 bool CreateTemporaryFileForDownload(FilePath* path); 66 // even if the folder is being overridden. We should use
67 // DownloadPrefs::GetDefaultDownloadDirectory() instead unless we really
68 // want the folder directly provided by PathService.
69 FilePath GetDefaultDownloadDirectoryFromPathService();
59 70
60 // Return true if the |download_path| is dangerous path. 71 // Return true if the |download_path| is dangerous path.
61 bool DownloadPathIsDangerous(const FilePath& download_path); 72 bool DownloadPathIsDangerous(const FilePath& download_path);
62 73
63 // Create an extension based on the file name and mime type. 74 // Create an extension based on the file name and mime type.
64 void GenerateExtension(const FilePath& file_name, 75 void GenerateExtension(const FilePath& file_name,
65 const std::string& mime_type, 76 const std::string& mime_type,
66 FilePath::StringType* generated_extension); 77 FilePath::StringType* generated_extension);
67 78
68 // Create a file name based on the response from the server. 79 // Create a file name based on the response from the server.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // Erases all downloaded files with the specified path and name prefix. 292 // Erases all downloaded files with the specified path and name prefix.
282 // Used by download UI tests to clean up the download directory. 293 // Used by download UI tests to clean up the download directory.
283 void EraseUniqueDownloadFiles(const FilePath& path_prefix); 294 void EraseUniqueDownloadFiles(const FilePath& path_prefix);
284 295
285 // Returns a .crdownload intermediate path for the |suggested_path|. 296 // Returns a .crdownload intermediate path for the |suggested_path|.
286 FilePath GetCrDownloadPath(const FilePath& suggested_path); 297 FilePath GetCrDownloadPath(const FilePath& suggested_path);
287 298
288 } // namespace download_util 299 } // namespace download_util
289 300
290 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 301 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698