1 // Copyright 2013 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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_
8 #include "base/files/file_path.h"
9 #include "content/public/browser/download_danger_type.h"
10 #include "content/public/browser/download_item.h"
12 struct DownloadTargetInfo
{
14 ~DownloadTargetInfo();
16 // Final full target path of the download. Must be non-empty for the remaining
17 // fields to be considered valid. The path is a local file system path. Any
18 // existing file at this path should be overwritten.
19 base::FilePath target_path
;
21 // Disposition. This will be TARGET_DISPOSITION_PROMPT if the user was
22 // prompted during the process of determining the download target. Otherwise
23 // it will be TARGET_DISPOSITION_OVERWRITE.
24 content::DownloadItem::TargetDisposition target_disposition
;
26 // Danger type of the download.
27 content::DownloadDangerType danger_type
;
29 // Suggested intermediate path. The downloaded bytes should be written to this
30 // path until all the bytes are available and the user has accepted a
31 // dangerous download. At that point, the download can be renamed to
33 base::FilePath intermediate_path
;
35 // MIME type based on the file type of the download. This may be different
36 // from DownloadItem::GetMimeType() since the latter is based on the server
37 // response, and this one is based on the filename.
38 std::string mime_type
;
40 // Whether the |target_path| would be handled safely by the browser if it were
41 // to be opened with a file:// URL. This can be used later to decide how file
42 // opens should be handled. The file is considered to be handled safely if the
43 // filetype is supported by the renderer or a sandboxed plug-in.
44 bool is_filetype_handled_safely
;
47 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_