Commit 6e8fbdae authored by Dan Harrington's avatar Dan Harrington Committed by Commit Bot

Add new wire protos for Feed v2

Bug: 1044139
Change-Id: I2a9e1c0fa87ff6525437a44a30bf0d1c7cf1a8e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095469
Commit-Queue: Dan H <harringtond@chromium.org>
Reviewed-by: default avatarIan Wells <iwells@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748851}
parent 20969fb6
......@@ -19,52 +19,37 @@ 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/action_payload_for_test.proto",
"wire/action_request.proto",
"wire/action_type.proto",
"wire/capability.proto",
"wire/client_info.proto",
"wire/consistency_token.proto",
"wire/content_id.proto",
"wire/data_operation.proto",
"wire/display_info.proto",
"wire/feature.proto",
"wire/feed_action.proto",
"wire/feed_action_query_data.proto",
"wire/feed_action_request.proto",
"wire/feed_action_response.proto",
"wire/feed_query.proto",
"wire/feed_request.proto",
"wire/feed_response.proto",
"wire/mockserver/mock_server.proto",
"wire/payload_metadata.proto",
"wire/piet_shared_state_item.proto",
"wire/request.proto",
"wire/response.proto",
"wire/semantic_properties.proto",
"wire/token.proto",
"wire/version.proto",
"v2/wire/action_payload.proto",
"v2/wire/action_request.proto",
"v2/wire/action_response.proto",
"v2/wire/capability.proto",
"v2/wire/client_info.proto",
"v2/wire/consistency_token.proto",
"v2/wire/content_id.proto",
"v2/wire/data_operation.proto",
"v2/wire/display_info.proto",
"v2/wire/duration.proto",
"v2/wire/expiration_info.proto",
"v2/wire/feature.proto",
"v2/wire/feed_action.proto",
"v2/wire/feed_action_request.proto",
"v2/wire/feed_action_response.proto",
"v2/wire/feed_id.proto",
"v2/wire/feed_query.proto",
"v2/wire/feed_request.proto",
"v2/wire/feed_response.proto",
"v2/wire/in_place_update_handle.proto",
"v2/wire/next_page_token.proto",
"v2/wire/payload_metadata.proto",
"v2/wire/render_data.proto",
"v2/wire/request.proto",
"v2/wire/response.proto",
"v2/wire/response_status_code.proto",
"v2/wire/stream_structure.proto",
"v2/wire/templates.proto",
"v2/wire/token.proto",
"v2/wire/version.proto",
]
}
......
......@@ -72,7 +72,7 @@ message StreamSharedState {
optional string content_id = 1;
oneof share_state {
// A Piet shared state item.
feedwire.PietSharedStateItem piet_shared_state_item = 2;
feedwire1.PietSharedStateItem piet_shared_state_item = 2;
}
}
......@@ -156,7 +156,7 @@ message StreamPayload {
// The consistency token used to ensure that we are recording actions to
// the same server store.
feedwire.ConsistencyToken consistency_token = 9;
feedwire1.ConsistencyToken consistency_token = 9;
}
reserved 8;
}
......@@ -227,7 +227,7 @@ message StreamUploadableAction {
// When the action was recorded
optional int64 timestamp_seconds = 4;
optional feedwire.ActionPayload payload = 6;
optional feedwire1.ActionPayload payload = 6;
reserved 1, 5; // deprecated fields
}
......
......@@ -106,9 +106,9 @@ message OpenUrlData {
// latest frequency token as the value of this query param.
optional string consistency_token_query_param_name = 2;
// The content ID that was interacted with to cause a URL open.
optional feedwire.ContentId content_id = 3;
optional feedwire1.ContentId content_id = 3;
// Roundtripped server data on a per-action level.
optional feedwire.ActionPayload payload = 4;
optional feedwire1.ActionPayload payload = 4;
}
// Data needed by Stream to open a context menu.
......@@ -121,19 +121,19 @@ message DismissData {
// The ContentId needed by the server to suppress reshowing the dismissed
// content. This will usually be the ContentId of the card which holds the
// content, not the ContentId of the content itself.
optional feedwire.ContentId content_id = 1;
optional feedwire1.ContentId content_id = 1;
// The DataOperations which are needed to actually perform the dismiss on the
// client. This is typically a singleton list of a remove operation on the
// Cluster that the content belongs to.
repeated feedwire.DataOperation data_operations = 2;
repeated feedwire1.DataOperation data_operations = 2;
// Data used by the client to show a confirmation message with option to undo.
// This confirmation and undo option will only appear if the UndoAction is
// present and the client can handle this capability.
optional UndoAction undo_action = 3;
// Roundtripped server data on a per-action level.
optional feedwire.ActionPayload payload = 4;
optional feedwire1.ActionPayload payload = 4;
}
// Data needed by the client to handle the not interested action.
......@@ -143,9 +143,9 @@ message NotInterestedInData {
// present and the client can handle this capability.
optional UndoAction undo_action = 1;
// The data needed by Stream to preform the dismiss.
repeated feedwire.DataOperation data_operations = 2;
repeated feedwire1.DataOperation data_operations = 2;
// Roundtripped server data on a per-action level.
optional feedwire.ActionPayload payload = 3;
optional feedwire1.ActionPayload payload = 3;
enum RecordedInterestType {
UNKNOWN_INTEREST_TYPE = 0;
TOPIC = 1;
......
......@@ -19,7 +19,7 @@ option cc_enable_arenas = true;
// Top level feature which shows a stream of cards. Provides any UI information
// which may be needed in order to render the stream of cards.
message Stream {
extend feedwire.Feature { optional Stream stream_extension = 185431437; }
extend feedwire1.Feature { optional Stream stream_extension = 185431437; }
// Empty for now as don't support any custom information.
}
......@@ -27,7 +27,7 @@ message Stream {
// Feature which represents a cluster in a Stream. May have a Card or Content
// as children.
message Cluster {
extend feedwire.Feature { optional Cluster cluster_extension = 190812910; }
extend feedwire1.Feature { optional Cluster cluster_extension = 190812910; }
// Empty for now as we don't support any custom information.
}
......@@ -35,7 +35,7 @@ message Cluster {
// Experimental feature which represents a carousel in a Stream. May have a list
// of Cards or Content as children.
message Carousel {
extend feedwire.Feature { optional Carousel carousel_extension = 244251946; }
extend feedwire1.Feature { optional Carousel carousel_extension = 244251946; }
// Please use CL numbers you own for extension numbers.
extensions 10000 to max;
......@@ -44,7 +44,7 @@ message Carousel {
// Feature which represents a full card in a Stream. Allows metadata to be sent
// to describe how to render the card.
message Card {
extend feedwire.Feature { optional Card card_extension = 185431438; }
extend feedwire1.Feature { optional Card card_extension = 185431438; }
// Please use CL numbers you own for extension numbers.
extensions 10000 to max;
......@@ -90,7 +90,7 @@ message OfflineMetadata {
// inside or outside a card. Actual data on what to display will be sent on an
// extension.
message Content {
extend feedwire.Feature { optional Content content_extension = 185431439; }
extend feedwire1.Feature { optional Content content_extension = 185431439; }
enum Type {
UNKNOWN_CONTENT = 0;
......@@ -112,7 +112,7 @@ message PietContent {
// Content Ids of Piet Shared States which should be provided to Piet in order
// to show its content.
repeated feedwire.ContentId piet_shared_states = 1;
repeated feedwire1.ContentId piet_shared_states = 1;
// The Piet frame to render.
optional components.feed.core.proto.ui.piet.Frame frame = 2;
......
......@@ -6,9 +6,8 @@ syntax = "proto3";
package feedstore;
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/content_id.proto";
import "components/feed/core/proto/v2/wire/content_id.proto";
import "components/feed/core/proto/v2/wire/feed_action.proto";
option optimize_for = LITE_RUNTIME;
......@@ -111,7 +110,24 @@ message ContentInfo {
// Unix timestamp (seconds) that content was received by Chrome.
int64 availability_time_seconds = 2;
RepresentationData representation_data = 3;
components.feed.core.proto.ui.stream.OfflineMetadata offline_metadata = 4;
OfflineMetadata offline_metadata = 4;
}
message OfflineMetadata {
// Title of the content.
string title = 1;
// Url for image for the content.
string image_url = 2;
// Publisher of the content.
string publisher = 3;
// Url for the favicon for the content.
string favicon_url = 4;
// Short string from the content, typically the start of an article.
string snippet = 5;
}
message Content {
......@@ -136,7 +152,7 @@ message StoredAction {
// How many times we have tried to upload the action.
int32 upload_attempt_count = 2;
// The action to upload.
components.feed.core.proto.ui.action.FeedAction action = 3;
feedwire.FeedAction action = 3;
}
// The internal version of the server response. Includes feature tree and
......
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// The data needed by the server to handle action recording. This information is
// opaque to the client and will be the information that is round-tripped so the
// server can properly handle the action. For the Not Interested In action, this
// data will contain the ids needed to record that the user is not interested
// in that particular topic or source.
// NOTE: it is important to keep this to a bare minimum amount of data.
message ActionPayload {
// Reserved fields for renderable unit extensions
// Please use CL numbers you own for extension numbers.
extensions 257605906; // ActionPayloadData
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Top level request message.
message ActionRequest {
// Supported versions of request messages are specified as extensions to
// the top-level request message. An enum is used to denote the expected
// extensions for this request.
enum RequestVersion {
UNKNOWN_ACTION_REQUEST_VERSION = 0;
FEED_UPLOAD_ACTION = 1;
}
optional RequestVersion request_version = 1;
extensions 1000; // FeedActionRequest
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Top level response message.
message ActionResponse {
// Supported versions of response messages are specified as extensions to
// the top-level response message. An enum is used to denote the expected
// extensions for this response.
enum ResponseVersion {
UNKNOWN_ACTION_RESPONSE_VERSION = 0;
FEED_UPLOAD_ACTION_RESPONSE = 1;
}
optional ResponseVersion response_version = 1;
extensions 1000; // FeedActionResponse
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Feature capability of either the client or the server.
// Next ID: 20
enum Capability {
UNKNOWN_CAPABILITY = 0;
// The client is capable of a basic UI.
BASE_UI = 1;
INFINITE_FEED = 5;
// Enable Dismiss command
DISMISS_COMMAND = 9;
// Enable Undo in Dismiss
UNDO_FOR_DISMISS_COMMAND = 10;
REDACTED_11 = 11;
// The client is only considered capable of supporting a minimal heirloomed
// feed.
HEIRLOOMED_FEED = 13;
// The client is capable of supporting sports features.
SPORTS_FEATURE = 14;
// The client is capable of supporting ads content.
PAID_CONTENT = 15;
// Enable open video command.
OPEN_VIDEO_COMMAND = 16;
REDACTED_17 = 17;
// Enable inline video autoplay.
INLINE_VIDEO_AUTOPLAY = 18;
// Enable the card menu.
CARD_MENU = 19;
reserved 2 to 4, 6 to 8, 12;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/display_info.proto";
import "components/feed/core/proto/v2/wire/version.proto";
// Information about the client performing the request similar to a user-agent
// string in HTTP.
// Next ID: 10.
message ClientInfo {
enum PlatformType {
UNKNOWN_PLATFORM = 0;
ANDROID_ID = 1; // ANDROID collides with a C++ preprocessor macro.
IOS = 2;
}
enum AppType { CHROME = 3; }
// The type of OS that the client is running.
optional PlatformType platform_type = 1;
// The version of the OS that the client is running.
optional Version platform_version = 2;
// The type of client app.
optional AppType app_type = 3;
// The version of the client app.
optional Version app_version = 4;
// A string identifying the language and region preferences of the client.
// Follows the BCP 47 format such as "en-US" or "fr-CA"
optional string locale = 5;
// The information about the screen of the client. This is repeated because
// there are some devices that might have multiple display screens.
// (Ex fold-able phones)
repeated DisplayInfo display_info = 6;
// Identifier of the user's device. For Android devices, contains a hash of
// the gaia email and android_id, which uniquely identifies the device for
// the user. Currently set by Android clients version 4.1 and later.
optional string client_instance_id = 7;
// An Android device level identifier used for advertising, required for
// conversion tracking, see more at:
// https://support.google.com/googleplay/android-developer/answer/6048248
optional string advertising_id = 8;
// Two-letter country code as detected by the device. On Android devices,
// this comes from GServices check-in which uses the SIM card MCC (mobile
// country code), with fallback to IP geo lookup.
optional string device_country = 9;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// A consistency token.
message ConsistencyToken {
// Indicates the min version of storage to read from.
optional bytes token = 1;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// An identifier for a piece of content served by Now or delivered to the Now
// client(s).
// See [INTERNAL LINK] for the design of this feature.
// ContentId comprises a unique key for all content. The client will never have
// more than one piece of content with the same ContentID.
message ContentId {
optional string content_domain = 1;
// The type of content this represents. Generally, this is somewhat redundant,
// as this ContentId proto will be embedded within a particular parent proto
// that implies its type. It is repeated here for the purpose of making
// ContentId fully self-contained, able to completely specify a piece of
// content's ID without additional context.
// Since Type is one of the components of content's uniqueness, it is safe
// and reasonable for two related pieces of content with different types
// (e.g. a card and its attached notification) to share the same id and
// content_domain, and to differ only in their type. However, Type is **not**
// included when determing if two ContentIds are equivalent.
enum Type {
// Undefined type - DO NOT USE
TYPE_UNDEFINED = 0;
CARD = 1;
CLUSTER = 3;
// A feature, which is the indivisible unit of Feed content.
FEATURE = 4;
// A ContentId used only for identifying nodes in a tree structure.
TREE_STRUCTURE = 7;
// A ContentId for a collection.
COLLECTION = 8;
// A ContentId for a token, e.g. a NextPage token.
TOKEN = 9;
reserved 2;
}
// The type of content this represents
optional Type type = 2;
optional fixed64 id = 3;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/feature.proto";
import "components/feed/core/proto/v2/wire/in_place_update_handle.proto";
import "components/feed/core/proto/v2/wire/payload_metadata.proto";
import "components/feed/core/proto/v2/wire/render_data.proto";
import "components/feed/core/proto/v2/wire/templates.proto";
import "components/feed/core/proto/v2/wire/token.proto";
// An extensible operation to change the state of data on the client.
message DataOperation {
// Next tag: 8
enum Operation {
UNKNOWN_OPERATION = 0;
// Remove all stored content of all types
CLEAR_ALL = 1;
// Update content if it exists, else append to the bottom of the feed
UPDATE_OR_APPEND = 2;
// Remove the item from the stream
REMOVE = 3;
}
// The operation to perform on the data.
optional Operation operation = 1;
// Data common to all payload types.
optional PayloadMetadata metadata = 2;
// The actual data being supplied.
oneof payload {
// A stream UI level feature such as a cluster or card.
Feature feature = 3;
// A token, capable of making a next page request.
Token next_page_token = 5;
// Information to help render the content in the response.
RenderData render_data = 6;
// A handle for updating one or more pieces of content in place.
InPlaceUpdateHandle in_place_update_handle = 8;
// A collection of templates.
Templates templates = 4 [deprecated = true];
}
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// The information about the client's screen.
// Next id: 4
message DisplayInfo {
// Density of the screen in physical pixels per density independent pixel
// (DIP); see:
// http://developer.android.com/reference/android/util/DisplayMetrics.html#density
optional float screen_density = 1;
// The width of the screen in pixels.
optional uint32 screen_width_in_pixels = 2;
// The height of the screen in pixels.
optional uint32 screen_height_in_pixels = 3;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Copy of third_party/protobuf/src/google/protobuf/duration.proto.
message Duration {
int64 seconds = 1;
int32 nanos = 2;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/duration.proto";
/* Information about whether and when a feature should expire and be removed
* from Discover. */
message ExpirationInfo {
// Whether the feature can expire.
optional bool should_expire = 1;
// Indicates how long after this response was received the client should wait
// before expiring (and hiding) this content. This expiration time is a best
// effort, and should not be done while the content is visible on screen.
// There are no penalties with showing the content after the expiry, though
// some uses of this API (ads in particular) do have SLA's about how often
// items can be shown after expiration.
optional feedwire.Duration expiration_duration = 2;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/content_id.proto";
import "components/feed/core/proto/v2/wire/expiration_info.proto";
// Features define both the structure and content found in the Stream.
message Feature {
// The ContentId identifying the parent feature for this feature.
optional ContentId parent_id = 1;
// Enum denoting which extension containing the renderable data is associated
// with this Feature.
enum RenderableUnit {
UNKNOWN_RENDERABLE_UNIT = 0;
STREAM = 1;
CONTENT = 3;
CLUSTER = 4;
REDACTED_10 = 10;
REDACTED_11 = 11;
reserved 2, 5, 6, 7, 8, 9;
}
optional RenderableUnit renderable_unit = 2;
// Indicates whether this feature should expire, and additional metadata
// necessariy to handle expiration. Note that clients may not support
// expiration of every type of feature.
optional ExpirationInfo expiration_info = 3;
extensions 185431437; // Stream
extensions 185431438; // Card
extensions 185431439; // Content
extensions 190812910; // Cluster
extensions 194964015; // Token
extensions 286406442; // REDACTED
extensions 286406443; // REDACTED
reserved 246375740, 274598443, 274598444, 277068786;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/action_payload.proto";
import "components/feed/core/proto/v2/wire/content_id.proto";
message FeedAction {
// The Id for the content that this action was triggered on.
optional ContentId content_id = 1;
// Additional logging data that is on a per-action level
optional ActionPayload action_payload = 2;
// Client-generated data that pertains to the action.
optional ClientData client_data = 3;
// Next Id: 7
// The data the client provides to the server.
message ClientData {
// When the action was recorded on the client
optional int64 timestamp_seconds = 1;
// A monotonically-increasing sequence number that increments per
// user + device. Used in experiments to measure action loss between client
// and server.
optional int64 sequence_number = 2;
// The duration for the action in milliseconds. In case of view actions this
// is the duration for which the content is considered "viewed".
optional int64 duration_ms = 3;
}
reserved 4, 5, 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/action_request.proto";
import "components/feed/core/proto/v2/wire/consistency_token.proto";
import "components/feed/core/proto/v2/wire/feed_action.proto";
// Request to upload new actions to the Actions Endpoint
message FeedActionRequest {
extend ActionRequest {
optional FeedActionRequest feed_action_request = 1000;
}
// Data related to recordable actions performed on the client.
repeated FeedAction feed_action = 1;
// Token used to write to the same storage.
optional ConsistencyToken consistency_token = 2;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/action_response.proto";
import "components/feed/core/proto/v2/wire/consistency_token.proto";
// A feed action response returns when an action has been successfully uploaded
// to the server.
message FeedActionResponse {
extend ActionResponse {
optional FeedActionResponse feed_action_response = 1000;
}
// Token used to read or write to the same storage.
optional ConsistencyToken consistency_token = 1;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// This proto is used to uniquely identify a Feed of cards.
// The main use case is for the paginated feed, storing multiple
// feeds on the server, and needing to identify them individually.
// It is an empty extension holder because the client should not ever know
// or care what's in the FeedId, and so we can change the definition
// of what a FeedId for the server without worrying about users possibly
// looking into the implementation details.
message FeedId {
extensions 1 to 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/token.proto";
message FeedQuery {
enum RequestReason {
// Bucket for any not listed. Should not be used (prefer adding a new
// request reason)
UNKNOWN_REQUEST_REASON = 0;
// App is manually triggering a request, outside of scheduling a request.
// Should be used rarely.
MANUAL_REFRESH = 1;
// Host wants a request to refresh content.
SCHEDULED_REFRESH = 2;
// Host wants a request to load more content.
NEXT_PAGE_SCROLL = 3;
REDACTED_4 = 4;
// Host wants to update content in place.
IN_PLACE_UPDATE = 5;
}
// The reason the query is being initiated.
optional RequestReason reason = 1;
// A collection of Token messages, wrapped in a message so it can be used in a
// oneof.
message Tokens { repeated Token tokens = 1; }
oneof token {
// The token for requesting the next page of Feed content, to be used with
// reason = NEXT_PAGE_SCROLL.
Token next_page_token = 3;
// Tokens from InPlaceUpdateHandle for content to update in place, if
// reason = IN_PLACE_UPDATE.
Tokens in_place_update_tokens = 5;
}
reserved 2;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/capability.proto";
import "components/feed/core/proto/v2/wire/client_info.proto";
import "components/feed/core/proto/v2/wire/consistency_token.proto";
import "components/feed/core/proto/v2/wire/feed_id.proto";
import "components/feed/core/proto/v2/wire/feed_query.proto";
import "components/feed/core/proto/v2/wire/request.proto";
// Request to fetch new data for the feed
message FeedRequest {
extend Request { optional FeedRequest feed_request = 1000; }
// Information about the client making the request.
optional ClientInfo client_info = 1;
// Query parameters to fetch feed data.
optional FeedQuery feed_query = 2;
// The list of client supported capabilities.
repeated Capability client_capability = 4;
// Token used to read from/write to the same storage.
optional ConsistencyToken consistency_token = 5;
// Created on the server and used by the client to identify the feed when
// clients will store multiple infinite feeds.
// See [INTERNAL LINK]
repeated FeedId feed_ids_to_preserve = 12;
reserved 3, 13;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/capability.proto";
import "components/feed/core/proto/v2/wire/data_operation.proto";
import "components/feed/core/proto/v2/wire/feed_id.proto";
import "components/feed/core/proto/v2/wire/response.proto";
import "components/feed/core/proto/v2/wire/response_status_code.proto";
// A feed response is a series of directives to manipulate backend storage,
// similar to database commands. Individual data operations contain all the
// necessary information to manipulate the client state.
message FeedResponse {
extend Response { optional FeedResponse feed_response = 1000; }
// DataOperations are applied on the client in order in which they are
// received.
repeated DataOperation data_operation = 1;
// Metadata for the entire FeedResponse.
optional FeedResponseMetadata feed_response_metadata = 2;
// The list of server-response supported capabilities.
repeated Capability server_capabilities = 3;
// The status code for this response.
optional ResponseStatusCode response_status_code = 4;
}
// Data which is relevant for the whole response made by the server.
message FeedResponseMetadata {
// Time at which the server fulfilled this response. This is needed as client
// cannot be the source of truth.
optional int64 response_time_ms = 1;
// Created on the server and used by the client to identify the feed when
// clients will store multiple infinite feeds.
// See [INTERNAL LINK]
optional FeedId feed_id = 3;
reserved 2;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/duration.proto";
import "components/feed/core/proto/v2/wire/token.proto";
// InPlaceUpdateHandle is a handle for the client to send to the server in order
// to update content in-place.
message InPlaceUpdateHandle {
// Indicates how long after this response ws received the client should wait
// before sending the token back to the server. It is not an error to send the
// token earlier, but in that case the server may just replace the handle with
// and an updated use_after and the same token.
optional feedwire.Duration use_after = 1;
// Opaque token to use in a request for the server to send updated versions of
// its associated content.
optional Token token = 2;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/token.proto";
message NextPageToken {
extend Token { optional NextPageToken next_page_token_extension = 1002; }
optional bytes next_page_token = 1;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/content_id.proto";
// Metadata common to all payloads in a DataOperation.
message PayloadMetadata {
// The unique identifier of the payload.
optional ContentId content_id = 1;
reserved 2, 3, 4, 5;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Contains data to use during client-side rendering of the response, like
// templates and themes.
message RenderData {
// Enum denoting which extension contains the render data.
enum RenderDataType {
UNKNOWN_RENDER_DATA_TYPE = 0;
XSURFACE = 1;
}
optional RenderDataType render_data_type = 1;
extensions 1000; // ElementsRenderData
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Top level request message.
message Request {
// Supported versions of request messages are specified as extensions to
// the top-level request message. An enum is used to denote the expected
// extensions for this request.
enum RequestVersion {
UNKNOWN_REQUEST_VERSION = 0;
FEED_QUERY = 1;
}
optional RequestVersion request_version = 1;
// Please use CL numbers you own for extension numbers.
extensions 1000; // FeedRequest
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Top level response message.
message Response {
// Supported versions of response messages are specified as extensions to
// the top-level response message. An enum is used to denote the expected
// extensions for this response.
enum ResponseVersion {
UNKNOWN_RESPONSE_VERSION = 0;
FEED_RESPONSE = 1;
}
optional ResponseVersion response_version = 1;
// Please use CL numbers you own for extension numbers.
extensions 1000; // FeedResponse
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Status for the Feed response.
enum ResponseStatusCode {
UNKNOWN_STATUS_CODE = 0;
// Eligible for feed and no errors encountered.
STATUS_OK = 1;
// Ineligible for Feed.
STATUS_INELIGIBLE_FOR_FEED = 2;
// No cards.
STATUS_NO_CONTENT_RETURNED = 3;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/feature.proto";
// Top level feature which shows a stream of cards. Provides any UI information
// which may be needed in order to render the stream of cards.
message Stream {
extend Feature { optional Stream stream_extension = 185431437; }
}
// Feature which represents a cluster in a Stream. May have a Card or Content
// as children.
// TODO Determine if Clusters can be removed.
message Cluster {
extend Feature { optional Cluster cluster_extension = 190812910; }
// Empty for now as we don't support any custom information.
}
// Feature which represents a full card in a Stream. Allows metadata to be sent
// to describe how to render the card.
message Card {
extend Feature { optional Card card_extension = 185431438; }
}
// Feature which is able to show actual content in a stream. This could be
// inside or outside a card. Actual data on what to display will be sent on an
// extension.
message Content {
extend Feature { optional Content content_extension = 185431439; }
enum Type {
UNKNOWN_CONTENT = 0;
XUIKIT = 1;
}
optional Type type = 1;
optional bool is_ad = 3;
extensions 1000; // ElementsContent
reserved 2;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Templates provide a way to separate formatting from content.
// Deprecated: use RenderData instead.
message Templates {
option deprecated = true;
// Enum denoting which extension contains template data.
enum TemplateType {
UNKNOWN_TEMPLATE_TYPE = 0;
XSURFACE = 1;
}
optional TemplateType template_type = 1;
extensions 264680549; // XSurfaceTemplates
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
import "components/feed/core/proto/v2/wire/content_id.proto";
// A structure containing client-opaque data relating to a request.
message Token {
// The ContentId identifying the parent for this feature. Needed for tokens
// used in a data operation.
optional ContentId parent_id = 2;
extensions 1001; // REDACTED
extensions 1002; // NextPageToken
extensions 1003; // InPlaceUpdateToken
reserved 1, 194964015;
}
// 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 feedwire;
option optimize_for = LITE_RUNTIME;
// Specification of an application or OS version.
// A version string typically looks like: 'major.minor.build.revision'
message Version {
optional int32 major = 1;
optional int32 minor = 2;
optional int32 build = 3;
optional int32 revision = 4;
// The CPU architecture that the native libraries support
enum Architecture {
UNKNOWN_ARCHITECTURE = 0;
ARM = 1;
ARM64 = 2;
MIPS = 3;
MIPS64 = 4;
X86 = 5;
X86_64 = 6;
}
optional Architecture architecture = 5;
// The release stage of the build
enum BuildType {
UNKNOWN_BUILD_TYPE = 0;
DEV = 1;
ALPHA = 2;
BETA = 3;
RELEASE = 4;
}
optional BuildType build_type = 6;
// Specific to Android OS versions. Specifies the API version that the OS
// supports.
optional int32 api_version = 7;
}
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......@@ -19,7 +19,7 @@ message ActionPayloadForTest {
// The mid that represents the topic of the story on the card
optional string id = 1;
extend feedwire.ActionPayload {
extend feedwire1.ActionPayload {
optional ActionPayloadForTest action_payload_for_test_extension = 2;
}
}
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -8,7 +8,7 @@ import "components/feed/core/proto/wire/feature.proto";
import "components/feed/core/proto/wire/payload_metadata.proto";
import "components/feed/core/proto/ui/piet/piet.proto";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -7,7 +7,7 @@ syntax = "proto2";
import "components/feed/core/proto/wire/action_type.proto";
import "components/feed/core/proto/wire/semantic_properties.proto";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -11,7 +11,7 @@ import "components/feed/core/proto/wire/feed_action_query_data.proto";
import "components/feed/core/proto/wire/feed_query.proto";
import "components/feed/core/proto/wire/request.proto";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -8,7 +8,7 @@ import "components/feed/core/proto/wire/capability.proto";
import "components/feed/core/proto/wire/data_operation.proto";
import "components/feed/core/proto/wire/response.proto";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -14,7 +14,7 @@ option java_outer_classname = "MockServerProto";
message MockServer {
// The initial response
optional feedwire.Response initial_response = 1;
optional feedwire1.Response initial_response = 1;
// conditional responses represent responses for paged content
repeated ConditionalResponse conditional_responses = 2;
......@@ -25,7 +25,7 @@ message MockServer {
/** This represents a response providing updates to the stream. */
message MockUpdate {
// The response with the push update
optional feedwire.Response response = 1;
optional feedwire1.Response response = 1;
// The amount of time to wait, in milliseconds, before the push is triggered.
// This is relative to the time the GCL file is loaded.
......@@ -38,5 +38,5 @@ message ConditionalResponse {
optional bytes continuation_token = 1;
// The response to use
optional feedwire.Response response = 2;
optional feedwire1.Response response = 2;
}
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -7,7 +7,7 @@ syntax = "proto2";
import "components/feed/core/proto/ui/piet/piet.proto";
import "components/feed/core/proto/wire/content_id.proto";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -6,7 +6,7 @@ syntax = "proto2";
import "components/feed/core/proto/wire/feature.proto";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......@@ -15,7 +15,7 @@ option java_outer_classname = "TokenProto";
// A continuation token (paging token).
message Token {
extend feedwire.Feature { optional Token token_extension = 194964015; }
extend feedwire1.Feature { optional Token token_extension = 194964015; }
// Indicates the last position of the current content for a parent. A request
// can be made using the next_page_token to get additional features which will
......
......@@ -4,7 +4,7 @@
syntax = "proto2";
package feedwire;
package feedwire1;
option optimize_for = LITE_RUNTIME;
......
......@@ -4,10 +4,10 @@
#include "components/feed/core/v2/feed_network.h"
#include "components/feed/core/proto/wire/action_request.pb.h"
#include "components/feed/core/proto/wire/feed_action_response.pb.h"
#include "components/feed/core/proto/wire/request.pb.h"
#include "components/feed/core/proto/wire/response.pb.h"
#include "components/feed/core/proto/v2/wire/action_request.pb.h"
#include "components/feed/core/proto/v2/wire/feed_action_response.pb.h"
#include "components/feed/core/proto/v2/wire/request.pb.h"
#include "components/feed/core/proto/v2/wire/response.pb.h"
namespace feed {
......
......@@ -10,10 +10,10 @@
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "components/feed/core/common/pref_names.h"
#include "components/feed/core/proto/wire/action_request.pb.h"
#include "components/feed/core/proto/wire/feed_action_response.pb.h"
#include "components/feed/core/proto/wire/request.pb.h"
#include "components/feed/core/proto/wire/response.pb.h"
#include "components/feed/core/proto/v2/wire/action_request.pb.h"
#include "components/feed/core/proto/v2/wire/feed_action_response.pb.h"
#include "components/feed/core/proto/v2/wire/request.pb.h"
#include "components/feed/core/proto/v2/wire/response.pb.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
......
......@@ -14,10 +14,10 @@
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h"
#include "components/feed/core/common/pref_names.h"
#include "components/feed/core/proto/wire/action_request.pb.h"
#include "components/feed/core/proto/wire/feed_action_response.pb.h"
#include "components/feed/core/proto/wire/request.pb.h"
#include "components/feed/core/proto/wire/response.pb.h"
#include "components/feed/core/proto/v2/wire/action_request.pb.h"
#include "components/feed/core/proto/v2/wire/feed_action_response.pb.h"
#include "components/feed/core/proto/v2/wire/request.pb.h"
#include "components/feed/core/proto/v2/wire/response.pb.h"
#include "components/prefs/testing_pref_service.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "net/http/http_response_headers.h"
......
......@@ -9,15 +9,18 @@ namespace feed {
bool Equal(const feedwire::ContentId& a, const feedwire::ContentId& b) {
return a.content_domain() == b.content_domain() && a.id() == b.id() &&
a.table() == b.table();
a.type() == b.type();
}
bool CompareContentId(const feedwire::ContentId& a,
const feedwire::ContentId& b) {
const int a_id = a.id(); // tie() needs l-values
// Local variables because tie() needs l-values.
const int a_id = a.id();
const int b_id = b.id();
return std::tie(a.content_domain(), a_id, a.table()) <
std::tie(b.content_domain(), b_id, b.table());
const feedwire::ContentId::Type a_type = a.type();
const feedwire::ContentId::Type b_type = b.type();
return std::tie(a.content_domain(), a_id, a_type) <
std::tie(b.content_domain(), b_id, b_type);
}
} // namespace feed
......@@ -5,7 +5,7 @@
#ifndef COMPONENTS_FEED_CORE_V2_PROTO_UTIL_H_
#define COMPONENTS_FEED_CORE_V2_PROTO_UTIL_H_
#include "components/feed/core/proto/wire/content_id.pb.h"
#include "components/feed/core/proto/v2/wire/content_id.pb.h"
// Helper functions/classes for dealing with feed proto messages.
......
......@@ -10,7 +10,7 @@
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "components/feed/core/proto/v2/store.pb.h"
#include "components/feed/core/proto/wire/content_id.pb.h"
#include "components/feed/core/proto/v2/wire/content_id.pb.h"
namespace feed {
......
......@@ -10,7 +10,7 @@
#include <string>
#include <vector>
#include "components/feed/core/proto/v2/store.pb.h"
#include "components/feed/core/proto/wire/content_id.pb.h"
#include "components/feed/core/proto/v2/wire/content_id.pb.h"
#include "components/feed/core/v2/proto_util.h"
#include "components/feed/core/v2/stream_model/ephemeral_change.h"
#include "components/feed/core/v2/stream_model/feature_tree.h"
......
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