chromium/components/paint_preview/common/proto/paint_preview.proto

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

syntax = "proto2";

package paint_preview;

option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.paint_preview.common.proto";

// Any fields annotated with "// required" are enforced as if they are
// required by paint_preview::PaintPreviewProtoValid().

// A proto representation of a gfx::Rect.
// NEXT_TAG = 5
message RectProto {
  // required
  optional int64 x = 1;
  // required
  optional int64 y = 2;
  // required
  optional int64 width = 3;
  // required
  optional int64 height = 4;
}

// A link represented by its absolute URL and a bounding box for the hit area.
// NEXT_TAG = 3
message LinkDataProto {
  // required
  optional RectProto rect = 1;
  // required
  optional string url = 2;
}

// A mapping from a content ID to the serialized embedding token.
// NEXT_TAG = 4
message ContentIdEmbeddingTokenPairProto {
  // required
  optional uint32 content_id = 1;
  // required
  optional uint64 embedding_token_low = 2;
  // required
  optional uint64 embedding_token_high = 3;
}

// A paint preview of a single frame.
// NEXT_TAG = 11
message PaintPreviewFrameProto {
  // The embedding token for this frame to its parent. Every frame other than
  // the main frame should have a non-zero value here.
  // required
  optional uint64 embedding_token_low = 1;
  // required
  optional uint64 embedding_token_high = 2;

  // Boolean indicating if the frame is the main frame.
  // required
  optional bool is_main_frame = 3;

  // The file path to the serialized Skia Picture.
  // null if the persistence type of the |PaintPreviewCaptureParams| is
  // |RecordingPersistence::MemoryBuffer|.
  optional string file_path = 4;

  // A list of links within the frame.
  repeated LinkDataProto links = 5;

  // A mapping between the content IDs of subframes and the |id| field.
  repeated ContentIdEmbeddingTokenPairProto content_id_to_embedding_tokens = 6;

  // Position information for this frame.
  optional uint32 scroll_offset_x = 7;
  optional uint32 scroll_offset_y = 8;

  // Position information for this frame if it is clipped.
  optional uint32 frame_offset_x = 9;
  optional uint32 frame_offset_y = 10;
}

// Stores Chrome version.
// NEXT_TAG = 5
message ChromeVersionProto {
  optional uint64 major = 1;
  optional uint64 minor = 2;
  optional uint64 build = 3;
  optional uint64 patch = 4;
}

// Metadata for the capture.
// NEXT_TAG = 5
message MetadataProto {
  // URL of the root frame.
  // required
  optional string url = 1;

  // Records the version number of the recording. Should be incremented if there
  // is a breaking change to the custorm SkPicture deserialization or storage
  // system.
  optional uint64 version = 2;

  // Records the version of Chrome when the capture occurred.
  optional ChromeVersionProto chrome_version = 3;

  // Records the page scale factor of the page when it was captured.
  optional float page_scale_factor = 4;
}

// A paint preview of the entire page.
// NEXT_TAG = 4
message PaintPreviewProto {
  // The root frame of the RenderFrame tree. This is often the main frame, but
  // may be a root node of a subtree (e.g. paint preview of an iframe).
  // required
  optional PaintPreviewFrameProto root_frame = 1;
  repeated PaintPreviewFrameProto subframes = 2;
  // required
  optional MetadataProto metadata = 3;
}