OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |