chromium/ios/web/public/session/proto/navigation.proto

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

syntax = "proto3";
package web.proto;

option optimize_for = LITE_RUNTIME;

import "ios/web/public/session/proto/common.proto";

// The referrer policy.
enum ReferrerPolicy {
  Always = 0;
  Default = 1;
  NoReferrerWhenDowngrade = 2;
  Never = 3;
  Origin = 4;
  OriginWhenCrossOrigin = 5;
  SameOrigin = 6;
  StrictOrigin = 7;
  StrictOriginWhenCrossOrigin = 8;
}

// Represents a referrer.
//
// All the fields are required.
message ReferrerStorage {
  string url = 1;
  ReferrerPolicy policy = 2;
}

// Represents an HTTP header as a key-value pair.
//
// All the fields are required.
message HttpHeaderStorage {
  string name = 1;
  string value = 2;
}

// Represents the HTTP headers for a page.
//
// All the fields are required.
message HttpHeaderListStorage {
  repeated HttpHeaderStorage headers = 1;
}

// Represents single navigation item.
//
// The referrer, display_state and http_request_headers are optional, the
// other fields are required.
message NavigationItemStorage {
  string url = 1;
  string virtual_url = 2;
  string title = 3;
  Timestamp timestamp = 4;
  UserAgentType user_agent = 5;
  ReferrerStorage referrer = 6;
  HttpHeaderListStorage http_request_headers = 7;
}

// Represents the navigation history for a WebState, including the index of the
// last committed item(which has to be a valid index in items, or -1 if there is
// no last committed item or items is empty).
//
// All the fields are required.
message NavigationStorage {
  int32 last_committed_item_index = 1;
  repeated NavigationItemStorage items = 2;
}