summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_extensions.h
blob: 3a7c557d01419cb0ee0593b230a9a276fa796ddf (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
// Copyright (c) 2010 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_DOWNLOAD_DOWNLOAD_EXTENSIONS_H_
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_EXTENSIONS_H_
#pragma once

#include <string>

#include "base/file_path.h"

namespace download_util {

enum DownloadDangerLevel {
  NotDangerous,
  AllowOnUserGesture,
  Dangerous
};

// Determine the download danger level of a file.
DownloadDangerLevel GetFileDangerLevel(const FilePath& path);

// Determine the download danger level using a file extension.
DownloadDangerLevel GetFileExtensionDangerLevel(
    const FilePath::StringType& extension);

// True if the download danger level of the file is NotDangerous.
bool IsFileSafe(const FilePath& path);

// True if the download danger level of the extension is NotDangerous.
bool IsFileExtensionSafe(const FilePath::StringType& extension);

// Tests if we think the server means for this mime_type to be executable.
bool IsExecutableMimeType(const std::string& mime_type);

}  // namespace download_util

#endif  // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_EXTENSIONS_H_