| Index: chrome/browser/ui/webui/downloads_dom_handler.cc
|
| diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc
|
| index 75209330acf6281ba5b485dfafc317ea080ddd0d..18c04a5e036ef96570f269f5858d5ee1e47405f1 100644
|
| --- a/chrome/browser/ui/webui/downloads_dom_handler.cc
|
| +++ b/chrome/browser/ui/webui/downloads_dom_handler.cc
|
| @@ -124,15 +124,6 @@ void DownloadsDOMHandler::ModelChanged() {
|
| it != download_items_.end(); ++it) {
|
| if (static_cast<int>(it - download_items_.begin()) > kMaxDownloads)
|
| break;
|
| -
|
| - DownloadItem* download = *it;
|
| - if (download->IsInProgress()) {
|
| - // We want to know what happens as the download progresses.
|
| - download->AddObserver(this);
|
| - } else if (download->safety_state() == DownloadItem::DANGEROUS) {
|
| - // We need to be notified when the user validates the dangerous download.
|
| - download->AddObserver(this);
|
| - }
|
| }
|
|
|
| SendCurrentDownloads();
|
| @@ -146,6 +137,8 @@ void DownloadsDOMHandler::HandleGetDownloads(const ListValue* args) {
|
| } else {
|
| SendCurrentDownloads();
|
| }
|
| +
|
| + download_manager_->CheckForFilesRemoval();
|
| }
|
|
|
| void DownloadsDOMHandler::HandleOpenFile(const ListValue* args) {
|
| @@ -211,6 +204,9 @@ void DownloadsDOMHandler::SendCurrentDownloads() {
|
| ListValue results_value;
|
| for (OrderedDownloads::iterator it = download_items_.begin();
|
| it != download_items_.end(); ++it) {
|
| + // Add observers for all download items just once
|
| + if (!(*it)->HasObserver(this))
|
| + (*it)->AddObserver(this);
|
| int index = static_cast<int>(it - download_items_.begin());
|
| if (index > kMaxDownloads)
|
| break;
|
|
|