Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "url/gurl.h" | |
|
Lei Zhang
2015/11/24 18:55:27
forward decl GURL instead?
Jialiu Lin
2015/11/25 23:43:21
Done.
| |
| 9 | 10 |
| 10 namespace content { | 11 namespace content { |
| 11 class DownloadItem; | 12 class DownloadItem; |
| 12 class WebContents; | 13 class WebContents; |
| 13 } | 14 } |
| 14 | 15 |
| 15 // Prompts the user for whether to Keep a dangerous DownloadItem using native | 16 // Prompts the user for whether to Keep a dangerous DownloadItem using native |
| 16 // UI. This prompt is invoked by the DownloadsDOMHandler when the user wants to | 17 // UI. This prompt is invoked by the DownloadsDOMHandler when the user wants to |
| 17 // accept a dangerous download. Having a native dialog intervene during the this | 18 // accept a dangerous download. Having a native dialog intervene during the this |
| 18 // workflow means that the chrome://downloads page no longer has the privilege | 19 // workflow means that the chrome://downloads page no longer has the privilege |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 30 typedef base::Callback<void(Action)> OnDone; | 31 typedef base::Callback<void(Action)> OnDone; |
| 31 | 32 |
| 32 // Return a new self-deleting DownloadDangerPrompt. |accepted| or |canceled| | 33 // Return a new self-deleting DownloadDangerPrompt. |accepted| or |canceled| |
| 33 // will be run when the the respective action is invoked. |canceled| may also | 34 // will be run when the the respective action is invoked. |canceled| may also |
| 34 // be called when |item| is either no longer dangerous or no longer in | 35 // be called when |item| is either no longer dangerous or no longer in |
| 35 // progress, or if the tab corresponding to |web_contents| is | 36 // progress, or if the tab corresponding to |web_contents| is |
| 36 // closing. The returned DownloadDangerPrompt* is only used for testing. The | 37 // closing. The returned DownloadDangerPrompt* is only used for testing. The |
| 37 // caller does not own the object and receive no guarantees about lifetime. | 38 // caller does not own the object and receive no guarantees about lifetime. |
| 38 // If |show_context|, then the prompt message will contain some information | 39 // If |show_context|, then the prompt message will contain some information |
| 39 // about the download and its danger; otherwise it won't. | 40 // about the download and its danger; otherwise it won't. |
| 40 static DownloadDangerPrompt* Create( | 41 static DownloadDangerPrompt* Create(content::DownloadItem* item, |
| 41 content::DownloadItem* item, | 42 content::WebContents* web_contents, |
| 42 content::WebContents* web_contents, | 43 bool show_context, |
| 43 bool show_context, | 44 const OnDone& done); |
| 44 const OnDone& done); | |
| 45 | 45 |
| 46 // Only to be used by tests. Subclasses must override to manually call the | 46 // Only to be used by tests. Subclasses must override to manually call the |
| 47 // respective button click handler. | 47 // respective button click handler. |
| 48 virtual void InvokeActionForTesting(Action action) = 0; | 48 virtual void InvokeActionForTesting(Action action) = 0; |
| 49 | |
| 50 protected: | |
| 51 // Sends download recovery report to safe browsing backend. | |
| 52 // Since it only records download url (DownloadItem::GetURL()) and user's | |
| 53 // action (click through or not), it isn't gated by extended_reporting. We | |
|
Lei Zhang
2015/11/24 18:55:27
What does "extended_reporting" refer to here?
Jialiu Lin
2015/11/25 23:43:21
This refers to prefs::kSafeBrowsingExtendedReporti
| |
| 54 // should not put any extra information in this report. | |
| 55 static void SendSafeBrowsingDownloadRecoveryReport(bool did_proceed, | |
| 56 const GURL& url); | |
| 49 }; | 57 }; |
| 50 | 58 |
| 51 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_ | 59 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_ |
| OLD | NEW |