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

Unified Diff: chrome/browser/ui/webui/downloads_dom_handler.cc

Issue 7398026: Added a link to the downloads tab that opens the downloads folder. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 5 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
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 f5e7929ce49d63f00a34573c4dad7fb57e61c438..742a051d5ed50b0ca724f4093661aaba902faa69 100644
--- a/chrome/browser/ui/webui/downloads_dom_handler.cc
+++ b/chrome/browser/ui/webui/downloads_dom_handler.cc
@@ -18,11 +18,14 @@
#include "chrome/browser/download/download_history.h"
#include "chrome/browser/download/download_item.h"
#include "chrome/browser/download/download_util.h"
+#include "chrome/browser/platform_util.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/fileicon_source.h"
#include "chrome/browser/ui/webui/fileicon_source_cros.h"
#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/browser/browser_thread.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -97,6 +100,8 @@ void DownloadsDOMHandler::RegisterMessages() {
NewCallback(this, &DownloadsDOMHandler::HandleCancel));
web_ui_->RegisterMessageCallback("clearAll",
NewCallback(this, &DownloadsDOMHandler::HandleClearAll));
+ web_ui_->RegisterMessageCallback("openDownloadsFolder",
+ NewCallback(this, &DownloadsDOMHandler::HandleOpenDownloadsFolder));
}
void DownloadsDOMHandler::OnDownloadUpdated(DownloadItem* download) {
@@ -227,6 +232,12 @@ void DownloadsDOMHandler::HandleClearAll(const ListValue* args) {
download_manager_->RemoveAllDownloads();
}
+void DownloadsDOMHandler::HandleOpenDownloadsFolder(const ListValue* args) {
+ PrefService* pref_service = web_ui_->GetProfile()->GetPrefs();
benjhayden 2011/07/18 19:07:54 Would you mind using download_manager_->download_p
+ platform_util::OpenItem(
asanka 2011/07/18 17:18:48 This runs in the UI thread. While OpenItem() is s
+ pref_service->GetFilePath(prefs::kDownloadDefaultDirectory));
+}
+
// DownloadsDOMHandler, private: ----------------------------------------------
void DownloadsDOMHandler::SendCurrentDownloads() {

Powered by Google App Engine
This is Rietveld 408576698