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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 // OnDownloadRemoved() will call it, but if no downloads are actually removed, | 467 // OnDownloadRemoved() will call it, but if no downloads are actually removed, |
468 // then HandleClearAll needs to call it manually. | 468 // then HandleClearAll needs to call it manually. |
469 ScheduleSendCurrentDownloads(); | 469 ScheduleSendCurrentDownloads(); |
470 } | 470 } |
471 | 471 |
472 void DownloadsDOMHandler::HandleOpenDownloadsFolder( | 472 void DownloadsDOMHandler::HandleOpenDownloadsFolder( |
473 const base::ListValue* args) { | 473 const base::ListValue* args) { |
474 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); | 474 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); |
475 content::DownloadManager* manager = main_notifier_.GetManager(); | 475 content::DownloadManager* manager = main_notifier_.GetManager(); |
476 if (manager) { | 476 if (manager) { |
477 platform_util::OpenItem( | 477 platform_util::OpenFolder( |
478 Profile::FromBrowserContext(manager->GetBrowserContext()), | 478 Profile::FromBrowserContext(manager->GetBrowserContext()), |
479 DownloadPrefs::FromDownloadManager(manager)->DownloadPath()); | 479 DownloadPrefs::FromDownloadManager(manager)->DownloadPath()); |
480 } | 480 } |
481 } | 481 } |
482 | 482 |
483 // DownloadsDOMHandler, private: ---------------------------------------------- | 483 // DownloadsDOMHandler, private: ---------------------------------------------- |
484 | 484 |
485 void DownloadsDOMHandler::ScheduleSendCurrentDownloads() { | 485 void DownloadsDOMHandler::ScheduleSendCurrentDownloads() { |
486 // Don't call SendCurrentDownloads() every time anything changes. Batch them | 486 // Don't call SendCurrentDownloads() every time anything changes. Batch them |
487 // together instead. This may handle hundreds of OnDownloadDestroyed() calls | 487 // together instead. This may handle hundreds of OnDownloadDestroyed() calls |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 } | 579 } |
580 | 580 |
581 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 581 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
582 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 582 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
583 } | 583 } |
584 | 584 |
585 void DownloadsDOMHandler::CallDownloadUpdated( | 585 void DownloadsDOMHandler::CallDownloadUpdated( |
586 const base::ListValue& download_item) { | 586 const base::ListValue& download_item) { |
587 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 587 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
588 } | 588 } |
OLD | NEW |