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

Side by Side Diff: content/browser/download/quarantine.h

Issue 2124373002: [PPAPI] Quarantine files that are writeable by a Pepper plugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@consolidate-file-metadata
Patch Set: Address comments. Created 4 years 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 | « content/browser/download/base_file.cc ('k') | content/browser/download/quarantine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_DOWNLOAD_QUARANTINE_H_
6 #define CONTENT_BROWSER_DOWNLOAD_QUARANTINE_H_
7
8 #include <string>
9
10 #include "content/common/content_export.h"
11
12 class GURL;
13
14 namespace base {
15 class FilePath;
16 }
17
18 namespace content {
19
20 // Return value for QuarantineFile.
21 enum class QuarantineFileResult {
22 OK, // Success.
23 ACCESS_DENIED, // Access to the file was denied. The safety of the file could
24 // not be determined.
25 BLOCKED_BY_POLICY, // Downloads from |source_url| are not allowed by policy.
26 // The file has been deleted.
27 ANNOTATION_FAILED, // Unable to write the mark-of-the-web or otherwise
28 // annotate the file as being downloaded from
29 // |source_url|.
30 FILE_MISSING, // |file| does not name a valid file.
31 SECURITY_CHECK_FAILED, // An unknown error occurred while checking |file|.
32 // The file may have been deleted.
33 VIRUS_INFECTED // |file| was found to be infected by a virus and was deleted.
34 };
35
36 // Quarantine a file that was downloaded from the internet.
37 //
38 // Ensures that |file| is handled as safely as possible given that it was
39 // downloaded from |source_url|. The details of how a downloaded file is handled
40 // are platform dependent. Please refer to the individual quarantine_<os>
41 // implementation.
42 //
43 // This function should be called for all files downloaded from the internet and
44 // placed in a manner discoverable by the user, or exposed to an external
45 // application. Furthermore, it should be called:
46 //
47 // * **AFTER** all the data has been written to the file. On Windows, registered
48 // anti-virus products will be invoked for scanning the contents of the file.
49 // Hence it's important to have the final contents of the file be available at
50 // the point at which this function is called.
51 //
52 // Exception: Zero-length files will be handled solely on the basis of the
53 // |source_url| and the file type. This exception accommodates situations
54 // where the file contents cannot be determined before it is made visible to
55 // an external application.
56 //
57 // * **AFTER** the file has been renamed to its final name. The file type is
58 // significant and is derived from the filename.
59 //
60 // * **BEFORE** the file is made visible to an external application or the user.
61 // Security checks and mark-of-the-web annotations must be made prior to
62 // exposing the file externally.
63 //
64 // Note that it is possible for this method to take a long time to complete
65 // (several seconds or more). In addition to blocking during this time, this
66 // delay also introduces a window during which a browser shutdown may leave the
67 // downloaded file unannotated.
68 //
69 // Parameters:
70 // |file| : Final name of the file.
71 // |source_url|: URL from which the file content was downloaded.
72 // |referrer_url|: Referring URL.
73 // |client_guid|: Only used on Windows. Identifies the client application
74 // that downloaded the file.
75 CONTENT_EXPORT QuarantineFileResult
76 QuarantineFile(const base::FilePath& file,
77 const GURL& source_url,
78 const GURL& referrer_url,
79 const std::string& client_guid);
80
81 } // namespace content
82
83 #endif // CONTENT_BROWSER_DOWNLOAD_QUARANTINE_H_
OLDNEW
« no previous file with comments | « content/browser/download/base_file.cc ('k') | content/browser/download/quarantine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698