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 "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 10 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 virtual ~DownloadDangerPromptImpl(); | 35 virtual ~DownloadDangerPromptImpl(); |
36 | 36 |
37 // DownloadDangerPrompt: | 37 // DownloadDangerPrompt: |
38 virtual void InvokeActionForTesting(Action action) OVERRIDE; | 38 virtual void InvokeActionForTesting(Action action) OVERRIDE; |
39 | 39 |
40 private: | 40 private: |
41 // content::DownloadItem::Observer: | 41 // content::DownloadItem::Observer: |
42 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; | 42 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; |
43 | 43 |
44 // TabModalConfirmDialogDelegate: | 44 // TabModalConfirmDialogDelegate: |
45 virtual string16 GetTitle() OVERRIDE; | 45 virtual base::string16 GetTitle() OVERRIDE; |
46 virtual string16 GetMessage() OVERRIDE; | 46 virtual base::string16 GetMessage() OVERRIDE; |
47 virtual string16 GetAcceptButtonTitle() OVERRIDE; | 47 virtual base::string16 GetAcceptButtonTitle() OVERRIDE; |
48 virtual string16 GetCancelButtonTitle() OVERRIDE; | 48 virtual base::string16 GetCancelButtonTitle() OVERRIDE; |
49 virtual void OnAccepted() OVERRIDE; | 49 virtual void OnAccepted() OVERRIDE; |
50 virtual void OnCanceled() OVERRIDE; | 50 virtual void OnCanceled() OVERRIDE; |
51 virtual void OnClosed() OVERRIDE; | 51 virtual void OnClosed() OVERRIDE; |
52 | 52 |
53 void RunDone(Action action); | 53 void RunDone(Action action); |
54 | 54 |
55 content::DownloadItem* download_; | 55 content::DownloadItem* download_; |
56 bool show_context_; | 56 bool show_context_; |
57 OnDone done_; | 57 OnDone done_; |
58 | 58 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 l10n_util::GetStringUTF16( | 162 l10n_util::GetStringUTF16( |
163 IDS_PROMPT_CONFIRM_KEEP_MALICIOUS_DOWNLOAD_BODY); | 163 IDS_PROMPT_CONFIRM_KEEP_MALICIOUS_DOWNLOAD_BODY); |
164 } | 164 } |
165 default: { | 165 default: { |
166 return l10n_util::GetStringUTF16( | 166 return l10n_util::GetStringUTF16( |
167 IDS_PROMPT_CONFIRM_KEEP_DANGEROUS_DOWNLOAD); | 167 IDS_PROMPT_CONFIRM_KEEP_DANGEROUS_DOWNLOAD); |
168 } | 168 } |
169 } | 169 } |
170 } | 170 } |
171 NOTREACHED(); | 171 NOTREACHED(); |
172 return string16(); | 172 return base::string16(); |
173 } | 173 } |
174 | 174 |
175 string16 DownloadDangerPromptImpl::GetAcceptButtonTitle() { | 175 string16 DownloadDangerPromptImpl::GetAcceptButtonTitle() { |
176 if (show_context_) | 176 if (show_context_) |
177 return l10n_util::GetStringUTF16(IDS_CONFIRM_DOWNLOAD); | 177 return l10n_util::GetStringUTF16(IDS_CONFIRM_DOWNLOAD); |
178 switch (download_->GetDangerType()) { | 178 switch (download_->GetDangerType()) { |
179 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: | 179 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: |
180 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: | 180 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: |
181 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: | 181 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: |
182 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: { | 182 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 content::WebContents* web_contents, | 237 content::WebContents* web_contents, |
238 bool show_context, | 238 bool show_context, |
239 const OnDone& done) { | 239 const OnDone& done) { |
240 DownloadDangerPromptImpl* prompt = new DownloadDangerPromptImpl( | 240 DownloadDangerPromptImpl* prompt = new DownloadDangerPromptImpl( |
241 item, web_contents, show_context, done); | 241 item, web_contents, show_context, done); |
242 // |prompt| will be deleted when the dialog is done. | 242 // |prompt| will be deleted when the dialog is done. |
243 TabModalConfirmDialog::Create(prompt, web_contents); | 243 TabModalConfirmDialog::Create(prompt, web_contents); |
244 return prompt; | 244 return prompt; |
245 } | 245 } |
246 #endif | 246 #endif |
OLD | NEW |