summaryrefslogtreecommitdiff
path: root/chromium/content/browser/preloading/preloading.h
blob: 39515b05eb48075247889a1493a1ce73f850d311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_PRELOADING_PRELOADING_H_
#define CONTENT_BROWSER_PRELOADING_PRELOADING_H_

#include "content/public/browser/preloading.h"

#include "content/common/content_export.h"

namespace content {

// Defines various //content triggering mechanisms which trigger different
// preloading operations mentioned in content/public/browser/preloading.h.

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class ContentPreloadingPredictor {
  // Numbering starts from `kPreloadingPredictorContentStart` defined in
  // //content/public/preloading.h. Advance numbering by +1 after adding a new
  // element.

  // This API allows an origin to list possible navigation URLs that the user
  // might navigate to in order to perform preloading operations.
  // For more details please see:
  // https://wicg.github.io/nav-speculation/prerendering.html#speculation-rules
  kSpeculationRules =
      static_cast<int>(PreloadingPredictor::kPreloadingPredictorContentStart),

  // TODO(crbug.com/1309934): Add more predictors as we integrate Preloading
  // logging.
};

// Helper method to convert ContentPreloadingPredictor to
// content::PreloadingPredictor to avoid casting.
PreloadingPredictor CONTENT_EXPORT
ToPreloadingPredictor(ContentPreloadingPredictor predictor);

}  // namespace content

#endif  // CONTENT_BROWSER_PRELOADING_PRELOADING_H_