Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / browser / download_save_info.h
blob0912461da98235003a73b2a3b8a3c162de46dc77
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_
8 #include "base/files/file.h"
9 #include "base/files/file_path.h"
10 #include "content/common/content_export.h"
12 namespace content {
14 // Holds the information about how to save a download file.
15 // In the case of download continuation, |file_path| is set to the current file
16 // name, |offset| is set to the point where we left off, and |hash_state| will
17 // hold the state of the hash algorithm where we left off.
18 struct CONTENT_EXPORT DownloadSaveInfo {
19 DownloadSaveInfo();
20 ~DownloadSaveInfo();
22 // If non-empty, contains the full target path of the download that has been
23 // determined prior to download initiation. This is considered to be a trusted
24 // path.
25 base::FilePath file_path;
27 // If non-empty, contains an untrusted filename suggestion. This can't contain
28 // a path (only a filename), and is only effective if |file_path| is empty.
29 base::string16 suggested_name;
31 // If valid, contains the source data stream for the file contents.
32 base::File file;
34 // The file offset at which to start the download. May be 0.
35 int64 offset;
37 // The state of the hash at the start of the download. May be empty.
38 std::string hash_state;
40 // If |prompt_for_save_location| is true, and |file_path| is empty, then
41 // the user will be prompted for a location to save the download. Otherwise,
42 // the location will be determined automatically using |file_path| as a
43 // basis if |file_path| is not empty.
44 // |prompt_for_save_location| defaults to false.
45 bool prompt_for_save_location;
47 private:
48 DISALLOW_COPY_AND_ASSIGN(DownloadSaveInfo);
51 } // namespace content
53 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_