| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } | 509 } |
| 510 | 510 |
| 511 void DownloadsDOMHandler::ShowDangerPrompt( | 511 void DownloadsDOMHandler::ShowDangerPrompt( |
| 512 content::DownloadItem* dangerous_item) { | 512 content::DownloadItem* dangerous_item) { |
| 513 DownloadDangerPrompt* danger_prompt = DownloadDangerPrompt::Create( | 513 DownloadDangerPrompt* danger_prompt = DownloadDangerPrompt::Create( |
| 514 dangerous_item, | 514 dangerous_item, |
| 515 GetWebUIWebContents(), | 515 GetWebUIWebContents(), |
| 516 false, | 516 false, |
| 517 base::Bind(&DownloadsDOMHandler::DangerPromptAccepted, | 517 base::Bind(&DownloadsDOMHandler::DangerPromptAccepted, |
| 518 weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId()), | 518 weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId()), |
| 519 base::Closure(), |
| 519 base::Closure()); | 520 base::Closure()); |
| 520 // danger_prompt will delete itself. | 521 // danger_prompt will delete itself. |
| 521 DCHECK(danger_prompt); | 522 DCHECK(danger_prompt); |
| 522 } | 523 } |
| 523 | 524 |
| 524 void DownloadsDOMHandler::DangerPromptAccepted(int download_id) { | 525 void DownloadsDOMHandler::DangerPromptAccepted(int download_id) { |
| 525 content::DownloadItem* item = NULL; | 526 content::DownloadItem* item = NULL; |
| 526 if (main_notifier_.GetManager()) | 527 if (main_notifier_.GetManager()) |
| 527 item = main_notifier_.GetManager()->GetDownload(download_id); | 528 item = main_notifier_.GetManager()->GetDownload(download_id); |
| 528 if (!item && original_notifier_.get() && original_notifier_->GetManager()) | 529 if (!item && original_notifier_.get() && original_notifier_->GetManager()) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 558 } | 559 } |
| 559 | 560 |
| 560 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 561 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
| 561 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 562 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
| 562 } | 563 } |
| 563 | 564 |
| 564 void DownloadsDOMHandler::CallDownloadUpdated( | 565 void DownloadsDOMHandler::CallDownloadUpdated( |
| 565 const base::ListValue& download_item) { | 566 const base::ListValue& download_item) { |
| 566 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 567 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
| 567 } | 568 } |
| OLD | NEW |