blob: 1fc7f9cf585a071aab31bffc65ef73ebbb3b03d4 [file] [log] [blame]
// Copyright 2018 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.
module feed_internals.mojom;
import "mojo/public/mojom/base/time.mojom";
import "url/mojom/url.mojom";
// General properties of Feed suggestions.
struct Properties {
// Whether the Feed feature flag is enabled.
bool is_feed_enabled;
// Whether suggested articles section is expanded.
bool is_feed_visible;
// Whether suggested articles are allowed. Typically set by policy.
bool is_feed_allowed;
// Whether prefetching for offline availability is enabled.
bool is_prefetching_enabled;
// Whether the WebFeed UI is enabled.
bool is_web_feed_ui_enabled;
// Whether debugging the WebFeed follow intro is enabled.
bool is_web_feed_follow_intro_debug_enabled;
// Last load stream status, human readable.
string load_stream_status;
// Feed fetch URL.
url.mojom.Url feed_fetch_url;
// Feed upload actions URL.
url.mojom.Url feed_actions_url;
};
struct UserClassifier {
// User class description.
string user_class_description;
// Estimated average length of time between two successive suggestion views of
// in hours.
float avg_hours_between_views;
// Estimated average length of time between two successive uses of suggestions
// in hours.
float avg_hours_between_uses;
};
struct LastFetchProperties {
// Last fetch status.
int32 last_fetch_status;
// Reason for the last fetch.
string last_fetch_trigger;
// Last fetch time. Zero if there was no last fetch.
mojo_base.mojom.TimeDelta last_fetch_time;
// Time until which the scheduler will stop requesting refreshes.
// Zero if there is direct user interaction.
mojo_base.mojom.TimeDelta refresh_suppress_time;
// For test server authentication.
string last_bless_nonce;
// Last net status for actions upload.
int32 last_action_upload_status;
// Last action upload time.
mojo_base.mojom.TimeDelta last_action_upload_time;
};
// Models a single suggestion in the Feed.
struct Suggestion {
// Title of the suggestion.
string title;
// URL of the suggested page.
url.mojom.Url url;
// Name of the content's publisher.
string publisher_name;
// URL of the image associated with the suggestion.
url.mojom.Url image_url;
// URL of the suggested page's favicon.
url.mojom.Url favicon_url;
};
// Browser interface for the page. Consists of calls for data and hooks for
// interactivity.
interface PageHandler {
// Get general property values.
GetGeneralProperties() => (Properties properties);
// Get user classifier property values.
GetUserClassifierProperties() => (UserClassifier properties);
// Clear stored properties for the user classifier.
ClearUserClassifierProperties();
// Get last fetch data.
GetLastFetchProperties() => (LastFetchProperties properties);
// Clear all data cached by the Feed library. Also triggers a refresh of the
// Feed.
ClearCachedDataAndRefreshFeed();
// Trigger a refresh of the Feed.
RefreshFeed();
// Get the last known content with metadata.
GetCurrentContent() => (array<Suggestion> suggestions);
// Internal state dump of the Feed library's process scope. Human-readable.
GetFeedProcessScopeDump() => (string dump);
// Record all Feed metrics into a human-readable log.
GetFeedHistograms() => (string log);
// Overrides the scheme, host, and port used to make Feed Query requests.
// Other URL components, like the path, are ignored.
// Empty to clear override.
// This allows for testing the Feed against a development server.
OverrideFeedHost(url.mojom.Url host);
// Overrides the scheme, host, and port used to make Discover API requests.
// Other URL components, like the path, are ignored.
// Empty to clear override.
// This allows for testing the Feed against a development server.
OverrideDiscoverApiEndpoint(url.mojom.Url endpoint_url);
// Overrides the feed stream data with the payload inside a feedui::Slice for
// testing purpose. See go/feed-stream-data-testing for more details.
OverrideFeedStreamData(array<uint8> data);
// Sets whether the WebFeed UI is enabled.
SetWebFeedUIEnabled(bool enabled);
// Sets whether debugging the WebFeed follow intro is enabled.
SetWebFeedFollowIntroDebugEnabled(bool enabled);
};