| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "chrome/browser/download/download_stats.h" | 8 #include "chrome/browser/download/download_stats.h" |
| 9 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" | 9 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" |
| 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/grit/chromium_strings.h" | 11 #include "chrome/grit/chromium_strings.h" |
| 11 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
| 12 #include "components/constrained_window/constrained_window_views.h" | 13 #include "components/constrained_window/constrained_window_views.h" |
| 13 #include "components/strings/grit/components_strings.h" | 14 #include "components/strings/grit/components_strings.h" |
| 14 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
| 15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/download_danger_type.h" | 17 #include "content/public/browser/download_danger_type.h" |
| 17 #include "content/public/browser/download_item.h" | 18 #include "content/public/browser/download_item.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 111 |
| 111 RecordOpenedDangerousConfirmDialog(download_->GetDangerType()); | 112 RecordOpenedDangerousConfirmDialog(download_->GetDangerType()); |
| 112 | 113 |
| 113 // ExperienceSampling: A malicious download warning is being shown to the | 114 // ExperienceSampling: A malicious download warning is being shown to the |
| 114 // user, so we start a new SamplingEvent and track it. | 115 // user, so we start a new SamplingEvent and track it. |
| 115 sampling_event_.reset(new ExperienceSamplingEvent( | 116 sampling_event_.reset(new ExperienceSamplingEvent( |
| 116 ExperienceSamplingEvent::kDownloadDangerPrompt, | 117 ExperienceSamplingEvent::kDownloadDangerPrompt, |
| 117 item->GetURL(), | 118 item->GetURL(), |
| 118 item->GetReferrerUrl(), | 119 item->GetReferrerUrl(), |
| 119 item->GetBrowserContext())); | 120 item->GetBrowserContext())); |
| 121 chrome::RecordDialogCreation( |
| 122 chrome::DialogIdentifier::DOWNLOAD_DANGER_PROMPT); |
| 120 } | 123 } |
| 121 | 124 |
| 122 // DownloadDangerPrompt methods: | 125 // DownloadDangerPrompt methods: |
| 123 void DownloadDangerPromptViews::InvokeActionForTesting(Action action) { | 126 void DownloadDangerPromptViews::InvokeActionForTesting(Action action) { |
| 124 switch (action) { | 127 switch (action) { |
| 125 case ACCEPT: | 128 case ACCEPT: |
| 126 // This inversion is intentional. | 129 // This inversion is intentional. |
| 127 Cancel(); | 130 Cancel(); |
| 128 break; | 131 break; |
| 129 | 132 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 content::DownloadItem* item, | 345 content::DownloadItem* item, |
| 343 content::WebContents* web_contents, | 346 content::WebContents* web_contents, |
| 344 bool show_context, | 347 bool show_context, |
| 345 const OnDone& done) { | 348 const OnDone& done) { |
| 346 DownloadDangerPromptViews* download_danger_prompt = | 349 DownloadDangerPromptViews* download_danger_prompt = |
| 347 new DownloadDangerPromptViews(item, show_context, done); | 350 new DownloadDangerPromptViews(item, show_context, done); |
| 348 constrained_window::ShowWebModalDialogViews(download_danger_prompt, | 351 constrained_window::ShowWebModalDialogViews(download_danger_prompt, |
| 349 web_contents); | 352 web_contents); |
| 350 return download_danger_prompt; | 353 return download_danger_prompt; |
| 351 } | 354 } |
| OLD | NEW |