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. 4 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ 7 8 #include "base/files/file_path.h" 9 #include "content/public/browser/download_danger_type.h" 10 #include "content/public/browser/download_item.h" 11 12 struct DownloadTargetInfo { 13 DownloadTargetInfo(); 14 ~DownloadTargetInfo(); 15 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; 20 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; 25 26 // Danger type of the download. 27 content::DownloadDangerType danger_type; 28 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 32 // |target_path|. 33 base::FilePath intermediate_path; 34 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; 39 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_securely; 45 }; 46 47 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ 48