diff options
Diffstat (limited to 'chrome/browser/ui/webui')
-rw-r--r-- | chrome/browser/ui/webui/active_downloads_ui.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/imageburner_ui.cc | 46 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/imageburner_ui.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/webui/downloads_dom_handler.h | 1 |
4 files changed, 23 insertions, 31 deletions
diff --git a/chrome/browser/ui/webui/active_downloads_ui.cc b/chrome/browser/ui/webui/active_downloads_ui.cc index 580193b..b37c280 100644 --- a/chrome/browser/ui/webui/active_downloads_ui.cc +++ b/chrome/browser/ui/webui/active_downloads_ui.cc @@ -115,7 +115,6 @@ class ActiveDownloadsHandler // DownloadItem::Observer interface. virtual void OnDownloadUpdated(DownloadItem* item); - virtual void OnDownloadFileCompleted(DownloadItem* item); virtual void OnDownloadOpened(DownloadItem* item) { } // DownloadManager::Observer interface. @@ -704,10 +703,6 @@ void ActiveDownloadsHandler::OnDownloadUpdated(DownloadItem* item) { *download_util::CreateDownloadItemValue(item, id)); } -void ActiveDownloadsHandler::OnDownloadFileCompleted(DownloadItem* item) { - OnDownloadUpdated(item); -} - void ActiveDownloadsHandler::DeleteFile(const FilePath& path, TaskProxy* task) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (!file_util::Delete(path, true)) { diff --git a/chrome/browser/ui/webui/chromeos/imageburner_ui.cc b/chrome/browser/ui/webui/chromeos/imageburner_ui.cc index 30a6a96..1d66791 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner_ui.cc +++ b/chrome/browser/ui/webui/chromeos/imageburner_ui.cc @@ -244,19 +244,18 @@ void ImageBurnHandler::ProgressUpdated(chromeos::BurnLibrary* object, } void ImageBurnHandler::OnDownloadUpdated(DownloadItem* download) { - if (download->IsPartialDownload()) { - scoped_ptr<DictionaryValue> result_value( - download_util::CreateDownloadItemValue(download, 0)); - web_ui_->CallJavascriptFunction("downloadUpdated", *result_value); + if (download->IsCancelled()) { + DownloadCompleted(false); // Should stop observation. + DCHECK(!download_item_observer_added_); + } else if (download->IsComplete()) { + zip_image_file_path_ = download->full_path(); + DownloadCompleted(true); // Should stop observation. + DCHECK(!download_item_observer_added_); + } else if (download->IsPartialDownload()) { + scoped_ptr<DictionaryValue> result_value( + download_util::CreateDownloadItemValue(download, 0)); + web_ui_->CallJavascriptFunction("downloadUpdated", *result_value); } - if (download->IsCancelled()) - DownloadCompleted(false); -} - -void ImageBurnHandler::OnDownloadFileCompleted(DownloadItem* download) { - DCHECK(download->IsComplete()); - zip_image_file_path_ = download->full_path(); - DownloadCompleted(true); } void ImageBurnHandler::OnDownloadOpened(DownloadItem* download) { @@ -590,18 +589,19 @@ void ImageBurnResourceManager::OnDownloadUpdated(DownloadItem* download) { if (download->IsCancelled()) { image_url_.reset(); ConfigFileFetched(false); - } -} -void ImageBurnResourceManager::OnDownloadFileCompleted(DownloadItem* download) { - DCHECK(download->IsComplete()); - std::string image_url; - if (file_util::ReadFileToString(config_file_path_, &image_url)) { - image_url_.reset(new GURL(std::string(kImageBaseURL) + image_url)); - ConfigFileFetched(true); - } else { - image_url_.reset(); - ConfigFileFetched(false); + // ConfigFileFetched should remove observer. + DCHECK(!download_item_observer_added_); + DCHECK(active_download_item_ == NULL); + } else if (download->IsComplete()) { + std::string image_url; + if (file_util::ReadFileToString(config_file_path_, &image_url)) { + image_url_.reset(new GURL(std::string(kImageBaseURL) + image_url)); + ConfigFileFetched(true); + } else { + image_url_.reset(); + ConfigFileFetched(false); + } } } diff --git a/chrome/browser/ui/webui/chromeos/imageburner_ui.h b/chrome/browser/ui/webui/chromeos/imageburner_ui.h index 3a64f84..4dfe9e1 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner_ui.h +++ b/chrome/browser/ui/webui/chromeos/imageburner_ui.h @@ -99,7 +99,6 @@ class ImageBurnResourceManager // DownloadItem::Observer interface virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE; - virtual void OnDownloadFileCompleted(DownloadItem* download) OVERRIDE; virtual void OnDownloadOpened(DownloadItem* download) OVERRIDE {} // DownloadManager::Observer interface @@ -192,7 +191,6 @@ class ImageBurnHandler : public WebUIMessageHandler, // DownloadItem::Observer interface. virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE; - virtual void OnDownloadFileCompleted(DownloadItem* download) OVERRIDE; virtual void OnDownloadOpened(DownloadItem* download) OVERRIDE; // DownloadManager::Observer interface. diff --git a/chrome/browser/ui/webui/downloads_dom_handler.h b/chrome/browser/ui/webui/downloads_dom_handler.h index 3778015..bda09ec 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler.h +++ b/chrome/browser/ui/webui/downloads_dom_handler.h @@ -31,7 +31,6 @@ class DownloadsDOMHandler : public WebUIMessageHandler, // DownloadItem::Observer interface virtual void OnDownloadUpdated(DownloadItem* download); - virtual void OnDownloadFileCompleted(DownloadItem* download) { } virtual void OnDownloadOpened(DownloadItem* download) { } // DownloadManager::Observer interface |