| 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 removals_.push_back(ids); | 515 removals_.push_back(ids); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void DownloadsDOMHandler::HandleOpenDownloadsFolder( | 518 void DownloadsDOMHandler::HandleOpenDownloadsFolder( |
| 519 const base::ListValue* args) { | 519 const base::ListValue* args) { |
| 520 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); | 520 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); |
| 521 content::DownloadManager* manager = main_notifier_.GetManager(); | 521 content::DownloadManager* manager = main_notifier_.GetManager(); |
| 522 if (manager) { | 522 if (manager) { |
| 523 platform_util::OpenItem( | 523 platform_util::OpenItem( |
| 524 Profile::FromBrowserContext(manager->GetBrowserContext()), | 524 Profile::FromBrowserContext(manager->GetBrowserContext()), |
| 525 DownloadPrefs::FromDownloadManager(manager)->DownloadPath()); | 525 DownloadPrefs::FromDownloadManager(manager)->DownloadPath(), |
| 526 platform_util::OPEN_FOLDER, platform_util::OpenOperationCallback()); |
| 526 } | 527 } |
| 527 } | 528 } |
| 528 | 529 |
| 529 // DownloadsDOMHandler, private: ---------------------------------------------- | 530 // DownloadsDOMHandler, private: ---------------------------------------------- |
| 530 | 531 |
| 531 void DownloadsDOMHandler::ScheduleSendCurrentDownloads() { | 532 void DownloadsDOMHandler::ScheduleSendCurrentDownloads() { |
| 532 // Don't call SendCurrentDownloads() every time anything changes. Batch them | 533 // Don't call SendCurrentDownloads() every time anything changes. Batch them |
| 533 // together instead. This may handle hundreds of OnDownloadDestroyed() calls | 534 // together instead. This may handle hundreds of OnDownloadDestroyed() calls |
| 534 // in a single UI message loop iteration when the user Clears All downloads. | 535 // in a single UI message loop iteration when the user Clears All downloads. |
| 535 if (update_scheduled_) | 536 if (update_scheduled_) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 } | 656 } |
| 656 | 657 |
| 657 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 658 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
| 658 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 659 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
| 659 } | 660 } |
| 660 | 661 |
| 661 void DownloadsDOMHandler::CallDownloadUpdated( | 662 void DownloadsDOMHandler::CallDownloadUpdated( |
| 662 const base::ListValue& download_item) { | 663 const base::ListValue& download_item) { |
| 663 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 664 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
| 664 } | 665 } |
| OLD | NEW |