summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing/unverified_download_field_trial.h
blob: 3490f7929d9038e6201e626e2203938eb81e98b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_SAFE_BROWSING_UNVERIFIED_DOWNLOAD_FIELD_TRIAL_H_
#define CHROME_BROWSER_SAFE_BROWSING_UNVERIFIED_DOWNLOAD_FIELD_TRIAL_H_

namespace base {
class FilePath;
}

namespace safe_browsing {

// Unverified Download Field Trial
//
// It is possible in some circumstances to download a file without invoking
// SafeBrowsing to verify the source URLs or the downloaded contents. Ideally
// all code paths that writes untrusted contents to disk in a user discoverable
// manner would invoke SafeBrowsing. But until all such code paths are properly
// plumbed, this field trial will help control the behavior of known unverified
// code paths.

extern const char kUnverifiedDownloadFieldTrialName[];

// The trial groups are:
//
// * DisableByParameter[*] : Decides the fate of unverified downloads based on
//     whether the file type matches a whitelist and a blacklist specified as a
//     parameter to this trial group. Any file type that doesn't match either of
//     these lists will default to being allowed.
extern const char kUnverifiedDownloadFieldTrialDisableByParameter[];

//     The parameters are:
//
//     - 'whitelist' : A comma separated list of file types including leading
//         extension separator. E.g. ".abc,.def" would match both foo.abc and
//         foo.def, but not foo.txt. Any matching file will be allowed to be
//         downloaded.
extern const char kUnverifiedDownloadFieldTrialWhitelistParam[];

//     - 'blacklist' : Similar in format to 'whitelist' but causes matching file
//         types to be disallowed from downloading.
extern const char kUnverifiedDownloadFieldTrialBlacklistParam[];

//     - 'block_sb_types' : If non-empty, causes all file types that satisfy
//         safe_browsing::IsSupportedBinaryFile() to be blocked.
extern const char kUnverifiedDownloadFieldTrialBlockSBTypesParam[];

// Returns true if |file| is allowed to be downloaded based on the current field
// trial settings.
bool IsUnverifiedDownloadAllowedByFieldTrial(const base::FilePath& file);

}  // namespace safe_browsing

#endif  // CHROME_BROWSER_SAFE_BROWSING_UNVERIFIED_DOWNLOAD_FIELD_TRIAL_H_