| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/safe_browsing/file_type_policies.h" | 5 #include "chrome/common/safe_browsing/file_type_policies.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 AutoLock lock(lock_); | 202 AutoLock lock(lock_); |
| 203 return PolicyForExtension(ext).is_archive(); | 203 return PolicyForExtension(ext).is_archive(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool FileTypePolicies::IsCheckedBinaryFile(const base::FilePath& file) const { | 206 bool FileTypePolicies::IsCheckedBinaryFile(const base::FilePath& file) const { |
| 207 const std::string ext = CanonicalizedExtension(file); | 207 const std::string ext = CanonicalizedExtension(file); |
| 208 AutoLock lock(lock_); | 208 AutoLock lock(lock_); |
| 209 return PolicyForExtension(ext).ping_setting() == DownloadFileType::FULL_PING; | 209 return PolicyForExtension(ext).ping_setting() == DownloadFileType::FULL_PING; |
| 210 } | 210 } |
| 211 | 211 |
| 212 bool FileTypePolicies::IsAllowedToOpenAutomatically( |
| 213 const base::FilePath& file) const { |
| 214 const std::string ext = CanonicalizedExtension(file); |
| 215 if (ext.empty()) |
| 216 return false; |
| 217 AutoLock lock(lock_); |
| 218 return PolicyForExtension(ext).platform_settings(0).auto_open_hint() == |
| 219 DownloadFileType::ALLOW_AUTO_OPEN; |
| 220 } |
| 221 |
| 222 DownloadFileType::DangerLevel FileTypePolicies::GetFileDangerLevel( |
| 223 const base::FilePath& file) const { |
| 224 const std::string ext = CanonicalizedExtension(file); |
| 225 AutoLock lock(lock_); |
| 226 return PolicyForExtension(ext).platform_settings(0).danger_level(); |
| 227 } |
| 228 |
| 212 } // namespace safe_browsing | 229 } // namespace safe_browsing |
| OLD | NEW |