| // 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 blink.mojom; |
| |
| import "url/mojom/url.mojom"; |
| |
| // This mojom file is for user navigation prediction experiment, using anchor |
| // element metrics gathered from the renderer process. See crbug.com/850624. |
| |
| // Struct holding metrics of an anchor element extracted in the renderer |
| // process. |
| struct AnchorElementMetrics { |
| // The ratio between the absolute/visible clickable region area of an anchor |
| // element, and the viewport area. The values are capped at 1. |
| float ratio_area; |
| float ratio_visible_area; |
| |
| // The distance between the top/center of the clickable region of an anchor |
| // element and the top edge of the visible region, divided by the viewport |
| // height. |
| float ratio_distance_top_to_visible_top; |
| float ratio_distance_center_to_visible_top; |
| |
| // The distance between the top of the clickable region of an anchor element |
| // and the top edge of the root frame, divided by the viewport height. |
| float ratio_distance_root_top; |
| |
| // The distance between the bottom of the clickable region of an anchor |
| // element and the bottom edge of the root frame, divided by the viewport |
| // height. |
| float ratio_distance_root_bottom; |
| |
| // Whether the anchor element is within an iframe. |
| bool is_in_iframe; |
| |
| // Whether the anchor element contains an image element. |
| bool contains_image; |
| |
| // Whether the link target has the same host as the root document. |
| bool is_same_host; |
| |
| // Whether the target URL and the host URL only differ by one number, |
| // and the number in target URL equals the one in host URL plus one. |
| bool is_url_incremented_by_one; |
| |
| // The source URL of the root document and the target URL (href) specified by |
| // the anchor element. URLs sent from a renderer process are not trusted, |
| // however it is intended here since it is only used for metrics calculation. |
| url.mojom.Url source_url; |
| url.mojom.Url target_url; |
| }; |
| |
| // An interface to pass descriptive information about anchor elements from |
| // the renderer process to the implementation of this interface living in the |
| // browser process. |
| interface AnchorElementMetricsHost { |
| // This is called when an anchor element is clicked. The renderer extracts and sends |
| // |metrics| of the clicked anchor element. |
| ReportAnchorElementMetricsOnClick(AnchorElementMetrics metrics); |
| |
| // This is called after a web page is loaded. The renderer extracts and sends |
| // |metrics| of anchor elements in the first viewport. |
| ReportAnchorElementMetricsOnLoad(array<AnchorElementMetrics> metrics); |
| }; |