Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Side by Side Diff: chrome/browser/ui/webui/downloads_dom_handler.cc

Issue 16924017: A few minor changes to the chrome.downloads extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r212092 Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
507 } 507 }
508 CallDownloadsList(results_value); 508 CallDownloadsList(results_value);
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::DangerPromptDone,
518 weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId()), 518 weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId()));
519 base::Closure());
520 // danger_prompt will delete itself. 519 // danger_prompt will delete itself.
521 DCHECK(danger_prompt); 520 DCHECK(danger_prompt);
522 } 521 }
523 522
524 void DownloadsDOMHandler::DangerPromptAccepted(int download_id) { 523 void DownloadsDOMHandler::DangerPromptDone(
524 int download_id, DownloadDangerPrompt::Action action) {
525 if (action != DownloadDangerPrompt::ACCEPT)
526 return;
525 content::DownloadItem* item = NULL; 527 content::DownloadItem* item = NULL;
526 if (main_notifier_.GetManager()) 528 if (main_notifier_.GetManager())
527 item = main_notifier_.GetManager()->GetDownload(download_id); 529 item = main_notifier_.GetManager()->GetDownload(download_id);
528 if (!item && original_notifier_.get() && original_notifier_->GetManager()) 530 if (!item && original_notifier_.get() && original_notifier_->GetManager())
529 item = original_notifier_->GetManager()->GetDownload(download_id); 531 item = original_notifier_->GetManager()->GetDownload(download_id);
530 if (!item || item->IsDone()) 532 if (!item || item->IsDone())
531 return; 533 return;
532 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); 534 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
533 item->ValidateDangerousDownload(); 535 item->ValidateDangerousDownload();
534 } 536 }
(...skipping 23 matching lines...) Expand all
558 } 560 }
559 561
560 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { 562 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) {
561 web_ui()->CallJavascriptFunction("downloadsList", downloads); 563 web_ui()->CallJavascriptFunction("downloadsList", downloads);
562 } 564 }
563 565
564 void DownloadsDOMHandler::CallDownloadUpdated( 566 void DownloadsDOMHandler::CallDownloadUpdated(
565 const base::ListValue& download_item) { 567 const base::ListValue& download_item) {
566 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); 568 web_ui()->CallJavascriptFunction("downloadUpdated", download_item);
567 } 569 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698