chromium/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc

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

#include "chrome/browser/safe_browsing/incident_reporting/last_download_finder.h"

#include <stddef.h>
#include <stdint.h>

#include <algorithm>
#include <functional>
#include <memory>
#include <tuple>
#include <utility>

#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/safe_browsing/download_type_util.h"
#include "components/history/core/browser/download_constants.h"
#include "components/language/core/browser/pref_names.h"
#include "components/language/core/common/locale_util.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/content/common/file_type_policies.h"
#include "components/safe_browsing/core/common/proto/csd.pb.h"
#include "crypto/sha2.h"
#include "extensions/buildflags/buildflags.h"

namespace safe_browsing {

namespace {

// The following functions are overloaded for the two object types that
// represent the metadata for a download: history::DownloadRow and
// ClientIncidentReport_DownloadDetails. These are used by the template
// functions that follow.

// Returns the end time of a download represented by a DownloadRow.
int64_t GetEndTime(const history::DownloadRow& row) {}

// Returns the end time of a download represented by a DownloadDetails.
int64_t GetEndTime(const ClientIncidentReport_DownloadDetails& details) {}

bool IsBinaryDownloadForCurrentOS(
    ClientDownloadRequest::DownloadType download_type) {}

// Returns true if a download represented by a DownloadRow is a binary file for
// the current OS.
bool IsBinaryDownload(const history::DownloadRow& row) {}

// Returns true if a download represented by a DownloadRow is not a binary file.
bool IsNonBinaryDownload(const history::DownloadRow& row) {}

// Returns true if a download represented by a DownloadDetails is binary file
// for the current OS.
bool IsBinaryDownload(const ClientIncidentReport_DownloadDetails& details) {}

// Returns true if a download represented by a DownloadRow has been opened.
bool HasBeenOpened(const history::DownloadRow& row) {}

// Returns true if a download represented by a DownloadDetails has been opened.
bool HasBeenOpened(const ClientIncidentReport_DownloadDetails& details) {}

// Returns true if |first| is more recent than |second|, preferring opened over
// non-opened for downloads that completed at the same time (extraordinarily
// unlikely). Only files that look like some kind of executable are considered.
template <class A, class B>
bool IsMoreInterestingBinaryThan(const A& first, const B& second) {}

// Returns true if |first| is more recent than |second|, preferring opened over
// non-opened for downloads that completed at the same time (extraordinarily
// unlikely). Only files that do not look like an executable are considered.
bool IsMoreInterestingNonBinaryThan(const history::DownloadRow& first,
                                    const history::DownloadRow& second) {}

// Returns a pointer to the most interesting completed download in |downloads|.
const history::DownloadRow* FindMostInteresting(
    const std::vector<history::DownloadRow>& downloads,
    bool is_binary) {}

// Returns true if |candidate| is more interesting than whichever of |details|
// or |best_row| is present.
template <class D>
bool IsMostInterestingBinary(
    const D& candidate,
    const ClientIncidentReport_DownloadDetails* details,
    const history::DownloadRow& best_row) {}

// Populates the |details| protobuf with information pertaining to |download|.
void PopulateDetailsFromRow(const history::DownloadRow& download,
                            ClientIncidentReport_DownloadDetails* details) {}

// Populates the |details| protobuf with information pertaining to the
// (non-binary) |download|.
void PopulateNonBinaryDetailsFromRow(
    const history::DownloadRow& download,
    ClientIncidentReport_NonBinaryDownloadDetails* details) {}

}  // namespace

LastDownloadFinder::~LastDownloadFinder() {}

// static
std::unique_ptr<LastDownloadFinder> LastDownloadFinder::Create(
    DownloadDetailsGetter download_details_getter,
    LastDownloadCallback callback) {}

LastDownloadFinder::LastDownloadFinder() = default;

LastDownloadFinder::LastDownloadFinder(
    DownloadDetailsGetter download_details_getter,
    LastDownloadCallback callback)
    :{}

LastDownloadFinder::PendingProfileData::PendingProfileData(
    LastDownloadFinder* finder,
    Profile* profile,
    State state)
    :{}

LastDownloadFinder::PendingProfileData::~PendingProfileData() = default;

// static
LastDownloadFinder::ProfileKey LastDownloadFinder::KeyForProfile(
    Profile* profile) {}

void LastDownloadFinder::SearchInProfile(Profile* profile) {}

void LastDownloadFinder::OnMetadataQuery(
    ProfileKey profile_key,
    std::unique_ptr<ClientIncidentReport_DownloadDetails> details) {}

void LastDownloadFinder::OnDownloadQuery(
    ProfileKey profile_key,
    std::vector<history::DownloadRow> downloads) {}

void LastDownloadFinder::RemoveProfileAndReportIfDone(
    PendingProfilesMap::iterator iter) {}

void LastDownloadFinder::ReportResults() {}

void LastDownloadFinder::OnProfileAdded(Profile* profile) {}

void LastDownloadFinder::OnProfileWillBeDestroyed(Profile* profile) {}

void LastDownloadFinder::OnHistoryServiceLoaded(
    history::HistoryService* history_service) {}

void LastDownloadFinder::HistoryServiceBeingDeleted(
    history::HistoryService* history_service) {}

}  // namespace safe_browsing