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

Side by Side Diff: content/browser/safe_util_win.h

Issue 11150027: Handle the case where IAttachmentExecute::Save() deletes a downloaded file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + Address comments + Update strings Created 8 years, 1 month 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 | « content/browser/download/mock_download_file.h ('k') | content/browser/safe_util_win.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 CONTENT_COMMON_SAFE_UTIL_WIN_H_ 5 #ifndef CONTENT_COMMON_SAFE_UTIL_WIN_H_
6 #define CONTENT_COMMON_SAFE_UTIL_WIN_H_ 6 #define CONTENT_COMMON_SAFE_UTIL_WIN_H_
7 7
8 #include <string> 8 #include <string>
9 #include <windows.h> 9 #include <windows.h>
10 10
11 class FilePath; 11 class FilePath;
12 class GURL;
12 13
13 namespace win_util { 14 namespace win_util {
14 15
15 // Open or run a downloaded file via the Windows shell, possibly showing first 16 // Open or run a downloaded file via the Windows shell, possibly showing first
16 // a consent dialog if the the file is deemed dangerous. This function is an 17 // a consent dialog if the the file is deemed dangerous. This function is an
17 // enhancement over the OpenItemViaShell() function of win_util.h. 18 // enhancement over the OpenItemViaShell() function of win_util.h.
18 // 19 //
19 // The user consent dialog will be shown or not according to the windows 20 // The user consent dialog will be shown or not according to the windows
20 // execution policy defined in the registry which can be overridden per user. 21 // execution policy defined in the registry which can be overridden per user.
21 // The mechanics of the policy are explained in the Microsoft Knowledge base 22 // The mechanics of the policy are explained in the Microsoft Knowledge base
(...skipping 11 matching lines...) Expand all
33 // dialog will be shown telling the user that the file will be blocked. 34 // dialog will be shown telling the user that the file will be blocked.
34 // 35 //
35 // In the event that there is no default application registered for the file 36 // In the event that there is no default application registered for the file
36 // specified by 'full_path' it ask the user, via the Windows "Open With" 37 // specified by 'full_path' it ask the user, via the Windows "Open With"
37 // dialog. 38 // dialog.
38 // Returns 'true' on successful open, 'false' otherwise. 39 // Returns 'true' on successful open, 'false' otherwise.
39 bool SaferOpenItemViaShell(HWND hwnd, const std::wstring& window_title, 40 bool SaferOpenItemViaShell(HWND hwnd, const std::wstring& window_title,
40 const FilePath& full_path, 41 const FilePath& full_path,
41 const std::wstring& source_url); 42 const std::wstring& source_url);
42 43
43 // Sets the Zone Identifier on the file to "Internet" (3). Returns true if the 44 // Invokes IAttachmentExecute::Save to validate the downloaded file. The call
44 // function succeeds, false otherwise. A failure is expected on system where 45 // may scan the file for viruses and if necessary, annotate it with evidence. As
45 // the Zone Identifier is not supported, like a machine with a FAT32 filesystem. 46 // a result of the validation, the file may be deleted. See:
46 // It should not be considered fatal. 47 // http://msdn.microsoft.com/en-us/bb776299
47 // 48 //
48 // |full_path| is the path to save the file to, and 49 // If Attachment Execution Services is unavailable, then this function will
49 // |source_url| is the URL where the file was downloaded from. 50 // attempt to manually annotate the file with security zone information. A
50 bool SetInternetZoneIdentifier(const FilePath& full_path, 51 // failure code will be returned in this case even if the file is sucessfully
51 const std::wstring& source_url); 52 // annotated.
52 53 //
54 // IAE::Save() will delete the file if it was found to be blocked by local
55 // security policy or if it was found to be infected. The call may also delete
56 // the file due to other failures (http://crbug.com/153212). A failure code will
57 // be returned in these cases.
58 //
59 // Typical return values:
60 // S_OK : The file was okay. If any viruses were found, they were cleaned.
61 // E_FAIL : Virus infected.
62 // INET_E_SECURITY_PROBLEM : The file was blocked due to security policy.
63 //
64 // Any other return value indicates an unexpected error during the scan.
65 //
66 // |full_path| : is the path to the downloaded file. This should be the final
67 // path of the download.
68 // |source_url|: the source URL for the download.
69 HRESULT ScanAndSaveDownloadedFile(const FilePath& full_path,
70 const GURL& source_url);
53 } // namespace win_util 71 } // namespace win_util
54 72
55 #endif // CONTENT_COMMON_SAFE_UTIL_WIN_H_ 73 #endif // CONTENT_COMMON_SAFE_UTIL_WIN_H_
OLDNEW
« no previous file with comments | « content/browser/download/mock_download_file.h ('k') | content/browser/safe_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698