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

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: Reflected Pawel's comments 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 // Returns the user's default "Downloads" folder provided by PathService.
54 const FilePath& GetDefaultDownloadDirectory(); 54 // This method always returns the folder provided by PathService
55 55 // even if the folder is being overridden. We should use
56 // Create a temporary file for a download in the user's default download 56 // DownloadPrefs::GetDefaultDownloadDirectory() instead unless we really
57 // directory and return true if was successful in creating the file. 57 // want the folder directly provided by PathService.
58 bool CreateTemporaryFileForDownload(FilePath* path); 58 FilePath GetDefaultDownloadDirectoryFromPathService();
59 59
60 // Return true if the |download_path| is dangerous path. 60 // Return true if the |download_path| is dangerous path.
61 bool DownloadPathIsDangerous(const FilePath& download_path); 61 bool DownloadPathIsDangerous(const FilePath& download_path);
62 62
63 // Create an extension based on the file name and mime type. 63 // Create an extension based on the file name and mime type.
64 void GenerateExtension(const FilePath& file_name, 64 void GenerateExtension(const FilePath& file_name,
65 const std::string& mime_type, 65 const std::string& mime_type,
66 FilePath::StringType* generated_extension); 66 FilePath::StringType* generated_extension);
67 67
68 // Create a file name based on the response from the server. 68 // 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. 281 // Erases all downloaded files with the specified path and name prefix.
282 // Used by download UI tests to clean up the download directory. 282 // Used by download UI tests to clean up the download directory.
283 void EraseUniqueDownloadFiles(const FilePath& path_prefix); 283 void EraseUniqueDownloadFiles(const FilePath& path_prefix);
284 284
285 // Returns a .crdownload intermediate path for the |suggested_path|. 285 // Returns a .crdownload intermediate path for the |suggested_path|.
286 FilePath GetCrDownloadPath(const FilePath& suggested_path); 286 FilePath GetCrDownloadPath(const FilePath& suggested_path);
287 287
288 } // namespace download_util 288 } // namespace download_util
289 289
290 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 290 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698