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

Side by Side Diff: chrome/browser/download/download_util.cc

Issue 6905049: Detect removed files and reflect the state in chrome://downloads and the download shelf (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Correct typo Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Download utility implementation 5 // Download utility implementation
6 6
7 #include "chrome/browser/download/download_util.h" 7 #include "chrome/browser/download/download_util.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <shobjidl.h> 10 #include <shobjidl.h>
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 file_value->SetString("progress_status_text", 655 file_value->SetString("progress_status_text",
656 GetProgressStatusText(download)); 656 GetProgressStatusText(download));
657 657
658 file_value->SetInteger("percent", 658 file_value->SetInteger("percent",
659 static_cast<int>(download->PercentComplete())); 659 static_cast<int>(download->PercentComplete()));
660 file_value->SetInteger("received", 660 file_value->SetInteger("received",
661 static_cast<int>(download->received_bytes())); 661 static_cast<int>(download->received_bytes()));
662 } else if (download->IsCancelled()) { 662 } else if (download->IsCancelled()) {
663 file_value->SetString("state", "CANCELLED"); 663 file_value->SetString("state", "CANCELLED");
664 } else if (download->IsComplete()) { 664 } else if (download->IsComplete()) {
665 if (download->safety_state() == DownloadItem::DANGEROUS) { 665 if (!download->file_exists()) {
666 file_value->SetString("state", "REMOVED");
667 } else if (download->safety_state() == DownloadItem::DANGEROUS) {
666 file_value->SetString("state", "DANGEROUS"); 668 file_value->SetString("state", "DANGEROUS");
667 } else { 669 } else {
668 file_value->SetString("state", "COMPLETE"); 670 file_value->SetString("state", "COMPLETE");
669 } 671 }
670 } 672 }
671 673
672 file_value->SetInteger("total", 674 file_value->SetInteger("total",
673 static_cast<int>(download->total_bytes())); 675 static_cast<int>(download->total_bytes()));
674 676
675 return file_value; 677 return file_value;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 // Extensions that are not from the gallery are considered dangerous. 896 // Extensions that are not from the gallery are considered dangerous.
895 ExtensionService* service = profile->GetExtensionService(); 897 ExtensionService* service = profile->GetExtensionService();
896 if (!service || 898 if (!service ||
897 !service->IsDownloadFromGallery(info->url(), info->referrer_url)) 899 !service->IsDownloadFromGallery(info->url(), info->referrer_url))
898 return true; 900 return true;
899 } 901 }
900 return false; 902 return false;
901 } 903 }
902 904
903 } // namespace download_util 905 } // namespace download_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698