chromium/components/safe_browsing/content/common/file_type_policies.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/safe_browsing/content/common/file_type_policies.h"

#include "base/check_op.h"
#include "base/memory/singleton.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/strings/string_util.h"
#include "components/grit/components_resources.h"
#include "components/safe_browsing/content/common/file_type_policies_policy_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "url/gurl.h"

namespace safe_browsing {

namespace policy {

ExtensionToPolicyMap;

ExtensionToPolicyMap& GetExtensionToPolicyMap() {}

const DownloadFileType& GetOrCreatePolicyForExtensionOverrideNotDangerous(
    const std::string& extension,
    const DownloadFileType& base_policy) {}

}  // namespace policy

AutoLock;

// Our Singleton needs to populate itself when first constructed.  This
// is left out of the constructor to make testing simpler. This
// singleton needs to be leaky so that archive analyzers can access file
// type policies from a helper thread. FileTypePolicies must not do
// nontrivial work in the destructor.
struct FileTypePoliciesSingletonTrait
    : public base::LeakySingletonTraits<FileTypePolicies> {};

// --- FileTypePolicies methods ---

// static
FileTypePolicies* FileTypePolicies::GetInstance() {}

FileTypePolicies::FileTypePolicies() {}

// Since FileTypePolicies is a leaky singleton, the destructor will
// never run.
FileTypePolicies::~FileTypePolicies() = default;

std::string FileTypePolicies::ReadResourceBundle() {}

void FileTypePolicies::RecordUpdateMetrics(UpdateResult result,
                                           const std::string& src_name) {}

void FileTypePolicies::PopulateFromResourceBundle() {}

void FileTypePolicies::PopulateFromDynamicUpdate(const std::string& binary_pb) {}

FileTypePolicies::UpdateResult FileTypePolicies::PopulateFromBinaryPb(
    const std::string& binary_pb) {}

void FileTypePolicies::SwapConfig(
    std::unique_ptr<DownloadFileTypeConfig>& new_config) {}

void FileTypePolicies::SwapConfigLocked(
    std::unique_ptr<DownloadFileTypeConfig>& new_config) {}

// static
base::FilePath::StringType FileTypePolicies::GetFileExtension(
    const base::FilePath& file) {}

// static
std::string FileTypePolicies::CanonicalizedExtension(
    const base::FilePath& file) {}

//
// Accessors
//

float FileTypePolicies::SampledPingProbability() const {}

const DownloadFileType& FileTypePolicies::PolicyForExtension(
    const std::string& ascii_ext,
    const GURL& source_url,
    const PrefService* prefs) const {}

DownloadFileType FileTypePolicies::PolicyForFile(
    const base::FilePath& file,
    const GURL& source_url,
    const PrefService* prefs) const {}

DownloadFileType::PlatformSettings FileTypePolicies::SettingsForFile(
    const base::FilePath& file,
    const GURL& source_url,
    const PrefService* prefs) const {}

int64_t FileTypePolicies::UmaValueForFile(const base::FilePath& file) const {}

bool FileTypePolicies::IsArchiveFile(const base::FilePath& file) const {}

// TODO(nparker): Add unit tests for these accessors.

bool FileTypePolicies::IsAllowedToOpenAutomatically(
    const base::FilePath& file) const {}

DownloadFileType::PingSetting FileTypePolicies::PingSettingForFile(
    const base::FilePath& file) const {}

bool FileTypePolicies::IsCheckedBinaryFile(const base::FilePath& file) const {}

DownloadFileType::DangerLevel FileTypePolicies::GetFileDangerLevel(
    const base::FilePath& file,
    const GURL& source_url,
    const PrefService* prefs) const {}

uint64_t FileTypePolicies::GetMaxFileSizeToAnalyze(
    const std::string& ascii_ext) const {}

uint64_t FileTypePolicies::GetMaxFileSizeToAnalyze(
    const base::FilePath& file) const {}

uint64_t FileTypePolicies::GetMaxArchivedBinariesToReport() const {}

}  // namespace safe_browsing