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 // The danger type of the download could be set to MAYBE_DANGEROUS_CONTENT if 30 // the file type is handled by SafeBrowsing. However, if the SafeBrowsing 31 // service is unable to verify whether the file is safe or not, we are on our 32 // own. This flag indicates whether the download should be considered 33 // dangerous if SafeBrowsing returns an unknown verdict. 34 // 35 // Note that some downloads (e.g. "Save link as" on a link to a binary) would 36 // not be considered 'Dangerous' even if SafeBrowsing came back with an 37 // unknown verdict. So we can't always show a warning when SB fails. 38 bool is_dangerous_file; 39 40 // Suggested intermediate path. The downloaded bytes should be written to this 41 // path until all the bytes are available and the user has accepted a 42 // dangerous download. At that point, the download can be renamed to 43 // |target_path|. 44 base::FilePath intermediate_path; 45 46 // MIME type based on the file type of the download. This may be different 47 // from DownloadItem::GetMimeType() since the latter is based on the server 48 // response, and this one is based on the filename. 49 std::string mime_type; 50 51 // Whether the |target_path| would be handled safely by the browser if it were 52 // to be opened with a file:// URL. This can be used later to decide how file 53 // opens should be handled. The file is considered to be handled safely if the 54 // filetype is supported by the renderer or a sandboxed plug-in. 55 bool is_filetype_handled_safely; 56 }; 57 58 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ 59