Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2893)

Unified Diff: chrome/browser/dom_ui/filebrowse_ui.cc

Issue 6320007: Updates filebrowser list when download starts/ends. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: nits Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/filebrowse_ui.cc
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc
index ef5a86794c3d0b021d840bd46c2f8f8455a0bfb3..17375df5951fc9ab468f3a8dd11628639bd91d66 100644
--- a/chrome/browser/dom_ui/filebrowse_ui.cc
+++ b/chrome/browser/dom_ui/filebrowse_ui.cc
@@ -126,7 +126,7 @@ class FilebrowseHandler : public net::DirectoryLister::DirectoryListerDelegate,
// DownloadItem::Observer interface
virtual void OnDownloadUpdated(DownloadItem* download);
- virtual void OnDownloadFileCompleted(DownloadItem* download) { }
+ virtual void OnDownloadFileCompleted(DownloadItem* download);
virtual void OnDownloadOpened(DownloadItem* download) { }
// DownloadManager::Observer interface
@@ -196,6 +196,9 @@ class FilebrowseHandler : public net::DirectoryLister::DirectoryListerDelegate,
private:
+ // Retrieves downloads from the DownloadManager and updates the page.
+ void UpdateDownloadList();
+
void OpenNewWindow(const ListValue* args, bool popup);
// Clear all download items and their observers.
@@ -901,10 +904,17 @@ void FilebrowseHandler::HandleGetMetadata(const ListValue* args) {
}
void FilebrowseHandler::HandleGetDownloads(const ListValue* args) {
- ModelChanged();
+ UpdateDownloadList();
}
void FilebrowseHandler::ModelChanged() {
+ if (!currentpath_.empty())
+ GetChildrenForPath(currentpath_, true);
+ else
+ UpdateDownloadList();
+}
+
+void FilebrowseHandler::UpdateDownloadList() {
ClearDownloadItems();
std::vector<DownloadItem*> downloads;
@@ -1113,6 +1123,10 @@ void FilebrowseHandler::SendCurrentDownloads() {
dom_ui_->CallJavascriptFunction(L"downloadsList", results_value);
}
+void FilebrowseHandler::OnDownloadFileCompleted(DownloadItem* download) {
+ GetChildrenForPath(currentpath_, true);
+}
+
////////////////////////////////////////////////////////////////////////////////
//
// FileBrowseUI
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698