chromium/third_party/blink/public/mojom/prerender/prerender.mojom

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

module blink.mojom;

import "third_party/blink/public/mojom/loader/referrer.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "url/mojom/url.mojom";

enum PrerenderTriggerType {
  // https://html.spec.whatwg.org/C/#link-type-prerender
  kLinkRelPrerender,

  // https://html.spec.whatwg.org/C/#link-type-next
  kLinkRelNext,
};

struct PrerenderAttributes {
  url.mojom.Url url;
  PrerenderTriggerType trigger_type;
  blink.mojom.Referrer referrer;
  gfx.mojom.Size view_size;
};

// This interface is used to request NoStatePrefetch from a renderer process to
// the browser process. This is created per prerender request, for example, when
// a new <link rel=prerender> element is added, when the element's href is
// changed, etc.
interface NoStatePrefetchProcessor {
  // Requests the browesr process to start prefetching with
  // |prerender_attribute|. This must be called only one time before any other
  // functions.
  Start(PrerenderAttributes prerender_attribute);

  // Cancels the ongoing prefetching. This is supposed to be called when the
  // <link rel=prerender> element is removed, the element's href is changed,
  // etc. This must be called after Start().
  Cancel();
};