| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_item.h" | 5 #include "chrome/browser/download/download_item.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/timer.h" | 10 #include "base/timer.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 void DownloadItem::UpdateObservers() { | 157 void DownloadItem::UpdateObservers() { |
| 158 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadUpdated(this)); | 158 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadUpdated(this)); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void DownloadItem::NotifyObserversDownloadFileCompleted() { | 161 void DownloadItem::NotifyObserversDownloadFileCompleted() { |
| 162 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadFileCompleted(this)); | 162 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadFileCompleted(this)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool DownloadItem::CanOpenDownload() { | 165 bool DownloadItem::CanOpenDownload() { |
| 166 return !Extension::IsExtension(target_name_) && | 166 return !Extension::IsExtension(target_name_) && |
| 167 !download_util::IsExecutableFile(target_name_); | 167 download_util::IsFileSafe(target_name_); |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool DownloadItem::ShouldOpenFileBasedOnExtension() { | 170 bool DownloadItem::ShouldOpenFileBasedOnExtension() { |
| 171 return download_manager_->ShouldOpenFileBasedOnExtension( | 171 return download_manager_->ShouldOpenFileBasedOnExtension( |
| 172 GetUserVerifiedFileName()); | 172 GetUserVerifiedFileName()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void DownloadItem::OpenFilesBasedOnExtension(bool open) { | 175 void DownloadItem::OpenFilesBasedOnExtension(bool open) { |
| 176 DownloadPrefs* prefs = download_manager_->download_prefs(); | 176 DownloadPrefs* prefs = download_manager_->download_prefs(); |
| 177 if (open) | 177 if (open) |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 return target_name_; | 434 return target_name_; |
| 435 return full_path_.BaseName(); | 435 return full_path_.BaseName(); |
| 436 } | 436 } |
| 437 | 437 |
| 438 void DownloadItem::Init(bool start_timer) { | 438 void DownloadItem::Init(bool start_timer) { |
| 439 if (target_name_.value().empty()) | 439 if (target_name_.value().empty()) |
| 440 target_name_ = full_path_.BaseName(); | 440 target_name_ = full_path_.BaseName(); |
| 441 if (start_timer) | 441 if (start_timer) |
| 442 StartProgressTimer(); | 442 StartProgressTimer(); |
| 443 } | 443 } |
| OLD | NEW |