| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/download/download_file.h" | 5 #include "chrome/browser/download/download_file.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 DCHECK(!full_path_.empty()); | 130 DCHECK(!full_path_.empty()); |
| 131 file_ = file_util::OpenFile(full_path_, open_mode); | 131 file_ = file_util::OpenFile(full_path_, open_mode); |
| 132 if (!file_) { | 132 if (!file_) { |
| 133 return false; | 133 return false; |
| 134 } | 134 } |
| 135 | 135 |
| 136 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
| 137 // Sets the Zone to tell Windows that this file comes from the internet. | 137 // Sets the Zone to tell Windows that this file comes from the internet. |
| 138 // We ignore the return value because a failure is not fatal. | 138 // We ignore the return value because a failure is not fatal. |
| 139 win_util::SetInternetZoneIdentifier(full_path_); | 139 win_util::SetInternetZoneIdentifier(full_path_); |
| 140 #elif defined(OS_MAC) | 140 #elif defined(OS_MACOSX) |
| 141 // TODO(port) there should be an equivalent on Mac (there isn't on Linux). | 141 // TODO(port) there should be an equivalent on Mac (there isn't on Linux). |
| 142 NOTREACHED(); | 142 NOTREACHED(); |
| 143 #endif | 143 #endif |
| 144 return true; | 144 return true; |
| 145 } | 145 } |
| 146 | 146 |
| 147 // DownloadFileManager implementation ------------------------------------------ | 147 // DownloadFileManager implementation ------------------------------------------ |
| 148 | 148 |
| 149 DownloadFileManager::DownloadFileManager(MessageLoop* ui_loop, | 149 DownloadFileManager::DownloadFileManager(MessageLoop* ui_loop, |
| 150 ResourceDispatcherHost* rdh) | 150 ResourceDispatcherHost* rdh) |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod( | 595 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
| 596 this, &DownloadFileManager::StopUpdateTimer)); | 596 this, &DownloadFileManager::StopUpdateTimer)); |
| 597 } | 597 } |
| 598 | 598 |
| 599 // static | 599 // static |
| 600 void DownloadFileManager::DeleteFile(const FilePath& path) { | 600 void DownloadFileManager::DeleteFile(const FilePath& path) { |
| 601 // Make sure we only delete files. | 601 // Make sure we only delete files. |
| 602 if (!file_util::DirectoryExists(path)) | 602 if (!file_util::DirectoryExists(path)) |
| 603 file_util::Delete(path, false); | 603 file_util::Delete(path, false); |
| 604 } | 604 } |
| OLD | NEW |