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

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

Issue 10545064: TabContentsWrapper -> TabContents, part 11. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
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 #pragma once 7 #pragma once
8 8
9 #include "base/callback_forward.h" 9 #include "base/callback_forward.h"
10 10
11 class ConstrainedWindow; 11 class ConstrainedWindow;
12 class TabContents; 12 class TabContents;
13 typedef TabContents TabContentsWrapper;
14 13
15 namespace content { 14 namespace content {
16 class DownloadItem; 15 class DownloadItem;
17 } 16 }
18 17
19 // Prompts the user for whether to Keep a dangerous DownloadItem using native 18 // Prompts the user for whether to Keep a dangerous DownloadItem using native
20 // UI. This prompt is invoked by the DownloadsDOMHandler when the user wants to 19 // UI. This prompt is invoked by the DownloadsDOMHandler when the user wants to
21 // accept a dangerous download. Having a native dialog intervene during the this 20 // accept a dangerous download. Having a native dialog intervene during the this
22 // workflow means that the chrome://downloads page no longer has the privilege 21 // workflow means that the chrome://downloads page no longer has the privilege
23 // to accept a dangerous download from script without user intervention. This 22 // to accept a dangerous download from script without user intervention. This
24 // step is necessary to prevent a malicious script form abusing such a 23 // step is necessary to prevent a malicious script form abusing such a
25 // privilege. 24 // privilege.
26 class DownloadDangerPrompt { 25 class DownloadDangerPrompt {
27 public: 26 public:
28 // Actions resulting from showing the danger prompt. 27 // Actions resulting from showing the danger prompt.
29 enum Action { 28 enum Action {
30 ACCEPT, 29 ACCEPT,
31 CANCEL 30 CANCEL
32 }; 31 };
33 32
34 // Return a new self-deleting DownloadDangerPrompt. |accepted| or |canceled| 33 // Return a new self-deleting DownloadDangerPrompt. |accepted| or |canceled|
35 // 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
36 // 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
37 // progress, or if the tab corresponding to |tab_contents_wrapper| is 36 // progress, or if the tab corresponding to |tab_contents| is
38 // closing. The returned DownloadDangerPrompt* is only used for testing. The 37 // closing. The returned DownloadDangerPrompt* is only used for testing. The
39 // 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.
40 static DownloadDangerPrompt* Create( 39 static DownloadDangerPrompt* Create(
41 content::DownloadItem* item, 40 content::DownloadItem* item,
42 TabContentsWrapper* tab_contents_wrapper, 41 TabContents* tab_contents,
43 const base::Closure& accepted, 42 const base::Closure& accepted,
44 const base::Closure& canceled); 43 const base::Closure& canceled);
45 44
46 protected: 45 protected:
47 friend class DownloadDangerPromptTest; 46 friend class DownloadDangerPromptTest;
48 47
49 // Only to be used by tests. Subclasses must override to manually call the 48 // Only to be used by tests. Subclasses must override to manually call the
50 // respective button click handler. 49 // respective button click handler.
51 virtual void InvokeActionForTesting(Action action) = 0; 50 virtual void InvokeActionForTesting(Action action) = 0;
52 }; 51 };
53 52
54 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_ 53 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DANGER_PROMPT_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_danger_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698