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

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

Issue 12086018: GTTF: Add missing virtual destructors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trybots 4 Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/certificate_manager_model.h ('k') | chrome/browser/extensions/activity_log.h » ('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 9
10 namespace content { 10 namespace content {
11 class DownloadItem; 11 class DownloadItem;
12 class WebContents; 12 class WebContents;
13 } 13 }
14 14
15 // Prompts the user for whether to Keep a dangerous DownloadItem using native 15 // 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 16 // 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 17 // 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 18 // workflow means that the chrome://downloads page no longer has the privilege
19 // to accept a dangerous download from script without user intervention. This 19 // to accept a dangerous download from script without user intervention. This
20 // step is necessary to prevent a malicious script form abusing such a 20 // step is necessary to prevent a malicious script form abusing such a
21 // privilege. 21 // privilege.
22 class DownloadDangerPrompt { 22 class DownloadDangerPrompt {
23 public: 23 public:
24 // Actions resulting from showing the danger prompt. 24 // Actions resulting from showing the danger prompt.
25 enum Action { 25 enum Action {
26 ACCEPT, 26 ACCEPT,
27 CANCEL 27 CANCEL
28 }; 28 };
29 29
30 virtual ~DownloadDangerPrompt() { }
31
30 // Return a new self-deleting DownloadDangerPrompt. |accepted| or |canceled| 32 // Return a new self-deleting DownloadDangerPrompt. |accepted| or |canceled|
31 // will be run when the the respective action is invoked. |canceled| may also 33 // will be run when the the respective action is invoked. |canceled| may also
32 // be called when |item| is either no longer dangerous or no longer in 34 // be called when |item| is either no longer dangerous or no longer in
33 // progress, or if the tab corresponding to |web_contents| is 35 // progress, or if the tab corresponding to |web_contents| is
34 // closing. The returned DownloadDangerPrompt* is only used for testing. The 36 // closing. The returned DownloadDangerPrompt* is only used for testing. The
35 // caller does not own the object and receive no guarantees about lifetime. 37 // caller does not own the object and receive no guarantees about lifetime.
36 // If |show_context|, then the prompt message will contain some information 38 // If |show_context|, then the prompt message will contain some information
37 // about the download and its danger; otherwise it won't. 39 // about the download and its danger; otherwise it won't.
38 static DownloadDangerPrompt* Create( 40 static DownloadDangerPrompt* Create(
39 content::DownloadItem* item, 41 content::DownloadItem* item,
40 content::WebContents* web_contents, 42 content::WebContents* web_contents,
41 bool show_context, 43 bool show_context,
42 const base::Closure& accepted, 44 const base::Closure& accepted,
43 const base::Closure& canceled); 45 const base::Closure& canceled);
44 46
45 protected: 47 protected:
46 friend class DownloadDangerPromptTest; 48 friend class DownloadDangerPromptTest;
47 49
48 // Only to be used by tests. Subclasses must override to manually call the 50 // Only to be used by tests. Subclasses must override to manually call the
49 // respective button click handler. 51 // respective button click handler.
50 virtual void InvokeActionForTesting(Action action) = 0; 52 virtual void InvokeActionForTesting(Action action) = 0;
51 }; 53 };
52 54
53 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_ 55 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_
OLDNEW
« no previous file with comments | « chrome/browser/certificate_manager_model.h ('k') | chrome/browser/extensions/activity_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698