BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / download / download_extensions.h
blob0051070f309a5f4998c9f3b89b426b08e17fcea7
1 // Copyright (c) 2011 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.
5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_EXTENSIONS_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_EXTENSIONS_H_
8 #include <string>
10 #include "base/files/file_path.h"
12 namespace download_util {
14 enum DownloadDangerLevel {
15 // Safe. Or at least not known to be dangerous. Safe to download and open,
16 // even if the download was accidental.
17 NOT_DANGEROUS,
19 // Require confirmation before downloading. An additional user gesture may not
20 // be required if the download was from a familiar site and the download was
21 // initiated via a user action.
22 ALLOW_ON_USER_GESTURE,
24 // Always require confirmation when downloading.
25 DANGEROUS
28 // Determine the download danger level of a file.
29 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path);
31 // Returns true if the file specified by |path| is allowed to open
32 // automatically.
34 // Not all downloads are initiated with the consent of the user. Even when the
35 // user consents, the file written to disk may differ from the users'
36 // expectations. I.e. a malicious website could drop a nefarious download
37 // possibly by click jacking, or by serving a file that is different from what
38 // the user intended to download.
40 // Any prompting done in order to validate a dangerous download is a speed bump
41 // rather than a security measure. The user likely doesn't have the information
42 // necessary to evaluate the safety of a downloaded file. In addition, downloads
43 // with a danger type of ALLOW_ON_USER_GESTURE might not prompt at all. So
44 // Chrome forces the user to manually open some file types by preventing them
45 // from being opened automatically. See https://crbug.com/461858
47 // See DownloadAutoOpenHint for details on the criteria used to disallow
48 // automatic opening for a file type.
49 bool IsAllowedToOpenAutomatically(const base::FilePath& path);
51 } // namespace download_util
53 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_EXTENSIONS_H_