| 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 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" | 5 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 169 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 170 NSString* dangerousWarning; | 170 NSString* dangerousWarning; |
| 171 NSString* confirmButtonTitle; | 171 NSString* confirmButtonTitle; |
| 172 NSImage* alertIcon; | 172 NSImage* alertIcon; |
| 173 | 173 |
| 174 // The dangerous download label, button text and icon are different under | 174 // The dangerous download label, button text and icon are different under |
| 175 // different cases. | 175 // different cases. |
| 176 if (downloadModel->download()->GetDangerType() == | 176 if (downloadModel->download()->GetDangerType() == |
| 177 DownloadStateInfo::DANGEROUS_URL) { | 177 DownloadStateInfo::DANGEROUS_URL) { |
| 178 // TODO(noelutz): add support for malicious content. |
| 178 // Safebrowsing shows the download URL leads to malicious file. | 179 // Safebrowsing shows the download URL leads to malicious file. |
| 179 alertIcon = rb.GetNativeImageNamed(IDR_SAFEBROWSING_WARNING); | 180 alertIcon = rb.GetNativeImageNamed(IDR_SAFEBROWSING_WARNING); |
| 180 dangerousWarning = l10n_util::GetNSStringWithFixup( | 181 dangerousWarning = l10n_util::GetNSStringWithFixup( |
| 181 IDS_PROMPT_UNSAFE_DOWNLOAD_URL); | 182 IDS_PROMPT_MALICIOUS_DOWNLOAD_URL); |
| 182 confirmButtonTitle = l10n_util::GetNSStringWithFixup( | 183 confirmButtonTitle = l10n_util::GetNSStringWithFixup( |
| 183 IDS_CONFIRM_DOWNLOAD); | 184 IDS_CONFIRM_DOWNLOAD); |
| 184 } else { | 185 } else { |
| 185 // It's a dangerous file type (e.g.: an executable). | 186 // It's a dangerous file type (e.g.: an executable). |
| 186 DCHECK_EQ(downloadModel->download()->GetDangerType(), | 187 DCHECK_EQ(downloadModel->download()->GetDangerType(), |
| 187 DownloadStateInfo::DANGEROUS_FILE); | 188 DownloadStateInfo::DANGEROUS_FILE); |
| 188 alertIcon = rb.GetNativeImageNamed(IDR_WARNING); | 189 alertIcon = rb.GetNativeImageNamed(IDR_WARNING); |
| 189 if (ChromeDownloadManagerDelegate::IsExtensionDownload( | 190 if (ChromeDownloadManagerDelegate::IsExtensionDownload( |
| 190 downloadModel->download())) { | 191 downloadModel->download())) { |
| 191 dangerousWarning = l10n_util::GetNSStringWithFixup( | 192 dangerousWarning = l10n_util::GetNSStringWithFixup( |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 [sender setTitle:l10n_util::GetNSStringWithFixup( | 414 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 414 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; | 415 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; |
| 415 } else { | 416 } else { |
| 416 [sender setTitle:l10n_util::GetNSStringWithFixup( | 417 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 417 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; | 418 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; |
| 418 } | 419 } |
| 419 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); | 420 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); |
| 420 } | 421 } |
| 421 | 422 |
| 422 @end | 423 @end |
| OLD | NEW |