Chromium Code Reviews| 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() { |