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

Unified Diff: chrome/browser/download/download_path_reservation_tracker.h

Issue 2453633006: [downloads] Move platform specific code out of DownloadTargetDeterminer. (Closed)
Patch Set: . Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/download_path_reservation_tracker.h
diff --git a/chrome/browser/download/download_path_reservation_tracker.h b/chrome/browser/download/download_path_reservation_tracker.h
index 494253d5188d0ce44ecc1c9d0b8974b926949f25..673e629c77752f48c42093d0e2eb03554d17c74f 100644
--- a/chrome/browser/download/download_path_reservation_tracker.h
+++ b/chrome/browser/download/download_path_reservation_tracker.h
@@ -15,6 +15,13 @@ namespace content {
class DownloadItem;
}
+enum class PathValidationResult {
+ SUCCESS,
+ PATH_NOT_WRITABLE,
+ NAME_TOO_LONG,
+ CONFLICT
+};
+
// Chrome attempts to uniquify filenames that are assigned to downloads in order
// to avoid overwriting files that already exist on the file system. Downloads
// that are considered potentially dangerous use random intermediate filenames.
@@ -24,16 +31,16 @@ class DownloadItem;
class DownloadPathReservationTracker {
public:
// Callback used with |GetReservedPath|. |target_path| specifies the target
- // path for the download. |target_path_verified| is true if all of the
- // following is true:
+ // path for the download. If |result| is SUCCESS then:
// - |requested_target_path| (passed into GetReservedPath()) was writeable.
// - |target_path| was verified as being unique if uniqueness was
// required.
//
// If |requested_target_path| was not writeable, then the parent directory of
// |target_path| may be different from that of |requested_target_path|.
- typedef base::Callback<void(const base::FilePath& target_path,
- bool target_path_verified)> ReservedPathCallback;
+ using ReservedPathCallback =
+ base::Callback<void(PathValidationResult result,
+ const base::FilePath& target_path)>;
// The largest index for the uniquification suffix that we will try while
// attempting to come up with a unique path.
« no previous file with comments | « chrome/browser/download/download_file_picker.cc ('k') | chrome/browser/download/download_path_reservation_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698