blob: 7e5201566a60e61c32b165668bcc0f31e027acd8 [file] [log] [blame]
// Copyright 2017 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 mojom;
import "url/mojom/url.mojom";
struct PreviewsStatus {
// The human readable description of the status that will be displayed on
// chrome://interventions-internals.
string description;
bool enabled;
// The ID of the html DOM element.
string htmlId;
};
struct PreviewsFlag {
// The human readable description of the flag that will be displayed on
// chrome://interventions-internals.
string description;
// The link to this flag in chrome://flags.
string link;
// The string representation of the flag value.
string value;
// The ID of the html DOM element.
string htmlId;
};
struct MessageLog {
// The tye of event message (E.g. "Navigation").
string type;
// The human readable description of the event.
string description;
// The url that associated with the event.
url.mojom.Url url;
// The time when the event happened in millisecond since Unix epoch.
int64 time;
// The ID associated with the request, for grouping log messages in the UI. If
// |id| is 0, then they will not be grouped, since pageId values start at 1.
uint64 page_id;
};
interface InterventionsInternalsPageHandler {
// Returns a map of previews modes statuses.
GetPreviewsEnabled() => (array<PreviewsStatus> statuses);
// Returns a map of previews related flags details.
GetPreviewsFlagsDetails() => (array<PreviewsFlag> flags);
// Inject the client side page object.
SetClientPage(InterventionsInternalsPage page);
// Change the status of ignoring blacklist to |ignored|. |ignored| will
// indicate whether the blacklist decision would be ignored when deciding if a
// preview should be shown or not.
SetIgnorePreviewsBlacklistDecision(bool ignored);
};
interface InterventionsInternalsPage {
// Pushes a new log message to the page. This is called by
// InterventionsInternalsPageHandler when it receives a new MessageLog, and
// publishes it on the javscript side.
LogNewMessage(MessageLog log);
// Notify the page that |host| has been blacklisted at |time|. The method is
// called by InterventionsInternalsPageHandler when PreviewsUIService receives
// new blacklisted host.
OnBlacklistedHost(string host, int64 time);
// Notify the page that user blacklisted status has changed to |blacklisted|.
// The method is called by InterventionsInternalsPageHandler when user's
// blacklist status changes.
OnUserBlacklistedStatusChange(bool blacklisted);
// Notify the page that the blacklist is cleared at |time|. The method is
// called by InterventionsInternalsPageHandler when PreviewsUIService clears
// the blacklist.
OnBlacklistCleared(int64 time);
// Notify the page on the new estimated effective connection type is |type|.
// Also reports the session's maximum intervention effective connection type
// |max_intervention_type| for slow pages. This method is called by
// InterventionsInternalsPageHandler when the estimate network quality
// changes.
UpdateEffectiveConnectionType(string type, string max_intervention_type);
// Notify the page on whether the blacklist decision is considered or ignored.
// This method is called by InterventionsInternalsPageHandler when the status
// of ignore blacklist decision is updated to |ignored|.
OnIgnoreBlacklistDecisionStatusChanged(bool ignored);
};