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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); | 507 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); |
508 item->DangerousDownloadValidated(); | 508 item->DangerousDownloadValidated(); |
509 } | 509 } |
510 | 510 |
511 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( | 511 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( |
512 const base::ListValue* args) { | 512 const base::ListValue* args) { |
513 int id = -1; | 513 int id = -1; |
514 if (!ExtractIntegerValue(args, &id)) | 514 if (!ExtractIntegerValue(args, &id)) |
515 return NULL; | 515 return NULL; |
516 content::DownloadItem* download_item = download_manager_->GetDownload(id); | 516 content::DownloadItem* download_item = download_manager_->GetDownload(id); |
517 if (download_item == NULL) | 517 if ((download_item == NULL) && |
518 (original_profile_download_manager_ != NULL)) | |
James Hawkins
2012/08/27 13:33:06
Optional nit: This is much shorter (and easier to
benjhayden
2012/08/27 14:50:39
Done.
| |
518 download_item = original_profile_download_manager_->GetDownload(id); | 519 download_item = original_profile_download_manager_->GetDownload(id); |
519 return download_item; | 520 return download_item; |
520 } | 521 } |
521 | 522 |
522 content::WebContents* DownloadsDOMHandler::GetWebUIWebContents() { | 523 content::WebContents* DownloadsDOMHandler::GetWebUIWebContents() { |
523 return web_ui()->GetWebContents(); | 524 return web_ui()->GetWebContents(); |
524 } | 525 } |
525 | 526 |
526 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 527 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
527 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 528 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
528 } | 529 } |
529 | 530 |
530 void DownloadsDOMHandler::CallDownloadUpdated( | 531 void DownloadsDOMHandler::CallDownloadUpdated( |
531 const base::ListValue& download_item) { | 532 const base::ListValue& download_item) { |
532 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 533 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
533 } | 534 } |
OLD | NEW |