chromium/chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_service.h

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

#ifndef CHROME_BROWSER_PRELOADING_PREFETCH_SEARCH_PREFETCH_SEARCH_PREFETCH_SERVICE_H_
#define CHROME_BROWSER_PRELOADING_PREFETCH_SEARCH_PREFETCH_SEARCH_PREFETCH_SERVICE_H_

#include <map>
#include <memory>
#include <optional>
#include <utility>

#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_request.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_url_loader.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/omnibox.mojom-shared.h"
#include "components/search_engines/template_url_data.h"
#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_service_observer.h"
#include "content/public/browser/preloading.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "url/gurl.h"

struct AutocompleteMatch;
struct OmniboxLog;
class PrefRegistrySimple;
class Profile;
class AutocompleteResult;

namespace content {
class WebContents;
}

namespace network {
struct ResourceRequest;
}

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// Any updates to this class need to be propagated to enums.xml.
// This enum is used for UMA only. For recording a UKM PreloadingAttempt record,
// use or introduce a corresponding enum to content::PreloadingEligibility or
// ChromePreloadingEligibility.
//
// LINT.IfChange
enum class SearchPrefetchEligibilityReason {};
// LINT.ThenChange(/tools/metrics/histograms/enums.xml:SearchPrefetchEligibilityReason)

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// Any updates to this class need to be propagated to enums.xml.
//
// If you change this, please follow the process in
// go/preloading-dashboard-updates to update the mapping reflected in dashboard,
// or if you are not a Googler, please file an FYI bug on https://crbug.new with
// component Internals>Preload.
//
// LINT.IfChange
enum class SearchPrefetchServingReason {};
// LINT.ThenChange()

class SearchPrefetchService : public KeyedService,
                              public TemplateURLServiceObserver {};

#endif  // CHROME_BROWSER_PRELOADING_PREFETCH_SEARCH_PREFETCH_SEARCH_PREFETCH_SERVICE_H_