| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/download/base_file.h" | 5 #include "content/browser/download/base_file.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return LogInterruptReason("SHFileOperation", result, interrupt_reason); | 208 return LogInterruptReason("SHFileOperation", result, interrupt_reason); |
| 209 return interrupt_reason; | 209 return interrupt_reason; |
| 210 } | 210 } |
| 211 | 211 |
| 212 DownloadInterruptReason BaseFile::AnnotateWithSourceInformation() { | 212 DownloadInterruptReason BaseFile::AnnotateWithSourceInformation() { |
| 213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 214 DCHECK(!detached_); | 214 DCHECK(!detached_); |
| 215 | 215 |
| 216 bound_net_log_.BeginEvent(net::NetLog::TYPE_DOWNLOAD_FILE_ANNOTATED); | 216 bound_net_log_.BeginEvent(net::NetLog::TYPE_DOWNLOAD_FILE_ANNOTATED); |
| 217 DownloadInterruptReason result = DOWNLOAD_INTERRUPT_REASON_NONE; | 217 DownloadInterruptReason result = DOWNLOAD_INTERRUPT_REASON_NONE; |
| 218 HRESULT hr = win_util::ScanAndSaveDownloadedFile(full_path_, source_url_); | 218 HRESULT hr = ScanAndSaveDownloadedFile(full_path_, source_url_); |
| 219 | 219 |
| 220 // If the download file is missing after the call, then treat this as an | 220 // If the download file is missing after the call, then treat this as an |
| 221 // interrupted download. | 221 // interrupted download. |
| 222 // | 222 // |
| 223 // If the ScanAndSaveDownloadedFile() call failed, but the downloaded file is | 223 // If the ScanAndSaveDownloadedFile() call failed, but the downloaded file is |
| 224 // still around, then don't interrupt the download. Attachment Execution | 224 // still around, then don't interrupt the download. Attachment Execution |
| 225 // Services deletes the submitted file if the downloaded file is blocked by | 225 // Services deletes the submitted file if the downloaded file is blocked by |
| 226 // policy or if it was found to be infected. | 226 // policy or if it was found to be infected. |
| 227 // | 227 // |
| 228 // If the file is still there, then the error could be due to AES not being | 228 // If the file is still there, then the error could be due to AES not being |
| 229 // available or some other error during the AES invocation. In either case, | 229 // available or some other error during the AES invocation. In either case, |
| 230 // we don't surface the error to the user. | 230 // we don't surface the error to the user. |
| 231 if (!file_util::PathExists(full_path_)) { | 231 if (!file_util::PathExists(full_path_)) { |
| 232 DCHECK(FAILED(hr)); | 232 DCHECK(FAILED(hr)); |
| 233 result = MapScanAndSaveErrorCodeToInterruptReason(hr); | 233 result = MapScanAndSaveErrorCodeToInterruptReason(hr); |
| 234 if (result == DOWNLOAD_INTERRUPT_REASON_NONE) { | 234 if (result == DOWNLOAD_INTERRUPT_REASON_NONE) { |
| 235 RecordDownloadCount(FILE_MISSING_AFTER_SUCCESSFUL_SCAN_COUNT); | 235 RecordDownloadCount(FILE_MISSING_AFTER_SUCCESSFUL_SCAN_COUNT); |
| 236 result = DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED; | 236 result = DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED; |
| 237 } | 237 } |
| 238 LogInterruptReason("ScanAndSaveDownloadedFile", hr, result); | 238 LogInterruptReason("ScanAndSaveDownloadedFile", hr, result); |
| 239 } | 239 } |
| 240 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_FILE_ANNOTATED); | 240 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_FILE_ANNOTATED); |
| 241 return result; | 241 return result; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace content | 244 } // namespace content |
| OLD | NEW |