• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_
7 
8 #include "base/files/file.h"
9 #include "base/files/file_path.h"
10 #include "content/common/content_export.h"
11 
12 namespace content {
13 
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();
21 
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;
26 
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;
30 
31   // If valid, contains the source data stream for the file contents.
32   base::File file;
33 
34   // The file offset at which to start the download.  May be 0.
35   int64 offset;
36 
37   // The state of the hash at the start of the download.  May be empty.
38   std::string hash_state;
39 
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;
46 
47  private:
48   DISALLOW_COPY_AND_ASSIGN(DownloadSaveInfo);
49 };
50 
51 }  // namespace content
52 
53 #endif  // CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_
54