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

Side by Side Diff: chrome/browser/ui/gtk/download/download_item_gtk.cc

Issue 8624008: Make malicious content download warning include the download filename (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Address Asanka's comment. 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 #include "chrome/browser/ui/gtk/download/download_item_gtk.h" 5 #include "chrome/browser/ui/gtk/download/download_item_gtk.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 void DownloadItemGtk::UpdateDangerWarning() { 554 void DownloadItemGtk::UpdateDangerWarning() {
555 if (dangerous_prompt_) { 555 if (dangerous_prompt_) {
556 UpdateDangerIcon(); 556 UpdateDangerIcon();
557 557
558 // We create |dangerous_warning| as a wide string so we can more easily 558 // We create |dangerous_warning| as a wide string so we can more easily
559 // calculate its length in characters. 559 // calculate its length in characters.
560 string16 dangerous_warning; 560 string16 dangerous_warning;
561 561
562 // The dangerous download label text is different for different cases. 562 // The dangerous download label text is different for different cases.
563 if (get_download()->GetDangerType() == DownloadStateInfo::DANGEROUS_URL) { 563 if (get_download()->GetDangerType() == DownloadStateInfo::DANGEROUS_URL) {
564 // TODO(noelutz): handle malicious content warning.
564 // Safebrowsing shows the download URL leads to malicious file. 565 // Safebrowsing shows the download URL leads to malicious file.
565 dangerous_warning = 566 dangerous_warning =
566 l10n_util::GetStringUTF16(IDS_PROMPT_UNSAFE_DOWNLOAD_URL); 567 l10n_util::GetStringUTF16(IDS_PROMPT_MALICIOUS_DOWNLOAD_URL);
567 } else { 568 } else {
568 // It's a dangerous file type (e.g.: an executable). 569 // It's a dangerous file type (e.g.: an executable).
569 DCHECK(get_download()->GetDangerType() == 570 DCHECK(get_download()->GetDangerType() ==
570 DownloadStateInfo::DANGEROUS_FILE); 571 DownloadStateInfo::DANGEROUS_FILE);
571 if (ChromeDownloadManagerDelegate::IsExtensionDownload(get_download())) { 572 if (ChromeDownloadManagerDelegate::IsExtensionDownload(get_download())) {
572 dangerous_warning = 573 dangerous_warning =
573 l10n_util::GetStringUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION); 574 l10n_util::GetStringUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION);
574 } else { 575 } else {
575 string16 elided_filename = ui::ElideFilename( 576 string16 elided_filename = ui::ElideFilename(
576 get_download()->GetTargetName(), gfx::Font(), kTextWidth); 577 get_download()->GetTargetName(), gfx::Font(), kTextWidth);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 get_download()->DangerousDownloadValidated(); 885 get_download()->DangerousDownloadValidated();
885 } 886 }
886 887
887 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { 888 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) {
888 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", 889 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download",
889 base::Time::Now() - creation_time_); 890 base::Time::Now() - creation_time_);
890 if (get_download()->IsPartialDownload()) 891 if (get_download()->IsPartialDownload())
891 get_download()->Cancel(true); 892 get_download()->Cancel(true);
892 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); 893 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD);
893 } 894 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_item_controller.mm ('k') | chrome/browser/ui/views/download/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698