| 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 && original_profile_download_manager_) |
| 518 download_item = original_profile_download_manager_->GetDownload(id); | 518 download_item = original_profile_download_manager_->GetDownload(id); |
| 519 return download_item; | 519 return download_item; |
| 520 } | 520 } |
| 521 | 521 |
| 522 content::WebContents* DownloadsDOMHandler::GetWebUIWebContents() { | 522 content::WebContents* DownloadsDOMHandler::GetWebUIWebContents() { |
| 523 return web_ui()->GetWebContents(); | 523 return web_ui()->GetWebContents(); |
| 524 } | 524 } |
| 525 | 525 |
| 526 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 526 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
| 527 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 527 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
| 528 } | 528 } |
| 529 | 529 |
| 530 void DownloadsDOMHandler::CallDownloadUpdated( | 530 void DownloadsDOMHandler::CallDownloadUpdated( |
| 531 const base::ListValue& download_item) { | 531 const base::ListValue& download_item) { |
| 532 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 532 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
| 533 } | 533 } |
| OLD | NEW |