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

Unified Diff: chrome/common/safe_browsing/file_type_policies.cc

Issue 1982723002: Use FileTypePolicies for download danger classifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use_policies
Patch Set: Fix bad rebase Created 4 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/safe_browsing/file_type_policies.h ('k') | content/browser/download/download_stats.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/safe_browsing/file_type_policies.cc
diff --git a/chrome/common/safe_browsing/file_type_policies.cc b/chrome/common/safe_browsing/file_type_policies.cc
index 01db9dab3876cab8e7002a03078d4df2e5a98000..cf9e4418b853e13033686b366b4c2f5e1300d471 100644
--- a/chrome/common/safe_browsing/file_type_policies.cc
+++ b/chrome/common/safe_browsing/file_type_policies.cc
@@ -209,4 +209,21 @@ bool FileTypePolicies::IsCheckedBinaryFile(const base::FilePath& file) const {
return PolicyForExtension(ext).ping_setting() == DownloadFileType::FULL_PING;
}
+bool FileTypePolicies::IsAllowedToOpenAutomatically(
+ const base::FilePath& file) const {
+ const std::string ext = CanonicalizedExtension(file);
+ if (ext.empty())
+ return false;
+ AutoLock lock(lock_);
+ return PolicyForExtension(ext).platform_settings(0).auto_open_hint() ==
+ DownloadFileType::ALLOW_AUTO_OPEN;
+}
+
+DownloadFileType::DangerLevel FileTypePolicies::GetFileDangerLevel(
+ const base::FilePath& file) const {
+ const std::string ext = CanonicalizedExtension(file);
+ AutoLock lock(lock_);
+ return PolicyForExtension(ext).platform_settings(0).danger_level();
+}
+
} // namespace safe_browsing
« no previous file with comments | « chrome/common/safe_browsing/file_type_policies.h ('k') | content/browser/download/download_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698