Chromium Code Reviews| Index: chrome/browser/ui/views/download/download_danger_prompt_views.cc |
| diff --git a/chrome/browser/ui/views/download/download_danger_prompt_views.cc b/chrome/browser/ui/views/download/download_danger_prompt_views.cc |
| index ef7bbfbb06f7c2abbb1c223fa115c6cfe3418899..1f5c869b15e5d3786ccbd2d8d8ba2a1fd0047fee 100644 |
| --- a/chrome/browser/ui/views/download/download_danger_prompt_views.cc |
| +++ b/chrome/browser/ui/views/download/download_danger_prompt_views.cc |
| @@ -1,9 +1,9 @@ |
| // Copyright 2013 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "chrome/browser/download/download_danger_prompt.h" |
|
msw
2015/11/17 01:17:38
nit: add a blank line above this.
Jialiu Lin
2015/11/17 02:05:50
Done.
|
| #include "base/compiler_specific.h" |
| -#include "chrome/browser/download/download_danger_prompt.h" |
| #include "chrome/browser/download/download_stats.h" |
| #include "chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h" |
| #include "chrome/grit/chromium_strings.h" |
| @@ -41,7 +41,7 @@ class DownloadDangerPromptViews : public DownloadDangerPrompt, |
| const OnDone& done); |
| // DownloadDangerPrompt methods: |
| - void InvokeActionForTesting(Action action) override; |
| + std::string InvokeActionForTesting(Action action, const GURL& url) override; |
| // views::DialogDelegate methods: |
| base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| @@ -132,7 +132,8 @@ DownloadDangerPromptViews::DownloadDangerPromptViews( |
| } |
| // DownloadDangerPrompt methods: |
| -void DownloadDangerPromptViews::InvokeActionForTesting(Action action) { |
| +std::string DownloadDangerPromptViews::InvokeActionForTesting(Action action, |
| + const GURL& url) { |
| switch (action) { |
| case ACCEPT: |
| Accept(); |
| @@ -147,6 +148,8 @@ void DownloadDangerPromptViews::InvokeActionForTesting(Action action) { |
| NOTREACHED(); |
| break; |
| } |
| + |
| + return CreateSafeBrowsingDownloadRecoveryReport(action == ACCEPT, url); |
| } |
| // views::DialogDelegate methods: |
| @@ -333,6 +336,12 @@ void DownloadDangerPromptViews::RunDone(Action action) { |
| OnDone done = done_; |
| done_.Reset(); |
| if (download_ != NULL) { |
| + if (!download_->GetURL().is_empty()) { |
| + std::string report = CreateSafeBrowsingDownloadRecoveryReport( |
| + action == DownloadDangerPrompt::ACCEPT, download_->GetURL()); |
| + if (!report.empty()) |
| + SendSerializedReport(report); |
| + } |
| download_->RemoveObserver(this); |
| download_ = NULL; |
| } |