| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/download/download_stats.h" | 9 #include "chrome/browser/download/download_stats.h" |
| 10 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" | 10 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" |
| 11 #include "chrome/browser/safe_browsing/download_protection_service.h" | 11 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 12 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 12 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 13 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 13 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
| 14 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
| 15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 16 #include "components/strings/grit/components_strings.h" | 16 #include "components/strings/grit/components_strings.h" |
| 17 #include "content/public/browser/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
| 18 #include "content/public/browser/download_danger_type.h" | 18 #include "content/public/browser/download_danger_type.h" |
| 19 #include "content/public/browser/download_item.h" | 19 #include "content/public/browser/download_item.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/material_design/material_design_controller.h" |
| 21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 22 | 23 |
| 23 using extensions::ExperienceSamplingEvent; | 24 using extensions::ExperienceSamplingEvent; |
| 24 using safe_browsing::ClientSafeBrowsingReportRequest; | 25 using safe_browsing::ClientSafeBrowsingReportRequest; |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 // TODO(wittman): Create a native web contents modal dialog implementation of | 29 // TODO(wittman): Create a native web contents modal dialog implementation of |
| 29 // this dialog for non-Views platforms, to support bold formatting of the | 30 // this dialog for non-Views platforms, to support bold formatting of the |
| 30 // message lead. | 31 // message lead. |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 250 } |
| 250 | 251 |
| 251 } // namespace | 252 } // namespace |
| 252 | 253 |
| 253 // static | 254 // static |
| 254 DownloadDangerPrompt* DownloadDangerPrompt::Create( | 255 DownloadDangerPrompt* DownloadDangerPrompt::Create( |
| 255 content::DownloadItem* item, | 256 content::DownloadItem* item, |
| 256 content::WebContents* web_contents, | 257 content::WebContents* web_contents, |
| 257 bool show_context, | 258 bool show_context, |
| 258 const OnDone& done) { | 259 const OnDone& done) { |
| 260 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) |
| 261 return DownloadDangerPrompt::CreateDownloadDangerPromptViews( |
| 262 item, web_contents, show_context, done); |
| 263 |
| 259 DownloadDangerPromptImpl* prompt = | 264 DownloadDangerPromptImpl* prompt = |
| 260 new DownloadDangerPromptImpl(item, web_contents, show_context, done); | 265 new DownloadDangerPromptImpl(item, web_contents, show_context, done); |
| 261 // |prompt| will be deleted when the dialog is done. | 266 // |prompt| will be deleted when the dialog is done. |
| 262 TabModalConfirmDialog::Create(prompt, web_contents); | 267 TabModalConfirmDialog::Create(prompt, web_contents); |
| 263 return prompt; | 268 return prompt; |
| 264 } | 269 } |
| OLD | NEW |