diff options
author | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 21:21:12 +0000 |
---|---|---|
committer | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 21:21:12 +0000 |
commit | d41355e6f0576dc372a6047ffc8e6f0fdea0129d (patch) | |
tree | 559d0200951e69c1b904edeafd45f5edb53844c5 /chrome/browser/dom_ui | |
parent | b4abd1f1c5973ba9877f6617549d72c1fde74595 (diff) | |
download | chromium_src-d41355e6f0576dc372a6047ffc8e6f0fdea0129d.zip chromium_src-d41355e6f0576dc372a6047ffc8e6f0fdea0129d.tar.gz chromium_src-d41355e6f0576dc372a6047ffc8e6f0fdea0129d.tar.bz2 |
Cloned from 62030
Add a "Clear All" link to the downloads page.
Fixes jankiness of the blue bar in the download page as it loads.
Improve rendering time of the downloads page by chunking the number of
download items to do before scheduling the timeout.
BUG=9033
Review URL: http://codereview.chromium.org/62115
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13285 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r-- | chrome/browser/dom_ui/downloads_ui.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc index 3e52879..ddd3ee2 100644 --- a/chrome/browser/dom_ui/downloads_ui.cc +++ b/chrome/browser/dom_ui/downloads_ui.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -64,11 +64,13 @@ void DownloadsUIHTMLSource::StartDataRequest(const std::string& path, localized_strings.SetString(L"searchbutton", l10n_util::GetString(IDS_DOWNLOAD_SEARCH_BUTTON)); localized_strings.SetString(L"no_results", - l10n_util::GetString(IDS_DOWNLOAD_SEARCH_BUTTON)); + l10n_util::GetString(IDS_DOWNLOAD_SEARCH_BUTTON)); localized_strings.SetString(L"searchresultsfor", - l10n_util::GetString(IDS_DOWNLOAD_SEARCHRESULTSFOR)); + l10n_util::GetString(IDS_DOWNLOAD_SEARCHRESULTSFOR)); localized_strings.SetString(L"downloads", - l10n_util::GetString(IDS_DOWNLOAD_TITLE)); + l10n_util::GetString(IDS_DOWNLOAD_TITLE)); + localized_strings.SetString(L"clear_all", + l10n_util::GetString(IDS_DOWNLOAD_LINK_CLEAR_ALL)); // Status. localized_strings.SetString(L"status_cancelled", @@ -160,6 +162,9 @@ class DownloadsDOMHandler : public DOMMessageHandler, // Callback for the "cancel" message - cancels the download. void HandleCancel(const Value* value); + // Callback for the "clearAll" message - clears all the downloads. + void HandleClearAll(const Value* value); + private: // Send the current list of downloads to the page. void SendCurrentDownloads(); @@ -229,6 +234,9 @@ DownloadsDOMHandler::DownloadsDOMHandler(DOMUI* dom_ui, DownloadManager* dlm) NewCallback(this, &DownloadsDOMHandler::HandlePause)); dom_ui_->RegisterMessageCallback("cancel", NewCallback(this, &DownloadsDOMHandler::HandleCancel)); + dom_ui_->RegisterMessageCallback("clearAll", + NewCallback(this, &DownloadsDOMHandler::HandleClearAll)); + // Create our fileicon data source. g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, @@ -357,6 +365,10 @@ void DownloadsDOMHandler::HandleCancel(const Value* value) { file->Cancel(true); } +void DownloadsDOMHandler::HandleClearAll(const Value* value) { + download_manager_->RemoveAllDownloads(); +} + // DownloadsDOMHandler, private: ---------------------------------------------- void DownloadsDOMHandler::SendCurrentDownloads() { |