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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (downloadModel->download()->safety_state() == DownloadItem::DANGEROUS) { | 164 if (downloadModel->download()->safety_state() == DownloadItem::DANGEROUS) { |
165 [self setState:kDangerous]; | 165 [self setState:kDangerous]; |
166 | 166 |
167 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 167 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
168 NSString* dangerousWarning; | 168 NSString* dangerousWarning; |
169 NSString* confirmButtonTitle; | 169 NSString* confirmButtonTitle; |
170 NSImage* alertIcon; | 170 NSImage* alertIcon; |
171 | 171 |
172 // The dangerous download label, button text and icon are different under | 172 // The dangerous download label, button text and icon are different under |
173 // different cases. | 173 // different cases. |
174 if (downloadModel->download()->danger_type() == | 174 if (downloadModel->download()->GetDangerType() == |
175 DownloadItem::DANGEROUS_URL) { | 175 DownloadItem::DANGEROUS_URL) { |
176 // Safebrowsing shows the download URL leads to malicious file. | 176 // Safebrowsing shows the download URL leads to malicious file. |
177 alertIcon = rb.GetNativeImageNamed(IDR_SAFEBROWSING_WARNING); | 177 alertIcon = rb.GetNativeImageNamed(IDR_SAFEBROWSING_WARNING); |
178 dangerousWarning = l10n_util::GetNSStringWithFixup( | 178 dangerousWarning = l10n_util::GetNSStringWithFixup( |
179 IDS_PROMPT_UNSAFE_DOWNLOAD_URL); | 179 IDS_PROMPT_UNSAFE_DOWNLOAD_URL); |
180 confirmButtonTitle = l10n_util::GetNSStringWithFixup(IDS_SAVE_DOWNLOAD); | 180 confirmButtonTitle = l10n_util::GetNSStringWithFixup(IDS_SAVE_DOWNLOAD); |
181 } else { | 181 } else { |
182 // It's a dangerous file type (e.g.: an executable). | 182 // It's a dangerous file type (e.g.: an executable). |
183 DCHECK_EQ(downloadModel->download()->danger_type(), | 183 DCHECK_EQ(downloadModel->download()->GetDangerType(), |
184 DownloadItem::DANGEROUS_FILE); | 184 DownloadItem::DANGEROUS_FILE); |
185 alertIcon = rb.GetNativeImageNamed(IDR_WARNING); | 185 alertIcon = rb.GetNativeImageNamed(IDR_WARNING); |
186 if (downloadModel->download()->is_extension_install()) { | 186 if (downloadModel->download()->is_extension_install()) { |
187 dangerousWarning = l10n_util::GetNSStringWithFixup( | 187 dangerousWarning = l10n_util::GetNSStringWithFixup( |
188 IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION); | 188 IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION); |
189 confirmButtonTitle = l10n_util::GetNSStringWithFixup( | 189 confirmButtonTitle = l10n_util::GetNSStringWithFixup( |
190 IDS_CONTINUE_EXTENSION_DOWNLOAD); | 190 IDS_CONTINUE_EXTENSION_DOWNLOAD); |
191 } else { | 191 } else { |
192 // This basic fixup copies Windows DownloadItemView::DownloadItemView(). | 192 // This basic fixup copies Windows DownloadItemView::DownloadItemView(). |
193 | 193 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 [sender setTitle:l10n_util::GetNSStringWithFixup( | 409 [sender setTitle:l10n_util::GetNSStringWithFixup( |
410 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; | 410 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; |
411 } else { | 411 } else { |
412 [sender setTitle:l10n_util::GetNSStringWithFixup( | 412 [sender setTitle:l10n_util::GetNSStringWithFixup( |
413 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; | 413 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; |
414 } | 414 } |
415 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); | 415 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); |
416 } | 416 } |
417 | 417 |
418 @end | 418 @end |
OLD | NEW |