| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/downloads_dom_handler.h" | 5 #include "chrome/browser/ui/webui/downloads_dom_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 removes_.push_back(ids); | 555 removes_.push_back(ids); |
| 556 } | 556 } |
| 557 | 557 |
| 558 void DownloadsDOMHandler::HandleOpenDownloadsFolder( | 558 void DownloadsDOMHandler::HandleOpenDownloadsFolder( |
| 559 const base::ListValue* args) { | 559 const base::ListValue* args) { |
| 560 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); | 560 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); |
| 561 content::DownloadManager* manager = main_notifier_.GetManager(); | 561 content::DownloadManager* manager = main_notifier_.GetManager(); |
| 562 if (manager) { | 562 if (manager) { |
| 563 platform_util::OpenItem( | 563 platform_util::OpenItem( |
| 564 Profile::FromBrowserContext(manager->GetBrowserContext()), | 564 Profile::FromBrowserContext(manager->GetBrowserContext()), |
| 565 DownloadPrefs::FromDownloadManager(manager)->DownloadPath()); | 565 DownloadPrefs::FromDownloadManager(manager)->DownloadPath(), |
| 566 platform_util::OPEN_FOLDER, platform_util::OpenOperationCallback()); |
| 566 } | 567 } |
| 567 } | 568 } |
| 568 | 569 |
| 569 // DownloadsDOMHandler, private: ---------------------------------------------- | 570 // DownloadsDOMHandler, private: ---------------------------------------------- |
| 570 | 571 |
| 571 void DownloadsDOMHandler::ScheduleSendCurrentDownloads() { | 572 void DownloadsDOMHandler::ScheduleSendCurrentDownloads() { |
| 572 // Don't call SendCurrentDownloads() every time anything changes. Batch them | 573 // Don't call SendCurrentDownloads() every time anything changes. Batch them |
| 573 // together instead. This may handle hundreds of OnDownloadDestroyed() calls | 574 // together instead. This may handle hundreds of OnDownloadDestroyed() calls |
| 574 // in a single UI message loop iteration when the user Clears All downloads. | 575 // in a single UI message loop iteration when the user Clears All downloads. |
| 575 if (update_scheduled_) | 576 if (update_scheduled_) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 } | 683 } |
| 683 | 684 |
| 684 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 685 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
| 685 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 686 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
| 686 } | 687 } |
| 687 | 688 |
| 688 void DownloadsDOMHandler::CallDownloadUpdated( | 689 void DownloadsDOMHandler::CallDownloadUpdated( |
| 689 const base::ListValue& download_item) { | 690 const base::ListValue& download_item) { |
| 690 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 691 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
| 691 } | 692 } |
| OLD | NEW |