chromium/components/safe_browsing/content/renderer/phishing_classifier/phishing_term_feature_extractor.cc

// Copyright 2012 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/renderer/phishing_classifier/phishing_term_feature_extractor.h"

#include <list>
#include <map>
#include <memory>
#include <string_view>
#include <unordered_set>
#include <utility>

#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/i18n/break_iterator.h"
#include "base/i18n/case_conversion.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "components/safe_browsing/content/renderer/phishing_classifier/features.h"
#include "components/safe_browsing/content/renderer/phishing_classifier/murmurhash3_util.h"
#include "crypto/sha2.h"

namespace safe_browsing {

// This time should be short enough that it doesn't noticeably disrupt the
// user's interaction with the page.
const int PhishingTermFeatureExtractor::kMaxTimePerChunkMs =;

// Experimenting shows that we get a reasonable gain in performance by
// increasing this up to around 10, but there's not much benefit in
// increasing it past that.
const int PhishingTermFeatureExtractor::kClockCheckGranularity =;

// This should be longer than we expect feature extraction to take on any
// actual phishing page.
const int PhishingTermFeatureExtractor::kMaxTotalTimeMs =;

// All of the state pertaining to the current feature extraction.
struct PhishingTermFeatureExtractor::ExtractionState {};

PhishingTermFeatureExtractor::PhishingTermFeatureExtractor(
    base::RepeatingCallback<bool(const std::string&)> find_page_term_callback,
    base::RepeatingCallback<bool(uint32_t)> find_page_word_callback,
    size_t max_words_per_term,
    uint32_t murmurhash3_seed,
    size_t max_shingles_per_page,
    size_t shingle_size)
    :{}

PhishingTermFeatureExtractor::~PhishingTermFeatureExtractor() {}

void PhishingTermFeatureExtractor::ExtractFeatures(
    const std::u16string* page_text,
    FeatureMap* features,
    std::set<uint32_t>* shingle_hashes,
    DoneCallback done_callback) {}

void PhishingTermFeatureExtractor::CancelPendingExtraction() {}

void PhishingTermFeatureExtractor::ExtractFeaturesWithTimeout() {}

void PhishingTermFeatureExtractor::HandleWord(std::u16string_view word) {}

void PhishingTermFeatureExtractor::RunCallback(bool success) {}

void PhishingTermFeatureExtractor::Clear() {}

}  // namespace safe_browsing