| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/download/download_danger_prompt.h" | 5 #include "chrome/browser/download/download_danger_prompt.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 8 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 9 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 9 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 10 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 10 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: // Fall through | 117 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: // Fall through |
| 118 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: | 118 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: |
| 119 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: | 119 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: |
| 120 return l10n_util::GetStringFUTF16( | 120 return l10n_util::GetStringFUTF16( |
| 121 IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, | 121 IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, |
| 122 download_->GetFileNameToReportUser().LossyDisplayName()); | 122 download_->GetFileNameToReportUser().LossyDisplayName()); |
| 123 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: | 123 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: |
| 124 return l10n_util::GetStringFUTF16( | 124 return l10n_util::GetStringFUTF16( |
| 125 IDS_PROMPT_UNCOMMON_DOWNLOAD_CONTENT, | 125 IDS_PROMPT_UNCOMMON_DOWNLOAD_CONTENT, |
| 126 download_->GetFileNameToReportUser().LossyDisplayName()); | 126 download_->GetFileNameToReportUser().LossyDisplayName()); |
| 127 default: | 127 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: |
| 128 NOTREACHED(); | 128 return l10n_util::GetStringFUTF16( |
| 129 return string16(); | 129 IDS_PROMPT_POTENTIALLY_UNWANTED_DOWNLOAD, |
| 130 download_->GetFileNameToReportUser().LossyDisplayName()); |
| 131 case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: |
| 132 case content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT: |
| 133 case content::DOWNLOAD_DANGER_TYPE_USER_VALIDATED: |
| 134 case content::DOWNLOAD_DANGER_TYPE_MAX: |
| 135 break; |
| 130 } | 136 } |
| 137 NOTREACHED(); |
| 138 return string16(); |
| 131 } | 139 } |
| 132 | 140 |
| 133 string16 DownloadDangerPromptImpl::GetAcceptButtonTitle() { | 141 string16 DownloadDangerPromptImpl::GetAcceptButtonTitle() { |
| 134 return l10n_util::GetStringUTF16( | 142 return l10n_util::GetStringUTF16( |
| 135 show_context_ ? IDS_CONFIRM_DOWNLOAD : IDS_CONFIRM_DOWNLOAD_AGAIN); | 143 show_context_ ? IDS_CONFIRM_DOWNLOAD : IDS_CONFIRM_DOWNLOAD_AGAIN); |
| 136 } | 144 } |
| 137 | 145 |
| 138 void DownloadDangerPromptImpl::OnAccepted() { | 146 void DownloadDangerPromptImpl::OnAccepted() { |
| 139 RunCallback(accepted_); | 147 RunCallback(accepted_); |
| 140 } | 148 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 170 content::WebContents* web_contents, | 178 content::WebContents* web_contents, |
| 171 bool show_context, | 179 bool show_context, |
| 172 const base::Closure& accepted, | 180 const base::Closure& accepted, |
| 173 const base::Closure& canceled) { | 181 const base::Closure& canceled) { |
| 174 DownloadDangerPromptImpl* prompt = new DownloadDangerPromptImpl( | 182 DownloadDangerPromptImpl* prompt = new DownloadDangerPromptImpl( |
| 175 item, show_context, accepted, canceled); | 183 item, show_context, accepted, canceled); |
| 176 // |prompt| will be deleted when the dialog is done. | 184 // |prompt| will be deleted when the dialog is done. |
| 177 TabModalConfirmDialog::Create(prompt, web_contents); | 185 TabModalConfirmDialog::Create(prompt, web_contents); |
| 178 return prompt; | 186 return prompt; |
| 179 } | 187 } |
| OLD | NEW |