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

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: @r213855 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 511 }
512 CallDownloadsList(results_value); 512 CallDownloadsList(results_value);
513 } 513 }
514 514
515 void DownloadsDOMHandler::ShowDangerPrompt( 515 void DownloadsDOMHandler::ShowDangerPrompt(
516 content::DownloadItem* dangerous_item) { 516 content::DownloadItem* dangerous_item) {
517 DownloadDangerPrompt* danger_prompt = DownloadDangerPrompt::Create( 517 DownloadDangerPrompt* danger_prompt = DownloadDangerPrompt::Create(
518 dangerous_item, 518 dangerous_item,
519 GetWebUIWebContents(), 519 GetWebUIWebContents(),
520 false, 520 false,
521 base::Bind(&DownloadsDOMHandler::DangerPromptAccepted, 521 base::Bind(&DownloadsDOMHandler::DangerPromptDone,
522 weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId()), 522 weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId()));
523 base::Closure());
524 // danger_prompt will delete itself. 523 // danger_prompt will delete itself.
525 DCHECK(danger_prompt); 524 DCHECK(danger_prompt);
526 } 525 }
527 526
528 void DownloadsDOMHandler::DangerPromptAccepted(int download_id) { 527 void DownloadsDOMHandler::DangerPromptDone(
528 int download_id, DownloadDangerPrompt::Action action) {
529 if (action != DownloadDangerPrompt::ACCEPT)
530 return;
529 content::DownloadItem* item = NULL; 531 content::DownloadItem* item = NULL;
530 if (main_notifier_.GetManager()) 532 if (main_notifier_.GetManager())
531 item = main_notifier_.GetManager()->GetDownload(download_id); 533 item = main_notifier_.GetManager()->GetDownload(download_id);
532 if (!item && original_notifier_.get() && original_notifier_->GetManager()) 534 if (!item && original_notifier_.get() && original_notifier_->GetManager())
533 item = original_notifier_->GetManager()->GetDownload(download_id); 535 item = original_notifier_->GetManager()->GetDownload(download_id);
534 if (!item || item->IsDone()) 536 if (!item || item->IsDone())
535 return; 537 return;
536 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); 538 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
537 item->ValidateDangerousDownload(); 539 item->ValidateDangerousDownload();
538 } 540 }
(...skipping 23 matching lines...) Expand all
562 } 564 }
563 565
564 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { 566 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) {
565 web_ui()->CallJavascriptFunction("downloadsList", downloads); 567 web_ui()->CallJavascriptFunction("downloadsList", downloads);
566 } 568 }
567 569
568 void DownloadsDOMHandler::CallDownloadUpdated( 570 void DownloadsDOMHandler::CallDownloadUpdated(
569 const base::ListValue& download_item) { 571 const base::ListValue& download_item) {
570 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); 572 web_ui()->CallJavascriptFunction("downloadUpdated", download_item);
571 } 573 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698