| Index: chrome/common/safe_browsing/file_type_policies.h
|
| diff --git a/chrome/common/safe_browsing/file_type_policies.h b/chrome/common/safe_browsing/file_type_policies.h
|
| index f50d3a6ff6feaf13f4a12326ddc72d23a88d1611..29994464061f945620184e2eb1c7405a544a03b2 100644
|
| --- a/chrome/common/safe_browsing/file_type_policies.h
|
| +++ b/chrome/common/safe_browsing/file_type_policies.h
|
| @@ -16,6 +16,7 @@
|
| namespace safe_browsing {
|
|
|
| struct FileTypePoliciesSingletonTrait;
|
| +class FileTypePoliciesTestOverlay;
|
|
|
| // This holds a list of file types (aka file extensions) that we know about,
|
| // with policies related to how Safe Browsing and the download UI should treat
|
| @@ -67,6 +68,10 @@ class FileTypePolicies {
|
| DownloadFileType::DangerLevel GetFileDangerLevel(
|
| const base::FilePath& file) const;
|
|
|
| + // Return the type of ping we should send for this file
|
| + DownloadFileType::PingSetting PingSettingForFile(
|
| + const base::FilePath& file) const;
|
| +
|
| float SampledPingProbability() const;
|
|
|
| DownloadFileType PolicyForFile(const base::FilePath& file) const;
|
| @@ -108,11 +113,23 @@ class FileTypePolicies {
|
| const std::string& ext) const;
|
|
|
| private:
|
| + // Overrides the global singleton for tests if !=0. Caller retains ownership
|
| + // and should reset to 0 when done. Use FileTypePoliciesTestOverlay.
|
| + static void SetInstanceForTests(FileTypePolicies* instance);
|
| + static FileTypePolicies* instance_for_tests_;
|
| +
|
| // Read data from the main ResourceBundle. This updates the internal list
|
| // only if the data passes integrity checks. This is normally called once
|
| // after construction.
|
| void PopulateFromResourceBundle();
|
|
|
| + // Recreate file_type_by_ext_ to match config_.
|
| + void BuildIndex();
|
| +
|
| + // For testing: Safely replace our config_ with new_config.
|
| + void SetConfigForTesting(const DownloadFileTypeConfig& new_config);
|
| + DownloadFileTypeConfig GetConfigForTesting() const;
|
| +
|
| // The latest config we've committed. Starts out null.
|
| // Protected by lock_.
|
| std::unique_ptr<DownloadFileTypeConfig> config_;
|
| @@ -132,6 +149,7 @@ class FileTypePolicies {
|
| FRIEND_TEST_ALL_PREFIXES(FileTypePoliciesTest, BadUpdateFromExisting);
|
|
|
| friend struct FileTypePoliciesSingletonTrait;
|
| + friend class FileTypePoliciesTestOverlay;
|
| };
|
|
|
| } // namespace safe_browsing
|
|
|