Chromium Code Reviews| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 void DownloadItem::RemoveObserver(Observer* observer) { | 187 void DownloadItem::RemoveObserver(Observer* observer) { |
| 188 observers_.RemoveObserver(observer); | 188 observers_.RemoveObserver(observer); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void DownloadItem::UpdateObservers() { | 191 void DownloadItem::UpdateObservers() { |
| 192 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadUpdated(this)); | 192 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadUpdated(this)); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void DownloadItem::NotifyObserversDownloadFileCompleted() { | 195 void DownloadItem::NotifyObserversDownloadFileCompleted() { |
| 196 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadFileCompleted(this)); | 196 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadFileCompleted(this)); |
| 197 | |
| 198 BrowserThread::PostTask( | |
| 199 BrowserThread::UI, | |
| 200 FROM_HERE, | |
| 201 NewRunnableMethod(download_manager_, | |
| 202 &DownloadManager::OnDownloadFileCompleted, | |
| 203 id())); | |
|
Randy Smith (Not in Mondays)
2011/01/03 22:02:22
Oh, what a tangled web we're trying to unweave :-J
ahendrickson
2011/01/04 16:51:38
Hmm, looking at the |DownloadItem| code, I don't s
| |
| 197 } | 204 } |
| 198 | 205 |
| 199 bool DownloadItem::CanOpenDownload() { | 206 bool DownloadItem::CanOpenDownload() { |
| 200 return !Extension::IsExtension(target_name_) && | 207 return !Extension::IsExtension(target_name_) && |
| 201 download_util::IsFileSafe(target_name_); | 208 download_util::IsFileSafe(target_name_); |
| 202 } | 209 } |
| 203 | 210 |
| 204 bool DownloadItem::ShouldOpenFileBasedOnExtension() { | 211 bool DownloadItem::ShouldOpenFileBasedOnExtension() { |
| 205 return download_manager_->ShouldOpenFileBasedOnExtension( | 212 return download_manager_->ShouldOpenFileBasedOnExtension( |
| 206 GetUserVerifiedFilePath()); | 213 GetUserVerifiedFilePath()); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 target_name_.value().c_str(), | 551 target_name_.value().c_str(), |
| 545 full_path().value().c_str()); | 552 full_path().value().c_str()); |
| 546 } else { | 553 } else { |
| 547 description += base::StringPrintf(" url = \"%s\"", url().spec().c_str()); | 554 description += base::StringPrintf(" url = \"%s\"", url().spec().c_str()); |
| 548 } | 555 } |
| 549 | 556 |
| 550 description += " }"; | 557 description += " }"; |
| 551 | 558 |
| 552 return description; | 559 return description; |
| 553 } | 560 } |
| OLD | NEW |