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

syntax = "proto2";

option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.optimization_guide.proto";
option java_outer_classname = "LoadingPredictorMetadataProto";

package optimization_guide.proto;

// The possible resource type values.
enum ResourceType {
  RESOURCE_TYPE_UNKNOWN = 0;
  // A CSS Stylesheet, maps to ResourceType::kStylesheet in the Chromium
  // repository.
  RESOURCE_TYPE_CSS = 1;
  // An external script, maps to ResourceType::kScript in the Chromium
  // repository.
  RESOURCE_TYPE_SCRIPT = 2;
}

// Metadata about a subresource present on a page.
message Resource {
  // The full URL of the resource.
  optional string url = 1;
  // The resource type of the resource.
  optional ResourceType resource_type = 2;
}

// Optimization metadata associated with improving the loading predictor.
//
// It is only populated for the LOADING_PREDICTOR optimization type.
message LoadingPredictorMetadata {
  // A set of subresources that are expected to be present, ordered roughly by
  // priority.
  //
  // It is expected for the client to either preconnect to the subresource hosts
  // or prefetch the subresources directly.
  repeated Resource subresources = 1;
}
