chromium/components/feed/core/proto/v2/ui.proto

// Copyright 2020 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 feedui;

option optimize_for = LITE_RUNTIME;

option java_package = "org.chromium.components.feed.proto";
option java_outer_classname = "FeedUiProto";

// This is a simplified and complete set of protos that define UI.
// It includes everything from search.now.ui needed in the UI, and excludes
// other data to reduce complexity. These proto messages should be constructible
// from the store protos.

// A stream is a list of chunks in order.
// Each StreamUpdate contains the full list of chunks,
// but subsequent StreamUpdates after the first may refer to
// chunks previously received by chunk_id.
message StreamUpdate {
  // Either a reference to an existing slice, or a new slice.
  message SliceUpdate {
    oneof update {
      Slice slice = 1;
      string slice_id = 2;
    }
  }
  // One entry for each slice in the stream, in the order they should be
  // presented. Existing slices not present in updated_slices should be dropped.
  repeated SliceUpdate updated_slices = 1;
  // Additional shared states to be used. Usually just one, and sent only on the
  // first update.
  repeated SharedState new_shared_states = 2;
  // Time of the last full server fetch. Populated only after the stream data is
  // loaded. Not updated on NextPage requests.
  int64 fetch_time_ms = 3;
  // Logging parameters to be associated with updated_slices.
  LoggingParameters logging_parameters = 4;
}

message LoggingParameters {
  // Either email or session_id should be set to enable activity logging.

  // The session ID is for signed out users.
  string session_id = 1;
  string email = 2;

  // A client ID used for reliability logging.
  string client_instance_id = 3;

  // Whether attention / interaction logging is enabled.
  bool logging_enabled = 4;
  // Whether view actions may be recorded.
  bool view_actions_enabled = 5;
  // The EventID of the first page response. Must be present for attention
  // logging.
  bytes root_event_id = 6;
}

// A horizontal slice of UI to be presented in the vertical-scrolling feed.
message Slice {
  // Deprecated slice metadata
  reserved 5;

  oneof SliceData {
    XSurfaceSlice xsurface_slice = 1;
    ZeroStateSlice zero_state_slice = 3;
    LoadingSpinnerSlice loading_spinner_slice = 4;
  }
  string slice_id = 2;
}

// This slice is sent when no feed data can be loaded.
message ZeroStateSlice {
  enum Type {
    UNKNOWN = 0;
    // A generic error that explains there are no cards available.
    NO_CARDS_AVAILABLE = 1;
    // An error indicating there were problems refreshing the feed.
    CANT_REFRESH = 2;
    // There is no content because there are no web feed subscriptions.
    NO_WEB_FEED_SUBSCRIPTIONS = 3;
  };
  Type type = 1;
}

// An indicator that the feed is loading.
message LoadingSpinnerSlice {
  // True if the spinner is at the top of the feed. Otherwise, it is at the
  // bottom.
  bool is_at_top = 1;
}

message XSurfaceSlice {
  bytes xsurface_frame = 1;
}

// Wraps an XSurface shared state with a unique ID.
message SharedState {
  string id = 1;
  bytes xsurface_shared_state = 2;
}