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

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

Issue 8468020: Propagate the SafeBrowsing download protection verdict to the DownloadItem. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge Created 9 years, 1 month 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 17 matching lines...) Expand all
28 #include "chrome/browser/download/download_item_model.h" 28 #include "chrome/browser/download/download_item_model.h"
29 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/ui/browser.h" 30 #include "chrome/browser/ui/browser.h"
31 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
32 #include "chrome/common/chrome_paths.h" 32 #include "chrome/common/chrome_paths.h"
33 #include "chrome/common/time_format.h" 33 #include "chrome/common/time_format.h"
34 #include "content/browser/download/download_create_info.h" 34 #include "content/browser/download/download_create_info.h"
35 #include "content/browser/download/download_file.h" 35 #include "content/browser/download/download_file.h"
36 #include "content/browser/download/download_item.h" 36 #include "content/browser/download/download_item.h"
37 #include "content/browser/download/download_manager.h" 37 #include "content/browser/download/download_manager.h"
38 #include "content/browser/download/download_state_info.h"
38 #include "content/browser/download/download_types.h" 39 #include "content/browser/download/download_types.h"
39 #include "content/browser/renderer_host/render_view_host.h" 40 #include "content/browser/renderer_host/render_view_host.h"
40 #include "content/browser/renderer_host/resource_dispatcher_host.h" 41 #include "content/browser/renderer_host/resource_dispatcher_host.h"
41 #include "content/browser/tab_contents/tab_contents.h" 42 #include "content/browser/tab_contents/tab_contents.h"
42 #include "content/public/browser/browser_thread.h" 43 #include "content/public/browser/browser_thread.h"
43 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
44 #include "grit/locale_settings.h" 45 #include "grit/locale_settings.h"
45 #include "grit/theme_resources.h" 46 #include "grit/theme_resources.h"
46 #include "net/base/mime_util.h" 47 #include "net/base/mime_util.h"
47 #include "net/base/net_util.h" 48 #include "net/base/net_util.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 file_value->SetString("file_name", file_name); 421 file_value->SetString("file_name", file_name);
421 file_value->SetString("url", download->GetURL().spec()); 422 file_value->SetString("url", download->GetURL().spec());
422 file_value->SetBoolean("otr", download->is_otr()); 423 file_value->SetBoolean("otr", download->is_otr());
423 file_value->SetInteger("total", static_cast<int>(download->total_bytes())); 424 file_value->SetInteger("total", static_cast<int>(download->total_bytes()));
424 file_value->SetBoolean("file_externally_removed", 425 file_value->SetBoolean("file_externally_removed",
425 download->file_externally_removed()); 426 download->file_externally_removed());
426 427
427 if (download->IsInProgress()) { 428 if (download->IsInProgress()) {
428 if (download->safety_state() == DownloadItem::DANGEROUS) { 429 if (download->safety_state() == DownloadItem::DANGEROUS) {
429 file_value->SetString("state", "DANGEROUS"); 430 file_value->SetString("state", "DANGEROUS");
430 DCHECK(download->GetDangerType() == DownloadItem::DANGEROUS_FILE || 431 DCHECK(download->GetDangerType() == DownloadStateInfo::DANGEROUS_FILE ||
431 download->GetDangerType() == DownloadItem::DANGEROUS_URL); 432 download->GetDangerType() == DownloadStateInfo::DANGEROUS_URL);
432 const char* danger_type_value = 433 const char* danger_type_value =
433 download->GetDangerType() == DownloadItem::DANGEROUS_FILE ? 434 download->GetDangerType() == DownloadStateInfo::DANGEROUS_FILE ?
434 "DANGEROUS_FILE" : "DANGEROUS_URL"; 435 "DANGEROUS_FILE" : "DANGEROUS_URL";
435 file_value->SetString("danger_type", danger_type_value); 436 file_value->SetString("danger_type", danger_type_value);
436 } else if (download->is_paused()) { 437 } else if (download->is_paused()) {
437 file_value->SetString("state", "PAUSED"); 438 file_value->SetString("state", "PAUSED");
438 } else { 439 } else {
439 file_value->SetString("state", "IN_PROGRESS"); 440 file_value->SetString("state", "IN_PROGRESS");
440 } 441 }
441 442
442 file_value->SetString("progress_status_text", 443 file_value->SetString("progress_status_text",
443 GetProgressStatusText(download)); 444 GetProgressStatusText(download));
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 return DownloadFile::GetUniquePathNumberWithSuffix( 566 return DownloadFile::GetUniquePathNumberWithSuffix(
566 path, FILE_PATH_LITERAL(".crdownload")); 567 path, FILE_PATH_LITERAL(".crdownload"));
567 } 568 }
568 569
569 FilePath GetCrDownloadPath(const FilePath& suggested_path) { 570 FilePath GetCrDownloadPath(const FilePath& suggested_path) {
570 return DownloadFile::AppendSuffixToPath( 571 return DownloadFile::AppendSuffixToPath(
571 suggested_path, FILE_PATH_LITERAL(".crdownload")); 572 suggested_path, FILE_PATH_LITERAL(".crdownload"));
572 } 573 }
573 574
574 } // namespace download_util 575 } // namespace download_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698