1 // Copyright (c) 2010 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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_EXTENSIONS_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_EXTENSIONS_H_ 7 #pragma once 8 9 #include <string> 10 11 #include "base/file_path.h" 12 13 namespace download_util { 14 15 enum DownloadDangerLevel { 16 NotDangerous, 17 AllowOnUserGesture, 18 Dangerous 19 }; 20 21 // Determine the download danger level of a file. 22 DownloadDangerLevel GetFileDangerLevel(const FilePath& path); 23 24 // Determine the download danger level using a file extension. 25 DownloadDangerLevel GetFileExtensionDangerLevel( 26 const FilePath::StringType& extension); 27 28 // True if the download danger level of the file is NotDangerous. 29 bool IsFileSafe(const FilePath& path); 30 31 // Tests if we think the server means for this mime_type to be executable. 32 bool IsExecutableMimeType(const std::string& mime_type); 33 34 } // namespace download_util 35 36 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_EXTENSIONS_H_ 37