Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: chrome/browser/download/download_danger_prompt.h

Issue 2630243003: MacViews: Enable views based Download recovery dialog behind secondary-ui-md flag. (Closed)
Patch Set: Correct method comment. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/download/download_danger_prompt_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/common/safe_browsing/csd.pb.h" 9 #include "chrome/common/safe_browsing/csd.pb.h"
10 10
(...skipping 15 matching lines...) Expand all
26 enum Action { 26 enum Action {
27 // The user chose to proceed down the dangerous path. 27 // The user chose to proceed down the dangerous path.
28 ACCEPT, 28 ACCEPT,
29 // The user chose not to proceed down the dangerous path. 29 // The user chose not to proceed down the dangerous path.
30 CANCEL, 30 CANCEL,
31 // The user dismissed the dialog without making an explicit choice. 31 // The user dismissed the dialog without making an explicit choice.
32 DISMISS, 32 DISMISS,
33 }; 33 };
34 typedef base::Callback<void(Action)> OnDone; 34 typedef base::Callback<void(Action)> OnDone;
35 35
36 // Return a new self-deleting DownloadDangerPrompt. |accepted| or |canceled| 36 // Return a new self-deleting DownloadDangerPrompt. The returned
37 // will be run when the the respective action is invoked. |canceled| may also 37 // DownloadDangerPrompt* is only used for testing. The caller does not own the
38 // be called when |item| is either no longer dangerous or no longer in 38 // object and receives no guarantees about lifetime. If |show_context|, then
39 // progress, or if the tab corresponding to |web_contents| is 39 // the prompt message will contain some information about the download and its
40 // closing. The returned DownloadDangerPrompt* is only used for testing. The 40 // danger; otherwise it won't. |done| is a callback called when the ACCEPT,
41 // caller does not own the object and receive no guarantees about lifetime. 41 // CANCEL or DISMISS action is invoked. |done| may be called with the CANCEL
42 // If |show_context|, then the prompt message will contain some information 42 // action even when |item| is either no longer dangerous or no longer in
43 // about the download and its danger; otherwise it won't. 43 // progress, or if the tab corresponding to |web_contents| is closing.
44 static DownloadDangerPrompt* Create(content::DownloadItem* item, 44 static DownloadDangerPrompt* Create(content::DownloadItem* item,
45 content::WebContents* web_contents, 45 content::WebContents* web_contents,
46 bool show_context, 46 bool show_context,
47 const OnDone& done); 47 const OnDone& done);
48 48
49 // Only to be used by tests. Subclasses must override to manually call the 49 // Only to be used by tests. Subclasses must override to manually call the
50 // respective button click handler. 50 // respective button click handler.
51 virtual void InvokeActionForTesting(Action action) = 0; 51 virtual void InvokeActionForTesting(Action action) = 0;
52 52
53 // Sends download recovery report to safe browsing backend. 53 // Sends download recovery report to safe browsing backend.
54 // Since it only records download url (DownloadItem::GetURL()), user's 54 // Since it only records download url (DownloadItem::GetURL()), user's
55 // action (click through or not) and its download danger type, it isn't gated 55 // action (click through or not) and its download danger type, it isn't gated
56 // by user's extended reporting preference (i.e. 56 // by user's extended reporting preference (i.e.
57 // prefs::kSafeBrowsingExtendedReportingEnabled). We should not put any extra 57 // prefs::kSafeBrowsingExtendedReportingEnabled). We should not put any extra
58 // information in this report. 58 // information in this report.
59 static void SendSafeBrowsingDownloadReport( 59 static void SendSafeBrowsingDownloadReport(
60 safe_browsing::ClientSafeBrowsingReportRequest::ReportType report_type, 60 safe_browsing::ClientSafeBrowsingReportRequest::ReportType report_type,
61 bool did_proceed, 61 bool did_proceed,
62 const content::DownloadItem& download); 62 const content::DownloadItem& download);
63 63
64 protected: 64 protected:
65 // Records UMA stats for a download danger prompt event. 65 // Records UMA stats for a download danger prompt event.
66 static void RecordDownloadDangerPrompt(bool did_proceed, 66 static void RecordDownloadDangerPrompt(bool did_proceed,
67 const content::DownloadItem& download); 67 const content::DownloadItem& download);
68
69 private:
70 // Returns a toolkit-views based download danger prompt.
71 static DownloadDangerPrompt* CreateDownloadDangerPromptViews(
72 content::DownloadItem* item,
73 content::WebContents* web_contents,
74 bool show_context,
75 const OnDone& done);
68 }; 76 };
69 77
70 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_ 78 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_danger_prompt_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698