naiveproxy/chrome/browser/ui/webui/eoc_internals/eoc_internals.mojom
2018-08-14 22:19:20 +00:00

103 lines
2.7 KiB
Plaintext

// 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 eoc_internals.mojom;
// Distillation of results from a server request for page suggestions.
struct SuggestionResult {
// The URL of the page that the suggestions are for.
string url;
// The conditions under which the peek was displayed.
PeekConditions peek_conditions;
// The suggestions for the page.
array<Suggestion> suggestions;
};
// Tracks the server-defined parameters for when to show the peek bar.
struct PeekConditions {
// A measure of confidence that auto-peek should be enabled for this response
// in the range [0, 1].
float confidence;
// The percentage of the page that the user scrolls required for an auto
// peek to occur.
float page_scroll_percentage;
// The minimum time (seconds) the user spends on the page required for
// auto peek.
float minimum_seconds_on_page;
// The maximum number of auto peeks that we can show for this page.
int64 maximum_number_of_peeks;
};
// Models a single suggestion.
struct Suggestion {
// The URL for the suggestion.
string url;
// Title displayed in the suggestion sheet.
string title;
// Name of the publisher.
string publisher_name;
// Text snippet displayed on the sheet.
string snippet;
// The ID of the image displayed for this suggestion.
string image_id;
// The ID of the favicon for the suggested URL.
string favicon_image_id;
};
// Metrics event that was constructed for a page.
struct MetricEvent {
// The URL which the metrics event is for.
string url;
// Did the sheet peek show.
bool sheet_peeked;
// Was the toolbar button shown.
bool button_shown;
// If the peek was closed without being opened.
bool sheet_opened;
// If the sheet was opened from the peek.
bool sheet_closed;
// If any suggestion was clicked on from the sheet.
bool any_suggestion_taken;
// If any suggestion was downloaded from the sheet.
bool any_suggestion_downloaded;
};
// Browser interface for the page. Consists of calls for data and hooks for
// interactivity.
interface PageHandler {
// Get a key/value mapping of properties.
GetProperties() => (map<string, string> properties);
// Change the triggering time to the given duration.
SetTriggerTime(int64 seconds);
// Get cached metrics.
GetCachedMetricEvents() => (array<MetricEvent> metrics);
// Clear the cached metrics.
ClearCachedMetricEvents() => ();
// Get the cached suggestion results.
GetCachedSuggestionResults() => (array<SuggestionResult> results);
// Clear the cached suggestions.
ClearCachedSuggestionResults() => ();
};