diff --git a/components/feed/core/proto/BUILD.gn b/components/feed/core/proto/BUILD.gn index ba140746247c9f..7656ac366f23b6 100644 --- a/components/feed/core/proto/BUILD.gn +++ b/components/feed/core/proto/BUILD.gn @@ -11,29 +11,29 @@ if (is_android) { proto_library("proto_v2") { proto_in_dir = "../../../../" sources = [ - #UNUSED_IN_CHROME "v2/wire/feed_id.proto", - #UNUSED_IN_CHROME "v2/wire/in_place_update_handle.proto", - #UNUSED_IN_CHROME "v2/wire/response_status_code.proto", - #UNUSED_IN_CHROME "v2/wire/templates.proto", "v2/keyvalue_store.proto", "v2/packing.proto", "v2/store.proto", "v2/ui.proto", + "v2/wire/action_diagnostic_info.proto", "v2/wire/action_payload.proto", "v2/wire/capability.proto", "v2/wire/chrome_client_info.proto", "v2/wire/chrome_feed_response_metadata.proto", "v2/wire/chrome_fulfillment_info.proto", "v2/wire/client_info.proto", + "v2/wire/color.proto", "v2/wire/consistency_token.proto", "v2/wire/content_id.proto", "v2/wire/data_operation.proto", - "v2/wire/discover_actions_service.proto", + "v2/wire/device.proto", + "v2/wire/diagnostic_info.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_entry_point_data.proto", "v2/wire/feed_query.proto", "v2/wire/feed_request.proto", "v2/wire/feed_response.proto", @@ -43,11 +43,17 @@ proto_library("proto_v2") { "v2/wire/request.proto", "v2/wire/request_schedule.proto", "v2/wire/response.proto", + "v2/wire/server_experiment_data.proto", "v2/wire/stream_structure.proto", "v2/wire/there_and_back_again_data.proto", "v2/wire/token.proto", + "v2/wire/upload_actions_request.proto", + "v2/wire/upload_actions_response.proto", "v2/wire/version.proto", - "v2/wire/web_feeds.proto", + "v2/wire/web_feed.proto", + "v2/wire/wrappers.proto", + "v2/wire/xsurface_container.proto", + "v2/wire/xsurface_content.proto", "v2/xsurface.proto", ] } diff --git a/components/feed/core/proto/v2/wire/feed_id.proto b/components/feed/core/proto/v2/wire/action_diagnostic_info.proto similarity index 71% rename from components/feed/core/proto/v2/wire/feed_id.proto rename to components/feed/core/proto/v2/wire/action_diagnostic_info.proto index 8aa7e7cb95f606..5bc79feac93a7a 100644 --- a/components/feed/core/proto/v2/wire/feed_id.proto +++ b/components/feed/core/proto/v2/wire/action_diagnostic_info.proto @@ -8,6 +8,6 @@ package feedwire; option optimize_for = LITE_RUNTIME; -// UNUSED_IN_CHROME message FeedId { -// UNUSED_IN_CHROME extensions 1 to 6; -// UNUSED_IN_CHROME } +message ActionDiagnosticInfo { + optional int32 actions_remaining = 1; +} diff --git a/components/feed/core/proto/v2/wire/action_payload.proto b/components/feed/core/proto/v2/wire/action_payload.proto index cc072bfb4276ee..28ef27a20529a0 100644 --- a/components/feed/core/proto/v2/wire/action_payload.proto +++ b/components/feed/core/proto/v2/wire/action_payload.proto @@ -8,14 +8,6 @@ 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 + optional bytes action_payload_data = 257605906; } diff --git a/components/feed/core/proto/v2/wire/capability.proto b/components/feed/core/proto/v2/wire/capability.proto index 1e62cc96242e46..8e02cb3d3ed055 100644 --- a/components/feed/core/proto/v2/wire/capability.proto +++ b/components/feed/core/proto/v2/wire/capability.proto @@ -8,27 +8,22 @@ package feedwire; option optimize_for = LITE_RUNTIME; -// Feature capability of either the client or the server. enum Capability { UNKNOWN_CAPABILITY = 0; - // The client is capable of a basic UI. - BASE_UI = 1; + BASE_UI = 1 [deprecated = true]; INFINITE_FEED = 5; DISMISS_COMMAND = 9; UNDO_FOR_DISMISS_COMMAND = 10; - REDACTED_11 = 11; - // UNUSED_IN_CHROME HEIRLOOMED_FEED = 13; - // UNUSED_IN_CHROME SPORTS_FEATURE = 14; - // UNUSED_IN_CHROME PAID_CONTENT = 15; - // UNUSED_IN_CHROME OPEN_VIDEO_COMMAND = 16; + SPORTS_IN_GAME_UPDATE = 35; + PERSIST_GAME_CONTENT = 46; UI_THEME_V2 = 17; - // UNUSED_IN_CHROME INLINE_VIDEO_AUTOPLAY = 18; CARD_MENU = 19; REQUEST_SCHEDULE = 20; HEART = 23; SHARE = 24; OPEN_IN_TAB = 27; DOWNLOAD_LINK = 28; + READ_LATER = 30; LOTTIE_ANIMATIONS = 37; LONG_PRESS_CARD_MENU = 38; PREFETCH_METADATA = 43; diff --git a/components/feed/core/proto/v2/wire/chrome_client_info.proto b/components/feed/core/proto/v2/wire/chrome_client_info.proto index 26f71a2b6906ca..97edd3a7505240 100644 --- a/components/feed/core/proto/v2/wire/chrome_client_info.proto +++ b/components/feed/core/proto/v2/wire/chrome_client_info.proto @@ -8,10 +8,6 @@ package feedwire; option optimize_for = LITE_RUNTIME; -// Information about the client performing the request, relevant only to Chrome -// surfaces. message ChromeClientInfo { - // The signed-out session identifier (Zwieback) token, for clients which embed - // this information in-band instead of using an HTTP Cookie. optional string session_id = 3; } diff --git a/components/feed/core/proto/v2/wire/chrome_feed_response_metadata.proto b/components/feed/core/proto/v2/wire/chrome_feed_response_metadata.proto index a045122a7eb096..d8cd4d67b4c93d 100644 --- a/components/feed/core/proto/v2/wire/chrome_feed_response_metadata.proto +++ b/components/feed/core/proto/v2/wire/chrome_feed_response_metadata.proto @@ -14,7 +14,6 @@ message ChromeFeedResponseMetadata { optional string session_id = 3; repeated Experiment experiments = 4; } - message Experiment { optional string trial_name = 1; optional string group_name = 2; diff --git a/components/feed/core/proto/v2/wire/chrome_fulfillment_info.proto b/components/feed/core/proto/v2/wire/chrome_fulfillment_info.proto index 22ea6991dcb3ff..172645c11a5470 100644 --- a/components/feed/core/proto/v2/wire/chrome_fulfillment_info.proto +++ b/components/feed/core/proto/v2/wire/chrome_fulfillment_info.proto @@ -8,10 +8,6 @@ package feedwire; option optimize_for = LITE_RUNTIME; -// Information on how to do content fulfillment for Chrome. message ChromeFulfillmentInfo { - // Whether the notice card has already been acknowledged by the user based on - // their views and clicks on the card. This is different from when the user - // explicitly dismiss the notice card by touching the button. optional bool notice_card_acknowledged = 1; } diff --git a/components/feed/core/proto/v2/wire/client_info.proto b/components/feed/core/proto/v2/wire/client_info.proto index a54ae75ec4864e..4b67fa5b832eab 100644 --- a/components/feed/core/proto/v2/wire/client_info.proto +++ b/components/feed/core/proto/v2/wire/client_info.proto @@ -6,61 +6,29 @@ syntax = "proto2"; package feedwire; -option optimize_for = LITE_RUNTIME; - import "components/feed/core/proto/v2/wire/chrome_client_info.proto"; +import "components/feed/core/proto/v2/wire/device.proto"; 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. +option optimize_for = LITE_RUNTIME; + message ClientInfo { enum PlatformType { UNKNOWN_PLATFORM = 0; - ANDROID_ID = 1; // ANDROID collides with a C++ preprocessor macro. + ANDROID_ID = 1; IOS = 2; } - - enum AppType { CLANK = 3; } - - // The type of OS that the client is running. + enum AppType { CHROME_ANDROID = 3; } 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; - - // Information about the client performing the request, relevant only to - // Chrome surfaces. + optional Device device = 10; optional ChromeClientInfo chrome_client_info = 338478298; } diff --git a/components/feed/core/proto/v2/wire/color.proto b/components/feed/core/proto/v2/wire/color.proto new file mode 100644 index 00000000000000..0433b3862d6394 --- /dev/null +++ b/components/feed/core/proto/v2/wire/color.proto @@ -0,0 +1,18 @@ +// 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; + +import "components/feed/core/proto/v2/wire/wrappers.proto"; + +option optimize_for = LITE_RUNTIME; + +message Color { + float red = 1; + float green = 2; + float blue = 3; + FloatValue alpha = 4; +} diff --git a/components/feed/core/proto/v2/wire/consistency_token.proto b/components/feed/core/proto/v2/wire/consistency_token.proto index 48a6b2028bda5f..575d02b8300625 100644 --- a/components/feed/core/proto/v2/wire/consistency_token.proto +++ b/components/feed/core/proto/v2/wire/consistency_token.proto @@ -8,8 +8,6 @@ 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; } diff --git a/components/feed/core/proto/v2/wire/content_id.proto b/components/feed/core/proto/v2/wire/content_id.proto index b098b3092f1fa2..d0333c4b5e3038 100644 --- a/components/feed/core/proto/v2/wire/content_id.proto +++ b/components/feed/core/proto/v2/wire/content_id.proto @@ -8,42 +8,13 @@ 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 string content_domain = 1; + optional int32 type = 2; optional fixed64 id = 3; } diff --git a/components/feed/core/proto/v2/wire/data_operation.proto b/components/feed/core/proto/v2/wire/data_operation.proto index 187f6388fc110d..68883fc15e7b21 100644 --- a/components/feed/core/proto/v2/wire/data_operation.proto +++ b/components/feed/core/proto/v2/wire/data_operation.proto @@ -6,51 +6,27 @@ syntax = "proto2"; package feedwire; -option optimize_for = LITE_RUNTIME; - import "components/feed/core/proto/v2/wire/feature.proto"; -// UNUSED_IN_CHROME 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"; -// UNUSED_IN_CHROME import "components/feed/core/proto/v2/wire/templates.proto"; -import "components/feed/core/proto/v2/wire/token.proto"; import "components/feed/core/proto/v2/wire/request_schedule.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 +option optimize_for = LITE_RUNTIME; +message DataOperation { 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; - - // UNUSED_IN_CHROME InPlaceUpdateHandle in_place_update_handle = 8; - // UNUSED_IN_CHROME Templates templates = 4 [deprecated = true]; - RequestSchedule request_schedule = 9; } + optional Operation operation = 1; + optional PayloadMetadata metadata = 2; } diff --git a/components/feed/core/proto/v2/wire/device.proto b/components/feed/core/proto/v2/wire/device.proto new file mode 100644 index 00000000000000..8cc09f711e0360 --- /dev/null +++ b/components/feed/core/proto/v2/wire/device.proto @@ -0,0 +1,14 @@ +// 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; + +message Device { + optional string manufacturer = 1; + optional string model = 2; +} diff --git a/components/feed/core/proto/v2/wire/diagnostic_info.proto b/components/feed/core/proto/v2/wire/diagnostic_info.proto new file mode 100644 index 00000000000000..10a0c650ec2be3 --- /dev/null +++ b/components/feed/core/proto/v2/wire/diagnostic_info.proto @@ -0,0 +1,14 @@ +// 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; + +message DiagnosticInfo { + optional int32 actions_remaining = 1; + optional int64 last_successful_refresh_time_usec = 2; +} diff --git a/components/feed/core/proto/v2/wire/display_info.proto b/components/feed/core/proto/v2/wire/display_info.proto index f12bc749e8aad0..7f0e4c7b815921 100644 --- a/components/feed/core/proto/v2/wire/display_info.proto +++ b/components/feed/core/proto/v2/wire/display_info.proto @@ -8,17 +8,8 @@ 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; } diff --git a/components/feed/core/proto/v2/wire/duration.proto b/components/feed/core/proto/v2/wire/duration.proto index 5f261ae32bcca6..26b77ec998d2d0 100644 --- a/components/feed/core/proto/v2/wire/duration.proto +++ b/components/feed/core/proto/v2/wire/duration.proto @@ -8,7 +8,6 @@ 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; diff --git a/components/feed/core/proto/v2/wire/expiration_info.proto b/components/feed/core/proto/v2/wire/expiration_info.proto index 326ceb86093cb9..2e5174c67db912 100644 --- a/components/feed/core/proto/v2/wire/expiration_info.proto +++ b/components/feed/core/proto/v2/wire/expiration_info.proto @@ -6,21 +6,12 @@ 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. */ +option optimize_for = LITE_RUNTIME; + 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; + optional Duration expiration_duration = 2; + optional bytes xsurface_expiration_info = 1000; } diff --git a/components/feed/core/proto/v2/wire/feature.proto b/components/feed/core/proto/v2/wire/feature.proto index 775961cec7fb9c..386be651cdb619 100644 --- a/components/feed/core/proto/v2/wire/feature.proto +++ b/components/feed/core/proto/v2/wire/feature.proto @@ -6,42 +6,28 @@ 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"; import "components/feed/core/proto/v2/wire/stream_structure.proto"; +import "components/feed/core/proto/v2/wire/token.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; +option optimize_for = LITE_RUNTIME; - // Enum denoting which extension containing the renderable data is associated - // with this Feature. +message 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; + } + oneof parent_info { + ContentId parent_id = 1; + bool is_root = 4; } 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; - - optional Stream stream_extension = 185431437; - optional Cluster cluster_extension = 190812910; - extensions 185431438; // Card - optional Content content_extension = 185431439; - extensions 194964015; // Token - extensions 286406442; // REDACTED - extensions 286406443; // REDACTED - - reserved 246375740, 274598443, 274598444, 277068786; + optional Stream stream = 185431437; + optional Content content = 185431439; + optional Cluster cluster = 190812910; + optional Token token = 194964015; } diff --git a/components/feed/core/proto/v2/wire/feed_action.proto b/components/feed/core/proto/v2/wire/feed_action.proto index 5baf0cc8b2ec2b..bfb60db8b4b3e6 100644 --- a/components/feed/core/proto/v2/wire/feed_action.proto +++ b/components/feed/core/proto/v2/wire/feed_action.proto @@ -6,55 +6,28 @@ 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 +option optimize_for = LITE_RUNTIME; - // The data the client provides to the server. +message FeedAction { 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; - enum ActionOrigin { UNKNOWN_ORIGIN = 0; - // Action generated from the current session on the client. CLIENT_SESSION = 1; - // Action was previously cached on the client. CLIENT_CACHE = 2; } - - // Where the action came from on the client. - // Optional: This field is purely for diagnostics. - optional ActionOrigin action_origin = 4; - - // The surface an action was taken on. enum ActionSurface { UNKNOWN_SURFACE = 0; ANDROID_CHROME_NEW_TAB = 7; IOS_CHROME_NEW_TAB = 8; } - - // What surface the action came from. + optional int64 timestamp_seconds = 1; + optional int64 sequence_number = 2; + optional int64 duration_ms = 3; + optional ActionOrigin action_origin = 4; optional ActionSurface action_surface = 5; } - reserved 4, 5, 6; + optional ActionPayload action_payload = 2; + optional ClientData client_data = 3; } diff --git a/components/feed/core/proto/v2/wire/feed_entry_point_data.proto b/components/feed/core/proto/v2/wire/feed_entry_point_data.proto new file mode 100644 index 00000000000000..6f9984038e797b --- /dev/null +++ b/components/feed/core/proto/v2/wire/feed_entry_point_data.proto @@ -0,0 +1,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; + +message FeedEntryPointData { + optional int32 feed_entry_point_source_value = 1; +} diff --git a/components/feed/core/proto/v2/wire/feed_query.proto b/components/feed/core/proto/v2/wire/feed_query.proto index 0cc218f07bb7ef..6dcced289a5456 100644 --- a/components/feed/core/proto/v2/wire/feed_query.proto +++ b/components/feed/core/proto/v2/wire/feed_query.proto @@ -6,51 +6,22 @@ syntax = "proto2"; package feedwire; -option optimize_for = LITE_RUNTIME; - import "components/feed/core/proto/v2/wire/chrome_fulfillment_info.proto"; +import "components/feed/core/proto/v2/wire/feed_entry_point_data.proto"; import "components/feed/core/proto/v2/wire/token.proto"; +option optimize_for = LITE_RUNTIME; + message FeedQuery { + message Tokens { repeated Token tokens = 1; } 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. + oneof token { Token next_page_token = 3; } 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; - } - - // Information on how to do content fulfillment for Chrome. + optional FeedEntryPointData feed_entry_point_data = 9; optional ChromeFulfillmentInfo chrome_fulfillment_info = 341477699; - - reserved 2; } diff --git a/components/feed/core/proto/v2/wire/feed_request.proto b/components/feed/core/proto/v2/wire/feed_request.proto index 5cccc0bdb45827..d3a26bcf5ed678 100644 --- a/components/feed/core/proto/v2/wire/feed_request.proto +++ b/components/feed/core/proto/v2/wire/feed_request.proto @@ -6,32 +6,18 @@ 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"; -// UNUSED_IN_CHROME import "components/feed/core/proto/v2/wire/feed_id.proto"; +import "components/feed/core/proto/v2/wire/diagnostic_info.proto"; import "components/feed/core/proto/v2/wire/feed_query.proto"; -// Request to fetch new data for the feed +option optimize_for = LITE_RUNTIME; + message FeedRequest { - // 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] - // UNUSED_IN_CHROME repeated FeedId feed_ids_to_preserve = 12; - - reserved 3, 13; + optional DiagnosticInfo diagnostic_info = 14; } diff --git a/components/feed/core/proto/v2/wire/feed_response.proto b/components/feed/core/proto/v2/wire/feed_response.proto index bd60ddce0e5b6d..5337c9480d449b 100644 --- a/components/feed/core/proto/v2/wire/feed_response.proto +++ b/components/feed/core/proto/v2/wire/feed_response.proto @@ -6,34 +6,20 @@ syntax = "proto2"; package feedwire; -option optimize_for = LITE_RUNTIME; - -// UNUSED_IN_CHROME import -// "components/feed/core/proto/v2/wire/capability.proto"; import "components/feed/core/proto/v2/wire/chrome_feed_response_metadata.proto"; import "components/feed/core/proto/v2/wire/data_operation.proto"; -// UNUSED_IN_CHROME import "components/feed/core/proto/v2/wire/feed_id.proto"; -// UNUSED_IN_CHROME import -// "components/feed/core/proto/v2/wire/response_status_code.proto"; +import "components/feed/core/proto/v2/wire/server_experiment_data.proto"; + +option optimize_for = LITE_RUNTIME; -// 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 { - // 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; - - // UNUSED_IN_CHROME repeated Capability server_capabilities = 3; - // UNUSED_IN_CHROME optional ResponseStatusCode response_status_code = 4; } - message FeedResponseMetadata { - // UNUSED_IN_CHROME optional int64 response_time_ms = 1; - // UNUSED_IN_CHROME optional bytes event_id = 2; - // UNUSED_IN_CHROME optional FeedId feed_id = 3; - // UNUSED_IN_CHROME optional bool pinned_content_fulfilled = 4; + optional int64 response_time_ms = 1; + optional bytes event_id = 2; + optional bool pinned_content_fulfilled = 4; + optional ServerExperimentData server_experiment_data = 5; optional ChromeFeedResponseMetadata chrome_feed_response_metadata = 326233599; } diff --git a/components/feed/core/proto/v2/wire/in_place_update_handle.proto b/components/feed/core/proto/v2/wire/in_place_update_handle.proto deleted file mode 100644 index e88b0696e0e1a9..00000000000000 --- a/components/feed/core/proto/v2/wire/in_place_update_handle.proto +++ /dev/null @@ -1,17 +0,0 @@ -// 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; - -// UNUSED_IN_CHROME import "components/feed/core/proto/v2/wire/duration.proto"; -// UNUSED_IN_CHROME import "components/feed/core/proto/v2/wire/token.proto"; - -// UNUSED_IN_CHROME message InPlaceUpdateHandle { -// UNUSED_IN_CHROME optional feedwire.Duration use_after = 1; -// UNUSED_IN_CHROME optional Token token = 2; -// UNUSED_IN_CHROME } diff --git a/components/feed/core/proto/v2/wire/next_page_token.proto b/components/feed/core/proto/v2/wire/next_page_token.proto index 37d532db4efefe..672233fc64ca4f 100644 --- a/components/feed/core/proto/v2/wire/next_page_token.proto +++ b/components/feed/core/proto/v2/wire/next_page_token.proto @@ -10,4 +10,14 @@ option optimize_for = LITE_RUNTIME; message NextPageToken { optional bytes next_page_token = 1; + optional TokenHandling token_handling = 2; + optional bytes metadata = 3; +} +message TokenHandling { + enum LoadStrategy { + LOAD_STRATEGY_UNKNOWN = 0; + EAGER = 1; + LAZY = 2; + } + optional LoadStrategy load_strategy = 1; } diff --git a/components/feed/core/proto/v2/wire/payload_metadata.proto b/components/feed/core/proto/v2/wire/payload_metadata.proto index 28a7695af408e3..e3c9eaaab8339f 100644 --- a/components/feed/core/proto/v2/wire/payload_metadata.proto +++ b/components/feed/core/proto/v2/wire/payload_metadata.proto @@ -6,14 +6,10 @@ 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. +option optimize_for = LITE_RUNTIME; + message PayloadMetadata { - // The unique identifier of the payload. optional ContentId content_id = 1; - - reserved 2, 3, 4, 5; } diff --git a/components/feed/core/proto/v2/wire/render_data.proto b/components/feed/core/proto/v2/wire/render_data.proto index 67bf2029043e82..d01d752f2f1c8c 100644 --- a/components/feed/core/proto/v2/wire/render_data.proto +++ b/components/feed/core/proto/v2/wire/render_data.proto @@ -6,18 +6,17 @@ syntax = "proto2"; package feedwire; +import "components/feed/core/proto/v2/wire/xsurface_container.proto"; + 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; + PREFETCH_RESOURCES = 2; } optional RenderDataType render_data_type = 1; - - message XSurfaceContainer { optional bytes render_data = 1; } optional XSurfaceContainer xsurface_container = 1000; + optional bytes xsurface_prefetch_resources = 330939752; } diff --git a/components/feed/core/proto/v2/wire/request.proto b/components/feed/core/proto/v2/wire/request.proto index 7add283ffd5949..91ea7f7c41aab0 100644 --- a/components/feed/core/proto/v2/wire/request.proto +++ b/components/feed/core/proto/v2/wire/request.proto @@ -6,20 +6,15 @@ syntax = "proto2"; package feedwire; -option optimize_for = LITE_RUNTIME; - import "components/feed/core/proto/v2/wire/feed_request.proto"; -// Top level request message. +option optimize_for = LITE_RUNTIME; + 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; - optional FeedRequest feed_request = 1000; } diff --git a/components/feed/core/proto/v2/wire/request_schedule.proto b/components/feed/core/proto/v2/wire/request_schedule.proto index 9d2ab7aee25266..2832031734f84d 100644 --- a/components/feed/core/proto/v2/wire/request_schedule.proto +++ b/components/feed/core/proto/v2/wire/request_schedule.proto @@ -6,14 +6,13 @@ syntax = "proto2"; package feedwire; -option optimize_for = LITE_RUNTIME; - import "components/feed/core/proto/v2/wire/duration.proto"; +option optimize_for = LITE_RUNTIME; + message RequestSchedule { message TimeBasedSchedule { - repeated feedwire.Duration refresh_time_from_response_time = 1; + repeated Duration refresh_time_from_response_time = 1; } - oneof schedule { TimeBasedSchedule time_based_schedule = 1; } } diff --git a/components/feed/core/proto/v2/wire/response.proto b/components/feed/core/proto/v2/wire/response.proto index 3b87e7e2085715..110e5161258931 100644 --- a/components/feed/core/proto/v2/wire/response.proto +++ b/components/feed/core/proto/v2/wire/response.proto @@ -6,20 +6,15 @@ syntax = "proto2"; package feedwire; -option optimize_for = LITE_RUNTIME; - import "components/feed/core/proto/v2/wire/feed_response.proto"; -// Top level response message. +option optimize_for = LITE_RUNTIME; + 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; - optional FeedResponse feed_response = 1000; } diff --git a/components/feed/core/proto/v2/wire/response_status_code.proto b/components/feed/core/proto/v2/wire/response_status_code.proto deleted file mode 100644 index adbcb1cc83256c..00000000000000 --- a/components/feed/core/proto/v2/wire/response_status_code.proto +++ /dev/null @@ -1,17 +0,0 @@ -// 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. -// UNUSED_IN_CHROME enum ResponseStatusCode { -// UNUSED_IN_CHROME UNKNOWN_STATUS_CODE = 0; -// UNUSED_IN_CHROME STATUS_OK = 1; -// UNUSED_IN_CHROME STATUS_INELIGIBLE_FOR_FEED = 2; -// UNUSED_IN_CHROME STATUS_NO_CONTENT_RETURNED = 3; -// UNUSED_IN_CHROME } diff --git a/components/feed/core/proto/v2/wire/server_experiment_data.proto b/components/feed/core/proto/v2/wire/server_experiment_data.proto new file mode 100644 index 00000000000000..828f03a2721aca --- /dev/null +++ b/components/feed/core/proto/v2/wire/server_experiment_data.proto @@ -0,0 +1,17 @@ +// 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; + +message ServerExperimentData { + message NamespacedExperimentInfo { + optional string namespace = 1; + repeated int32 experiment_id = 2; + } + repeated NamespacedExperimentInfo namespaced_experiment_info = 1; +} diff --git a/components/feed/core/proto/v2/wire/stream_structure.proto b/components/feed/core/proto/v2/wire/stream_structure.proto index 04a4ff92bd1184..d2006eabcdc2f4 100644 --- a/components/feed/core/proto/v2/wire/stream_structure.proto +++ b/components/feed/core/proto/v2/wire/stream_structure.proto @@ -6,20 +6,12 @@ syntax = "proto2"; package feedwire; -option optimize_for = LITE_RUNTIME; - -// 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 { -} +import "components/feed/core/proto/v2/wire/xsurface_content.proto"; -// 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 { - // Empty for now as we don't support any custom information. -} +option optimize_for = LITE_RUNTIME; +message Stream {} +message Cluster {} message PrefetchMetadata { optional string uri = 1; optional string title = 2; @@ -30,13 +22,7 @@ message PrefetchMetadata { optional string snippet = 7; optional string badge_id = 8; } - message Content { repeated PrefetchMetadata prefetch_metadata = 4; optional XSurfaceContent xsurface_content = 1000; } - -// Opaque data to for rendering a piece of content. -message XSurfaceContent { - optional bytes xsurface_output = 1; -} diff --git a/components/feed/core/proto/v2/wire/templates.proto b/components/feed/core/proto/v2/wire/templates.proto deleted file mode 100644 index 8bcc01cf3b6b57..00000000000000 --- a/components/feed/core/proto/v2/wire/templates.proto +++ /dev/null @@ -1,18 +0,0 @@ -// 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; - -// UNUSED_IN_CHROME message Templates { -// UNUSED_IN_CHROME enum TemplateType { -// UNUSED_IN_CHROME UNKNOWN_TEMPLATE_TYPE = 0; -// UNUSED_IN_CHROME XSURFACE = 1; -// UNUSED_IN_CHROME } -// UNUSED_IN_CHROME optional TemplateType template_type = 1; -// UNUSED_IN_CHROME extensions 264680549; // XSurfaceTemplates -// UNUSED_IN_CHROME } diff --git a/components/feed/core/proto/v2/wire/there_and_back_again_data.proto b/components/feed/core/proto/v2/wire/there_and_back_again_data.proto index 98eaaec997f2d9..f934d81a363119 100644 --- a/components/feed/core/proto/v2/wire/there_and_back_again_data.proto +++ b/components/feed/core/proto/v2/wire/there_and_back_again_data.proto @@ -6,10 +6,10 @@ syntax = "proto2"; package feedwire; -option optimize_for = LITE_RUNTIME; - import "components/feed/core/proto/v2/wire/action_payload.proto"; +option optimize_for = LITE_RUNTIME; + message ThereAndBackAgainData { - optional feedwire.ActionPayload action_payload = 1; + optional ActionPayload action_payload = 1; } diff --git a/components/feed/core/proto/v2/wire/token.proto b/components/feed/core/proto/v2/wire/token.proto index 37e91678636042..37ac17c0b56625 100644 --- a/components/feed/core/proto/v2/wire/token.proto +++ b/components/feed/core/proto/v2/wire/token.proto @@ -6,20 +6,14 @@ 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/next_page_token.proto"; -// A structure containing client-opaque data relating to a request. +option optimize_for = LITE_RUNTIME; + 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 optional NextPageToken next_page_token = 1002; - extensions 1003; // InPlaceUpdateToken - - reserved 1, 194964015; + optional bytes in_place_update_token = 1003; + optional bytes story_token = 1004; } diff --git a/components/feed/core/proto/v2/wire/discover_actions_service.proto b/components/feed/core/proto/v2/wire/upload_actions_request.proto similarity index 79% rename from components/feed/core/proto/v2/wire/discover_actions_service.proto rename to components/feed/core/proto/v2/wire/upload_actions_request.proto index 3a127869a55f33..9e45f512a45d7e 100644 --- a/components/feed/core/proto/v2/wire/discover_actions_service.proto +++ b/components/feed/core/proto/v2/wire/upload_actions_request.proto @@ -6,16 +6,14 @@ syntax = "proto3"; package feedwire; -option optimize_for = LITE_RUNTIME; - +import "components/feed/core/proto/v2/wire/action_diagnostic_info.proto"; import "components/feed/core/proto/v2/wire/consistency_token.proto"; import "components/feed/core/proto/v2/wire/feed_action.proto"; +option optimize_for = LITE_RUNTIME; + message UploadActionsRequest { repeated FeedAction feed_actions = 1; ConsistencyToken consistency_token = 2; -} - -message UploadActionsResponse { - ConsistencyToken consistency_token = 1; + ActionDiagnosticInfo action_diagnostic_info = 5; } diff --git a/components/feed/core/proto/v2/wire/upload_actions_response.proto b/components/feed/core/proto/v2/wire/upload_actions_response.proto new file mode 100644 index 00000000000000..1e73a38a8fa8fc --- /dev/null +++ b/components/feed/core/proto/v2/wire/upload_actions_response.proto @@ -0,0 +1,15 @@ +// 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; + +import "components/feed/core/proto/v2/wire/consistency_token.proto"; + +option optimize_for = LITE_RUNTIME; + +message UploadActionsResponse { + ConsistencyToken consistency_token = 1; +} diff --git a/components/feed/core/proto/v2/wire/version.proto b/components/feed/core/proto/v2/wire/version.proto index 6ead96a0f5cb1e..78fbb9e1d3ef8f 100644 --- a/components/feed/core/proto/v2/wire/version.proto +++ b/components/feed/core/proto/v2/wire/version.proto @@ -8,15 +8,7 @@ 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; @@ -26,9 +18,6 @@ message Version { X86 = 5; X86_64 = 6; } - optional Architecture architecture = 5; - - // The release stage of the build enum BuildType { UNKNOWN_BUILD_TYPE = 0; DEV = 1; @@ -36,9 +25,11 @@ message Version { BETA = 3; RELEASE = 4; } + optional int32 major = 1; + optional int32 minor = 2; + optional int32 build = 3; + optional int32 revision = 4; + optional Architecture architecture = 5; optional BuildType build_type = 6; - - // Specific to Android OS versions. Specifies the API version that the OS - // supports. optional int32 api_version = 7; } diff --git a/components/feed/core/proto/v2/wire/web_feed.proto b/components/feed/core/proto/v2/wire/web_feed.proto new file mode 100644 index 00000000000000..7d48935695eb22 --- /dev/null +++ b/components/feed/core/proto/v2/wire/web_feed.proto @@ -0,0 +1,59 @@ +// Copyright 2021 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.webfeed; + +import "components/feed/core/proto/v2/wire/color.proto"; +import "components/feed/core/proto/v2/wire/consistency_token.proto"; + +option optimize_for = LITE_RUNTIME; + +// Warning! +// Warning! Protobufs here are provisional, and will change in +// backwards-incompatible ways. Warning! + +message ListFollowedWebFeedRequest {} +message ListFollowedWebFeedResponse {} + +message FollowUriRequest {} +message FollowUriResponse { + ConsistencyToken consistency_token = 1; +} +message UnfollowUriRequest {} +message UnfollowUriResponse { + ConsistencyToken consistency_token = 1; +} +message Image { + string url = 1; +} +message WebMetadata { + string subtitle = 1; + string detail_text = 2; + string visit_url = 3; + Image header_image = 4; + Color header_text_color = 6; + bool is_claimed = 5; +} +message FolloableWebFeedInfo { + string web_feed_id = 1; + string title = 2; + string presentation_url = 3; + string main_uri = 4; + string favicon_uri = 5; + repeated UriMatcher uri_matcher = 6; +} +message ListRecommendedUrlsRequest {} +message ListRecommendedUrlsResponse { + repeated FolloableWebFeedInfo recommended_web_feed = 1; +} +message VisualHeaderStyle { + Color follow_button_color = 3; + Color following_button_color = 5; + Image image = 4; +} +message UriMatcher { + string domain_match = 1; +} diff --git a/components/feed/core/proto/v2/wire/web_feeds.proto b/components/feed/core/proto/v2/wire/web_feeds.proto deleted file mode 100644 index 96bbf08e557858..00000000000000 --- a/components/feed/core/proto/v2/wire/web_feeds.proto +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2021 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; - -// Warning! -// Warning! Protobufs here are provisional, and will change in -// backwards-incompatible ways. Warning! - -message UnfollowWebFeedRequest {} - -message UnfollowWebFeedResponse {} - -message ListFollowedWebFeedRequest {} - -message ListFollowedWebFeedResponse {} diff --git a/components/feed/core/proto/v2/wire/wrappers.proto b/components/feed/core/proto/v2/wire/wrappers.proto new file mode 100644 index 00000000000000..a9d8df77d3dfab --- /dev/null +++ b/components/feed/core/proto/v2/wire/wrappers.proto @@ -0,0 +1,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 = "proto3"; + +package feedwire; + +option optimize_for = LITE_RUNTIME; + +message FloatValue { + float value = 1; +} diff --git a/components/feed/core/proto/v2/wire/xsurface_container.proto b/components/feed/core/proto/v2/wire/xsurface_container.proto new file mode 100644 index 00000000000000..e300cd820715bf --- /dev/null +++ b/components/feed/core/proto/v2/wire/xsurface_container.proto @@ -0,0 +1,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; + +message XSurfaceContainer { + optional bytes render_data = 1; +} diff --git a/components/feed/core/proto/v2/wire/xsurface_content.proto b/components/feed/core/proto/v2/wire/xsurface_content.proto new file mode 100644 index 00000000000000..b50ba1a1cede55 --- /dev/null +++ b/components/feed/core/proto/v2/wire/xsurface_content.proto @@ -0,0 +1,14 @@ +// 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; + +message XSurfaceContent { + optional bytes xsurface_output = 1; + optional int32 id = 2; +} diff --git a/components/feed/core/v2/feed_network.cc b/components/feed/core/v2/feed_network.cc index 6f37737f4abd8c..f5ee58ac4f321f 100644 --- a/components/feed/core/v2/feed_network.cc +++ b/components/feed/core/v2/feed_network.cc @@ -4,10 +4,11 @@ #include "components/feed/core/v2/feed_network.h" -#include "components/feed/core/proto/v2/wire/discover_actions_service.pb.h" #include "components/feed/core/proto/v2/wire/request.pb.h" #include "components/feed/core/proto/v2/wire/response.pb.h" -#include "components/feed/core/proto/v2/wire/web_feeds.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_request.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_response.pb.h" +#include "components/feed/core/proto/v2/wire/web_feed.pb.h" namespace feed { diff --git a/components/feed/core/v2/feed_network.h b/components/feed/core/v2/feed_network.h index 19b372d7a81c1e..a4c1192c86c5ab 100644 --- a/components/feed/core/v2/feed_network.h +++ b/components/feed/core/v2/feed_network.h @@ -8,10 +8,11 @@ #include #include "base/callback.h" -#include "components/feed/core/proto/v2/wire/discover_actions_service.pb.h" #include "components/feed/core/proto/v2/wire/request.pb.h" #include "components/feed/core/proto/v2/wire/response.pb.h" -#include "components/feed/core/proto/v2/wire/web_feeds.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_request.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_response.pb.h" +#include "components/feed/core/proto/v2/wire/web_feed.pb.h" #include "components/feed/core/v2/enums.h" #include "components/feed/core/v2/metrics_reporter.h" #include "components/feed/core/v2/public/types.h" @@ -36,8 +37,8 @@ struct UploadActionsDiscoverApi { }; struct ListFollowedWebFeedDiscoverApi { - using Request = feedwire::ListFollowedWebFeedRequest; - using Response = feedwire::ListFollowedWebFeedResponse; + using Request = feedwire::webfeed::ListFollowedWebFeedRequest; + using Response = feedwire::webfeed::ListFollowedWebFeedResponse; static const NetworkRequestType kRequestType = NetworkRequestType::kListFollowedWebFeeds; static base::StringPiece Method() { return "GET"; } @@ -46,8 +47,8 @@ struct ListFollowedWebFeedDiscoverApi { }; struct UnfollowWebFeedDiscoverApi { - using Request = feedwire::UnfollowWebFeedRequest; - using Response = feedwire::UnfollowWebFeedResponse; + using Request = feedwire::webfeed::UnfollowUriRequest; + using Response = feedwire::webfeed::UnfollowUriResponse; static const NetworkRequestType kRequestType = NetworkRequestType::kUnfollowWebFeed; static base::StringPiece Method() { return "POST"; } diff --git a/components/feed/core/v2/feed_network_impl.cc b/components/feed/core/v2/feed_network_impl.cc index 7572dad6eea440..0e504706980a15 100644 --- a/components/feed/core/v2/feed_network_impl.cc +++ b/components/feed/core/v2/feed_network_impl.cc @@ -16,10 +16,11 @@ #include "base/strings/strcat.h" #include "base/time/time.h" #include "components/feed/core/common/pref_names.h" -#include "components/feed/core/proto/v2/wire/discover_actions_service.pb.h" #include "components/feed/core/proto/v2/wire/feed_query.pb.h" #include "components/feed/core/proto/v2/wire/request.pb.h" #include "components/feed/core/proto/v2/wire/response.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_request.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_response.pb.h" #include "components/feed/core/v2/metrics_reporter.h" #include "components/prefs/pref_service.h" #include "components/signin/public/identity_manager/access_token_info.h" @@ -57,7 +58,6 @@ GURL GetFeedQueryURL(feedwire::FeedQuery::RequestReason reason) { // Add URLs for Bling when it is supported. switch (reason) { case feedwire::FeedQuery::SCHEDULED_REFRESH: - case feedwire::FeedQuery::IN_PLACE_UPDATE: return GURL( "https://www.google.com/httpservice/noretry/TrellisClankService/" "FeedQuery"); diff --git a/components/feed/core/v2/feed_network_impl_unittest.cc b/components/feed/core/v2/feed_network_impl_unittest.cc index 9c94daebc26b44..55da01204b483b 100644 --- a/components/feed/core/v2/feed_network_impl_unittest.cc +++ b/components/feed/core/v2/feed_network_impl_unittest.cc @@ -15,10 +15,11 @@ #include "base/test/task_environment.h" #include "build/chromeos_buildflags.h" #include "components/feed/core/common/pref_names.h" -#include "components/feed/core/proto/v2/wire/discover_actions_service.pb.h" #include "components/feed/core/proto/v2/wire/request.pb.h" #include "components/feed/core/proto/v2/wire/response.pb.h" -#include "components/feed/core/proto/v2/wire/web_feeds.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_request.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_response.pb.h" +#include "components/feed/core/proto/v2/wire/web_feed.pb.h" #include "components/feed/core/v2/test/callback_receiver.h" #include "components/prefs/testing_pref_service.h" #include "components/signin/public/identity_manager/identity_test_environment.h" @@ -59,8 +60,7 @@ feedwire::Response GetTestFeedResponse() { feedwire::UploadActionsRequest GetTestActionRequest() { feedwire::UploadActionsRequest request; - request.add_feed_actions()->mutable_content_id()->set_content_domain( - "example.com"); + request.add_feed_actions()->mutable_client_data()->set_duration_ms(123); return request; } @@ -507,14 +507,15 @@ TEST_F(FeedNetworkTest, SendApiRequestSendsValidRequest_UploadActions) { } TEST_F(FeedNetworkTest, SendApiRequest_Unfollow) { - CallbackReceiver> + CallbackReceiver< + FeedNetwork::ApiResult> receiver; feed_network()->SendApiRequest({}, receiver.Bind()); RespondToDiscoverRequest("", net::HTTP_OK); ASSERT_TRUE(receiver.GetResult()); - const FeedNetwork::ApiResult& result = + const FeedNetwork::ApiResult& result = *receiver.GetResult(); EXPECT_EQ(net::HTTP_OK, result.response_info.status_code); EXPECT_TRUE(result.response_body); diff --git a/components/feed/core/v2/feed_stream_unittest.cc b/components/feed/core/v2/feed_stream_unittest.cc index 7de2457be0b627..e1b4a5cb03d914 100644 --- a/components/feed/core/v2/feed_stream_unittest.cc +++ b/components/feed/core/v2/feed_stream_unittest.cc @@ -16,6 +16,7 @@ #include "base/logging.h" #include "base/optional.h" #include "base/path_service.h" +#include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/test/bind.h" @@ -118,8 +119,14 @@ std::string ModelStateFor(const StreamType& stream_type, FeedStore* store) { feedwire::FeedAction MakeFeedAction(int64_t id, size_t pad_size = 0) { feedwire::FeedAction action; - action.mutable_content_id()->set_id(id); - action.mutable_content_id()->set_content_domain(std::string(pad_size, 'a')); + + std::string pad; + if (pad_size > 0) { + pad = " " + std::string(pad_size - 1, 'a'); + } + + action.mutable_action_payload()->set_action_payload_data( + base::StrCat({base::NumberToString(id), pad})); return action; } @@ -1918,7 +1925,9 @@ TEST_F(FeedStreamTest, StorePendingAction) { std::vector result = ReadStoredActions(stream_->GetStore()); ASSERT_EQ(1ul, result.size()); - EXPECT_EQ(42ul, result[0].action().content_id().id()); + + EXPECT_EQ(ToTextProto(MakeFeedAction(42ul).action_payload()), + ToTextProto(result[0].action().action_payload())); } TEST_F(FeedStreamTest, UploadActionWhileSignedOutIsNoOp) { @@ -2280,8 +2289,11 @@ TEST_F(FeedStreamTest, LoadMoreUploadsActions) { stream_->UploadAction(MakeFeedAction(100ul), true, base::DoNothing()); WaitForIdleTaskQueue(); EXPECT_EQ(1, network_.GetActionRequestSent()->feed_actions_size()); - EXPECT_EQ(100ul, - network_.GetActionRequestSent()->feed_actions(0).content_id().id()); + + EXPECT_EQ( + ToTextProto(MakeFeedAction(100ul).action_payload()), + ToTextProto( + network_.GetActionRequestSent()->feed_actions(0).action_payload())); } TEST_F(FeedStreamTest, LoadMoreUpdatesIsActivityLoggingEnabled) { @@ -2359,8 +2371,10 @@ TEST_F(FeedStreamTest, BackgroundingAppUploadsActions) { stream_->OnEnterBackground(); WaitForIdleTaskQueue(); EXPECT_EQ(1, network_.GetActionRequestSent()->feed_actions_size()); - EXPECT_EQ(1ul, - network_.GetActionRequestSent()->feed_actions(0).content_id().id()); + EXPECT_EQ( + ToTextProto(MakeFeedAction(1ul).action_payload()), + ToTextProto( + network_.GetActionRequestSent()->feed_actions(0).action_payload())); } TEST_F(FeedStreamTest, BackgroundingAppDoesNotUploadActions) { @@ -2434,8 +2448,10 @@ TEST_F(FeedStreamTest, UploadActionsSkipsStaleActionsByTimestamp) { // Just one action should have been uploaded. EXPECT_EQ(1, network_.GetActionRequestCount()); EXPECT_EQ(1, network_.GetActionRequestSent()->feed_actions_size()); - EXPECT_EQ(3ul, - network_.GetActionRequestSent()->feed_actions(0).content_id().id()); + EXPECT_EQ( + ToTextProto(MakeFeedAction(3ul).action_payload()), + ToTextProto( + network_.GetActionRequestSent()->feed_actions(0).action_payload())); ASSERT_TRUE(cr.GetResult()); EXPECT_EQ(1ul, cr.GetResult()->upload_attempt_count); diff --git a/components/feed/core/v2/proto_util.cc b/components/feed/core/v2/proto_util.cc index 5a5a3c90fcc346..1b72f0b022050f 100644 --- a/components/feed/core/v2/proto_util.cc +++ b/components/feed/core/v2/proto_util.cc @@ -182,8 +182,8 @@ bool CompareContentId(const feedwire::ContentId& a, // Local variables because tie() needs l-values. const int a_id = a.id(); const int b_id = b.id(); - const feedwire::ContentId::Type a_type = a.type(); - const feedwire::ContentId::Type b_type = b.type(); + const int a_type = a.type(); + const int b_type = b.type(); return std::tie(a.content_domain(), a_id, a_type) < std::tie(b.content_domain(), b_id, b_type); } @@ -219,7 +219,7 @@ feedwire::ClientInfo CreateClientInfo(const RequestMetadata& request_metadata) { #elif defined(OS_IOS) client_info.set_platform_type(feedwire::ClientInfo::IOS); #endif - client_info.set_app_type(feedwire::ClientInfo::CLANK); + client_info.set_app_type(feedwire::ClientInfo::CHROME_ANDROID); *client_info.mutable_platform_version() = GetPlatformVersionMessage(); *client_info.mutable_app_version() = GetAppVersionMessage(request_metadata.chrome_info); diff --git a/components/feed/core/v2/proto_util_unittest.cc b/components/feed/core/v2/proto_util_unittest.cc index 0050caff892914..e545c67b2a18fc 100644 --- a/components/feed/core/v2/proto_util_unittest.cc +++ b/components/feed/core/v2/proto_util_unittest.cc @@ -30,7 +30,7 @@ TEST(ProtoUtilTest, CreateClientInfo) { request_metadata.language_tag = "en-US"; feedwire::ClientInfo result = CreateClientInfo(request_metadata); - EXPECT_EQ(feedwire::ClientInfo::CLANK, result.app_type()); + EXPECT_EQ(feedwire::ClientInfo::CHROME_ANDROID, result.app_type()); EXPECT_EQ(feedwire::Version::RELEASE, result.app_version().build_type()); EXPECT_EQ(1, result.app_version().major()); EXPECT_EQ(2, result.app_version().minor()); diff --git a/components/feed/core/v2/protocol_translator.cc b/components/feed/core/v2/protocol_translator.cc index 53bcff73308be8..ea51901093812d 100644 --- a/components/feed/core/v2/protocol_translator.cc +++ b/components/feed/core/v2/protocol_translator.cc @@ -96,7 +96,7 @@ bool TranslateFeature(feedwire::Feature* feature, result.stream_structure.set_type(type); if (type == feedstore::StreamStructure::CONTENT) { - feedwire::Content* wire_content = feature->mutable_content_extension(); + feedwire::Content* wire_content = feature->mutable_content(); if (!wire_content->has_xsurface_content()) return false; diff --git a/components/feed/core/v2/protocol_translator_unittest.cc b/components/feed/core/v2/protocol_translator_unittest.cc index abb61bc8570f18..17e537be741ca1 100644 --- a/components/feed/core/v2/protocol_translator_unittest.cc +++ b/components/feed/core/v2/protocol_translator_unittest.cc @@ -64,14 +64,12 @@ feedwire::DataOperation MakeDataOperationWithContent( feedwire::DataOperation result = MakeDataOperation(operation); result.mutable_feature()->set_renderable_unit(feedwire::Feature::CONTENT); result.mutable_feature() - ->mutable_content_extension() + ->mutable_content() ->mutable_xsurface_content() ->set_xsurface_output(xsurface_content); - result.mutable_feature() - ->mutable_content_extension() - ->add_prefetch_metadata() - ->set_uri("http://uri-for-" + xsurface_content); + result.mutable_feature()->mutable_content()->add_prefetch_metadata()->set_uri( + "http://uri-for-" + xsurface_content); return result; } @@ -216,7 +214,7 @@ TEST(ProtocolTranslatorTest, TranslateContent) { TEST(ProtocolTranslatorTest, TranslateContentFailsWhenMissingContent) { feedwire::DataOperation wire_operation = MakeDataOperationWithContent(feedwire::DataOperation::UPDATE_OR_APPEND); - wire_operation.mutable_feature()->clear_content_extension(); + wire_operation.mutable_feature()->clear_content(); EXPECT_FALSE(TranslateDataOperation(wire_operation)); } diff --git a/components/feed/core/v2/tasks/upload_actions_task.cc b/components/feed/core/v2/tasks/upload_actions_task.cc index bfaeebdd4b692b..476227bd52caba 100644 --- a/components/feed/core/v2/tasks/upload_actions_task.cc +++ b/components/feed/core/v2/tasks/upload_actions_task.cc @@ -9,7 +9,8 @@ #include "base/metrics/histogram_functions.h" #include "base/time/time.h" #include "components/feed/core/proto/v2/store.pb.h" -#include "components/feed/core/proto/v2/wire/discover_actions_service.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_request.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_response.pb.h" #include "components/feed/core/v2/config.h" #include "components/feed/core/v2/feed_network.h" #include "components/feed/core/v2/feed_store.h" diff --git a/components/feed/core/v2/tasks/upload_actions_task.h b/components/feed/core/v2/tasks/upload_actions_task.h index 25b6d7ba076263..7ba0132b9be73b 100644 --- a/components/feed/core/v2/tasks/upload_actions_task.h +++ b/components/feed/core/v2/tasks/upload_actions_task.h @@ -11,8 +11,9 @@ #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "components/feed/core/proto/v2/store.pb.h" -#include "components/feed/core/proto/v2/wire/discover_actions_service.pb.h" #include "components/feed/core/proto/v2/wire/feed_action.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_request.pb.h" +#include "components/feed/core/proto/v2/wire/upload_actions_response.pb.h" #include "components/feed/core/v2/enums.h" #include "components/feed/core/v2/feed_network.h" #include "components/feed/core/v2/feed_store.h" diff --git a/components/feed/core/v2/test/proto_printer.cc b/components/feed/core/v2/test/proto_printer.cc index 0dcd4d1eca44c2..0d7c192037ffad 100644 --- a/components/feed/core/v2/test/proto_printer.cc +++ b/components/feed/core/v2/test/proto_printer.cc @@ -7,6 +7,7 @@ #include #include #include "base/json/string_escape.h" +#include "components/feed/core/proto/v2/wire/action_payload.pb.h" #include "components/feed/core/proto/v2/wire/client_info.pb.h" #include "components/feed/core/proto/v2/wire/content_id.pb.h" #include "components/feed/core/v2/protocol_translator.h" @@ -126,6 +127,12 @@ class TextProtoPrinter { EndMessage(); return *this; } + TextProtoPrinter& operator<<(const feedwire::ActionPayload& v) { + BeginMessage(); + PRINT_FIELD(action_payload_data); + EndMessage(); + return *this; + } TextProtoPrinter& operator<<(const feedwire::Version& v) { BeginMessage(); PRINT_FIELD(major); @@ -319,6 +326,9 @@ std::string ToTextProto(const feedwire::Version& v) { std::string ToTextProto(const feedwire::ClientInfo& v) { return TextProtoPrinter::ToString(v); } +std::string ToTextProto(const feedwire::ActionPayload& v) { + return TextProtoPrinter::ToString(v); +} std::string ToTextProto(const feedstore::StreamData& v) { return TextProtoPrinter::ToString(v); } diff --git a/components/feed/core/v2/test/proto_printer.h b/components/feed/core/v2/test/proto_printer.h index 17756963578202..e4c8ed0a69df80 100644 --- a/components/feed/core/v2/test/proto_printer.h +++ b/components/feed/core/v2/test/proto_printer.h @@ -12,6 +12,7 @@ #include "components/feed/core/proto/v2/ui.pb.h" namespace feedwire { +class ActionPayload; class ClientInfo; class ContentId; class DisplayInfo; @@ -24,6 +25,7 @@ std::string ToTextProto(const feedwire::ContentId& v); std::string ToTextProto(const feedwire::Version& v); std::string ToTextProto(const feedwire::DisplayInfo& v); std::string ToTextProto(const feedwire::ClientInfo& v); +std::string ToTextProto(const feedwire::ActionPayload& v); std::string ToTextProto(const feedstore::StreamData& v); std::string ToTextProto(const feedstore::Metadata& v); std::string ToTextProto(const feedstore::StreamStructureSet& v); @@ -50,6 +52,10 @@ inline std::ostream& operator<<(std::ostream& os, const feedwire::ClientInfo& v) { return os << ToTextProto(v); } +inline std::ostream& operator<<(std::ostream& os, + const feedwire::ActionPayload& v) { + return os << ToTextProto(v); +} inline std::ostream& operator<<(std::ostream& os, const feedstore::StreamData& v) { return os << ToTextProto(v); diff --git a/components/feed/core/v2/testdata/request.textproto b/components/feed/core/v2/testdata/request.textproto index f71a7c8bd047e4..8a98e0dc420890 100644 --- a/components/feed/core/v2/testdata/request.textproto +++ b/components/feed/core/v2/testdata/request.textproto @@ -8,7 +8,7 @@ feed_request { build_type: DEV api_version: 29 } - app_type: CLANK + app_type: CHROME_ANDROID app_version { major: 79 minor: 0