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

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

Issue 16007017: [Resumption 10/12] Use DI::IsDone to check for terminal downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with r204343 Created 7 years, 6 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // danger_prompt will delete itself. 503 // danger_prompt will delete itself.
504 DCHECK(danger_prompt); 504 DCHECK(danger_prompt);
505 } 505 }
506 506
507 void DownloadsDOMHandler::DangerPromptAccepted(int download_id) { 507 void DownloadsDOMHandler::DangerPromptAccepted(int download_id) {
508 content::DownloadItem* item = NULL; 508 content::DownloadItem* item = NULL;
509 if (main_notifier_.GetManager()) 509 if (main_notifier_.GetManager())
510 item = main_notifier_.GetManager()->GetDownload(download_id); 510 item = main_notifier_.GetManager()->GetDownload(download_id);
511 if (!item && original_notifier_.get() && original_notifier_->GetManager()) 511 if (!item && original_notifier_.get() && original_notifier_->GetManager())
512 item = original_notifier_->GetManager()->GetDownload(download_id); 512 item = original_notifier_->GetManager()->GetDownload(download_id);
513 if (!item || (item->GetState() != content::DownloadItem::IN_PROGRESS)) 513 if (!item || item->IsDone())
514 return; 514 return;
515 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); 515 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
516 item->ValidateDangerousDownload(); 516 item->ValidateDangerousDownload();
517 } 517 }
518 518
519 bool DownloadsDOMHandler::IsDeletingHistoryAllowed() { 519 bool DownloadsDOMHandler::IsDeletingHistoryAllowed() {
520 content::DownloadManager* manager = main_notifier_.GetManager(); 520 content::DownloadManager* manager = main_notifier_.GetManager();
521 return (manager && 521 return (manager &&
522 Profile::FromBrowserContext(manager->GetBrowserContext())-> 522 Profile::FromBrowserContext(manager->GetBrowserContext())->
523 GetPrefs()->GetBoolean(prefs::kAllowDeletingBrowserHistory)); 523 GetPrefs()->GetBoolean(prefs::kAllowDeletingBrowserHistory));
(...skipping 17 matching lines...) Expand all
541 } 541 }
542 542
543 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { 543 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) {
544 web_ui()->CallJavascriptFunction("downloadsList", downloads); 544 web_ui()->CallJavascriptFunction("downloadsList", downloads);
545 } 545 }
546 546
547 void DownloadsDOMHandler::CallDownloadUpdated( 547 void DownloadsDOMHandler::CallDownloadUpdated(
548 const base::ListValue& download_item) { 548 const base::ListValue& download_item) {
549 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); 549 web_ui()->CallJavascriptFunction("downloadUpdated", download_item);
550 } 550 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_shelf_context_menu.cc ('k') | content/browser/download/download_item_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698