Commit 91ad1316 authored by Ian Wells's avatar Ian Wells Committed by Commit Bot

Feed refactor: Add v2 store and ui protos

Bug: 1044139
Change-Id: Ia5e9514d197799631d60cfc1c420a7c2436cc451
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2029237
Commit-Queue: Ian Wells <iwells@chromium.org>
Reviewed-by: default avatarDan H <harringtond@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736981}
parent 17b90edd
...@@ -16,6 +16,39 @@ proto_library("proto") { ...@@ -16,6 +16,39 @@ proto_library("proto") {
] ]
} }
proto_library("proto_v2") {
proto_in_dir = "../../../../"
sources = [
"ui/action/feed_action_payload.proto",
"ui/action/ui_feed_action.proto",
"ui/piet/accessibility.proto",
"ui/piet/actions.proto",
"ui/piet/binding_refs.proto",
"ui/piet/elements.proto",
"ui/piet/errors.proto",
"ui/piet/form_fields.proto",
"ui/piet/gradients.proto",
"ui/piet/images.proto",
"ui/piet/log_data.proto",
"ui/piet/media_queries.proto",
"ui/piet/piet.proto",
"ui/piet/piet_android_support.proto",
"ui/piet/rounded_corners.proto",
"ui/piet/shadows.proto",
"ui/piet/styles.proto",
"ui/piet/text.proto",
"ui/stream/stream_structure.proto",
"v2/store.proto",
"wire/action_payload.proto",
"wire/content_id.proto",
"wire/data_operation.proto",
"wire/feature.proto",
"wire/payload_metadata.proto",
"wire/piet_shared_state_item.proto",
"wire/semantic_properties.proto",
]
}
if (is_android) { if (is_android) {
proto_java_library("proto_java") { proto_java_library("proto_java") {
proto_path = "../../../../" proto_path = "../../../../"
......
// 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 = "proto3";
package feedstore;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/ui/piet/piet.proto";
import "components/feed/core/proto/ui/action/ui_feed_action.proto";
import "components/feed/core/proto/ui/stream/stream_structure.proto";
import "components/feed/core/proto/wire/action_payload.proto";
import "components/feed/core/proto/wire/content_id.proto";
import "components/feed/core/proto/wire/piet_shared_state_item.proto";
import "components/feed/core/proto/wire/semantic_properties.proto";
// Actual data stored by the client.
// This data is sourced from the wire protocol, which is converted upon receipt.
// This would replace both Journal and Content stores.
//
// This is the 'value' in the key/value store.
// Keys are defined as:
// 'root' -> stream_data
// 'c:<id>' -> cluster
// 'la:<id>' -> local_action
// 'ua:<id>' -> uploadable_action
// 'ss:<id>' -> shared_state
message Record {
oneof data {
Cluster cluster = 1;
StreamData stream_data = 2;
StreamLocalAction local_action = 3;
StreamUploadableAction uploadable_action = 4;
StreamSharedState shared_state = 5;
}
}
// Data about the Feed stream. There is at most one instance of StreamData.
message StreamData {
// Root ContentId, as provided by the server.
components.feed.core.proto.wire.ContentId content_id = 1;
// Token used to request a 'more' request to the server.
bytes next_page_token = 2;
// Token used to read or write to the same storage.
bytes consistency_token = 3;
// The unix timestamp in milliseconds that the most recent content was added.
int64 last_added_time_millis = 4;
// List of all clusters, in order they would be shown in the stream.
repeated components.feed.core.proto.wire.ContentId cluster_ids = 5;
// List of all stale clusters. Stale clusters can be removed when no session
// references them.
repeated components.feed.core.proto.wire.ContentId stale_cluster_ids = 6;
}
message Cluster {
components.feed.core.proto.wire.ContentId content_id = 1;
components.feed.core.proto.wire.SemanticProperties semantic_properties = 2;
repeated Card cards = 3;
}
message Card {
components.feed.core.proto.wire.ContentId card_id = 1;
components.feed.core.proto.wire.SemanticProperties semantic_properties = 2;
// This may not be present if Card is part of a DataOperation.
Content content = 3;
// All actions bound to this card or content.
repeated components.feed.core.proto.ui.action.FeedActionMetadata actions = 4;
}
message RepresentationData {
// URI (usually a URL) of what the content links to
string uri = 1;
// Unix timestamp (seconds) when content was published
int64 published_time_seconds = 2;
}
message Content {
// The parent Card's ContentId.
components.feed.core.proto.wire.ContentId content_id = 1;
components.feed.core.proto.wire.SemanticProperties semantic_properties = 2;
enum ContentType {
UNKNOWN_CONTENT = 0;
PIET = 1;
}
ContentType content_type = 3;
PietContent piet_content = 4;
// Score given by server.
float score = 5;
// Unix timestamp (seconds) that content was received by Chrome.
int64 availability_time_seconds = 6;
RepresentationData representation_data = 7;
components.feed.core.proto.ui.stream.OfflineMetadata offline_metadata = 8;
components.feed.core.proto.ui.action.FeedActionMetadata swipe_action = 9;
}
// Content which is able to show a Piet frame. This includes any data which may
// be needed to show a Piet frame.
message PietContent {
// Content Ids of Piet Shared States which should be provided to Piet in order
// to show its content.
repeated components.feed.core.proto.wire.ContentId piet_shared_states = 1;
// The Piet frame to render. This is the same frame as sent over the wire,
// except the action extensions have been replaced by ui.Action.
components.feed.core.proto.ui.piet.Frame frame = 2;
}
// This represents a shared state item.
message StreamSharedState {
components.feed.core.proto.wire.ContentId content_id = 1;
components.feed.core.proto.wire.PietSharedStateItem piet_shared_state_item =
2;
}
// An action that should be eventually uploaded, unless it is undone.
message StreamLocalAction {
enum Type {
UNKNOWN = 0;
DISMISS = 1;
}
Type action = 1;
components.feed.core.proto.wire.ContentId feature_content_id = 2;
// When the action was recorded
int64 timestamp_seconds = 3;
}
// An action ready to be uploaded.
message StreamUploadableAction {
components.feed.core.proto.wire.ContentId feature_content_id = 1;
// The number of time this action was attempted to be recorded
int32 upload_attempts = 2;
// Unix timestamp (seconds) when the action was recorded
int64 timestamp_seconds = 3;
components.feed.core.proto.wire.ActionPayload payload = 4;
}
// 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 = "proto3";
package feedui;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/ui/piet/piet.proto";
// 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 cards in order.
// Each StreamUpdate contains the full list of cards,
// but subsequent StreamUpdates after the first may refer to
// cards previously received by card_id.
message StreamUpdate {
// Either a reference to an existing card, or a new card.
message CardUpdate {
oneof update {
Card card = 1;
string card_id = 2;
}
}
// One entry for each card in the stream, in the order they should be
// presented. Existing cards not present in updated_cards should be dropped.
repeated CardUpdate updated_cards = 1;
repeated SharedState new_shared_states = 2;
// True if all cards are already shown. The 'more' button will be
// hidden if this is true.
bool no_more_cards = 3;
}
// A card rendered with Piet.
message Card {
// An opaque unique ID.
string card_id = 1;
repeated string piet_shared_state_ids = 2;
// The piet frame. The frame contains Action messages through an
// extension of search.now.ui.piet.Action.
components.feed.core.proto.ui.piet.Frame frame = 3;
bool can_swipe = 4;
bool can_tap = 5;
// And other action availability...
// True if the card is stale. Stale cards shouldn't be shown unless the user
// has already seen it on the same surface.
bool is_stale = 6;
}
// Wraps a piet shared state with a unique ID.
message SharedState {
string id = 1;
components.feed.core.proto.ui.piet.PietSharedState piet_shared_state = 2;
}
// Piet attaches actions to many things: entities, frames, text, etc...,
// and uses one Action for each user-action: tap, swipe, long-press, etc...
// We can swap out PietFeedActionPayload for the 'Action' message below
// before sending the protos over to java.
// See ui_extension.proto. This message extends ui.piet.Action.
message Action {
// Always sent to C++ when action is triggered.
string action_id = 1;
// The following fields are only necessary for a subset of action types that
// have an effect on the feed UI.
oneof extra_data {
// Present if this is a context menu action.
ContextMenu context_menu = 2;
// Present if this is a tooltip action.
TooltipData tooltip = 3;
}
// Present if the action can be undone.
UndoAction undo = 4;
// If not empty, this is the card dismissed by this action.
// Used when undo is present, so that the UI can hide the dismissed card
// before the dismiss is committed.
string dismiss_card_id = 5;
}
message ContextMenuEntry {
string label = 1;
int32 id = 2;
}
message ContextMenu {
repeated ContextMenuEntry entries = 1;
}
// These messages didn't change from now.ui.action.
message UndoAction {
// The string shown to the user that confirms the action was just taken.
string confirmation_label = 1;
// The string that labels that option to reverse the action. Defaults to
// "Undo" if not set.
string undo_label = 2;
}
message TooltipData {
message Insets {
int32 top = 1;
int32 bottom = 2;
}
enum FeatureName {
// No tooltip will render if the FeatureName is UNKNOWN.
UNKNOWN = 0;
CARD_MENU = 1;
}
string label = 1;
string accessibility_label = 2;
FeatureName feature_name = 3;
// The information for where to offset the arrow from the referenced view.
Insets insets = 4;
}
// An event on the UI.
message UiEvent {
enum Type {
UNKNOWN = 0;
CARD_TAPPED = 1;
CARD_VIEWED = 2;
CARD_SWIPED = 3;
MORE_BUTTON_VIEWED = 4;
MORE_BUTTON_CLICKED = 5;
SPINNER_STARTED = 6;
SPINNER_FINISHED = 7;
SPINNER_DESTROYED_WITHOUT_COMPLETING = 8;
PIET_FRAME_RENDERING_EVENT = 9;
SCROLL_STREAM = 10;
}
enum SpinnerType {
UNKNOWN_SPINNER_TYPE = 0;
// Spinner shown on initial load of the Feed.
INITIAL_LOAD = 1;
// Spinner shown when Feed is refreshed.
ZERO_STATE_REFRESH = 2;
// Spinner shown when more button is clicked.
MORE_BUTTON = 3;
// Spinner shown when a synthetic token is consumed.
SYNTHETIC_TOKEN = 4;
// Spinner shown when a spinner is shown for loading the infinite feed.
INFINITE_FEED = 5;
}
// For CARD_* type events.
string card_id = 1;
// For MORE_BUTTON_* type events.
int32 more_button_position = 2;
// For SPINNER_* type events.
SpinnerType spinner_type = 3;
// For SPINNER_FINISHED and SPINNER_DESTROYED_WITHOUT_COMPLETING.
int32 spinner_time_shown = 4;
// For PIET_FRAME_RENDERING_EVENT.
repeated int32 piet_error_codes = 5;
// For SCROLL_STREAM.
int32 scroll_distance = 6;
}
// 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";
package feedui;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/ui/piet/actions.proto";
import "components/feed/core/proto/v2/ui.proto";
message ActionExtension {
extend components.feed.core.proto.ui.piet.Action {
optional feedui.Action chrome_ui_action_extension = 100002;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment