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 #ifndef CHROME_COMMON_SAFE_BROWSING_FILE_TYPE_POLICIES_H_ | 5 #ifndef CHROME_COMMON_SAFE_BROWSING_FILE_TYPE_POLICIES_H_ |
6 #define CHROME_COMMON_SAFE_BROWSING_FILE_TYPE_POLICIES_H_ | 6 #define CHROME_COMMON_SAFE_BROWSING_FILE_TYPE_POLICIES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Static Utils | 41 // Static Utils |
42 // | 42 // |
43 | 43 |
44 // Returns the file extension, with the dot. | 44 // Returns the file extension, with the dot. |
45 static base::FilePath::StringType GetFileExtension( | 45 static base::FilePath::StringType GetFileExtension( |
46 const base::FilePath& file); | 46 const base::FilePath& file); |
47 | 47 |
48 // | 48 // |
49 // Accessors | 49 // Accessors |
50 // | 50 // |
51 DownloadFileType PolicyForFile(const base::FilePath& file) const; | |
52 DownloadFileType::PlatformSettings SettingsForFile( | |
53 const base::FilePath& file) const; | |
54 bool IsArchiveFile(const base::FilePath& file) const; | 51 bool IsArchiveFile(const base::FilePath& file) const; |
55 | 52 |
56 // SBClientDownloadExtensions UMA histogram bucket for this file's type. | 53 // SBClientDownloadExtensions UMA histogram bucket for this file's type. |
57 int64_t UmaValueForFile(const base::FilePath& file) const; | 54 int64_t UmaValueForFile(const base::FilePath& file) const; |
58 | 55 |
59 // True if download protection should send a ping to check | 56 // True if download protection should send a ping to check |
60 // this type of file. | 57 // this type of file. |
61 bool IsCheckedBinaryFile(const base::FilePath& file) const; | 58 bool IsCheckedBinaryFile(const base::FilePath& file) const; |
62 | 59 |
| 60 // True if the user can select this file type to be opened automatically. |
| 61 bool IsAllowedToOpenAutomatically(const base::FilePath& file) const; |
| 62 |
| 63 // Return the danger level of this file type. |
| 64 DownloadFileType::DangerLevel GetFileDangerLevel( |
| 65 const base::FilePath& file) const; |
| 66 |
63 float SampledPingProbability() const; | 67 float SampledPingProbability() const; |
64 | 68 |
| 69 DownloadFileType PolicyForFile(const base::FilePath& file) const; |
| 70 DownloadFileType::PlatformSettings SettingsForFile( |
| 71 const base::FilePath& file) const; |
| 72 |
65 protected: | 73 protected: |
66 // Creator must call one of Populate* before calling other methods. | 74 // Creator must call one of Populate* before calling other methods. |
67 FileTypePolicies(); | 75 FileTypePolicies(); |
68 | 76 |
69 // Used in metrics, do not reorder. | 77 // Used in metrics, do not reorder. |
70 enum class UpdateResult { | 78 enum class UpdateResult { |
71 SUCCESS = 1, | 79 SUCCESS = 1, |
72 FAILED_EMPTY = 2, | 80 FAILED_EMPTY = 2, |
73 FAILED_PROTO_PARSE = 3, | 81 FAILED_PROTO_PARSE = 3, |
74 FAILED_DELTA_CHECK = 4, | 82 FAILED_DELTA_CHECK = 4, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 FRIEND_TEST_ALL_PREFIXES(FileTypePoliciesTest, UnpackResourceBundle); | 126 FRIEND_TEST_ALL_PREFIXES(FileTypePoliciesTest, UnpackResourceBundle); |
119 FRIEND_TEST_ALL_PREFIXES(FileTypePoliciesTest, BadProto); | 127 FRIEND_TEST_ALL_PREFIXES(FileTypePoliciesTest, BadProto); |
120 FRIEND_TEST_ALL_PREFIXES(FileTypePoliciesTest, BadUpdateFromExisting); | 128 FRIEND_TEST_ALL_PREFIXES(FileTypePoliciesTest, BadUpdateFromExisting); |
121 | 129 |
122 friend struct FileTypePoliciesSingletonTrait; | 130 friend struct FileTypePoliciesSingletonTrait; |
123 }; | 131 }; |
124 | 132 |
125 } // namespace safe_browsing | 133 } // namespace safe_browsing |
126 | 134 |
127 #endif // CHROME_COMMON_SAFE_BROWSING_FILE_TYPE_POLICIES_H_ | 135 #endif // CHROME_COMMON_SAFE_BROWSING_FILE_TYPE_POLICIES_H_ |
OLD | NEW |