// Copyright 2024 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. module whats_new.mojom; import "mojo/public/mojom/base/time.mojom"; import "url/mojom/url.mojom"; // Used by the WebUI page to bootstrap bidirectional communication. interface PageHandlerFactory { // Creates the `handler` to be used for communication between the browser // and the renderer. CreatePageHandler(pending_receiver handler); }; // Enum used to depict what quartile of the page the user scrolled to. enum ScrollDepth { // 0% k0 = 0, // 25% k25 = 25, // 50% k50 = 50, // 75% k75 = 75, // 100% (Bottom of the page) k100 = 100, }; // Enum used to depict the module position within its section. // There are 4 possible positions in "Spotlight" and 6 positions in the // "Explore More" section. enum ModulePosition { kSpotlight1 = 1, kSpotlight2 = 2, kSpotlight3 = 3, kSpotlight4 = 4, kExploreMore1 = 5, kExploreMore2 = 6, kExploreMore3 = 7, kExploreMore4 = 8, kExploreMore5 = 9, kExploreMore6 = 10, kUndefined = 11, }; // Browser-side handler for requests from WebUI page. interface PageHandler { // Returns the URL of the What's New page to show. GetServerUrl(bool is_staging) => (url.mojom.Url url); // Record when the content was loaded. // Time passed from JS is based on Unix epoch. RecordTimeToLoadContent(mojo_base.mojom.JSTime time); // Record metric when a version page was loaded. RecordVersionPageLoaded(bool is_auto_open); // Record metric for which edition page was loaded. RecordEditionPageLoaded(string page_uid, bool is_auto_open); // Record metric that a module was seen by the user. RecordModuleImpression(string module_name, ModulePosition position); // Record metric for expanding/collapsing "Explore More" section. RecordExploreMoreToggled(bool expanded); // Record metric that page was scrolled. RecordScrollDepth(ScrollDepth depth); // Record metric for how long page was shown. RecordTimeOnPage(mojo_base.mojom.TimeDelta time, bool is_heartbeat); // Record metric for a click event within a module. RecordModuleLinkClicked(string module_name, ModulePosition position); // Record metric for a video starting within a module. RecordModuleVideoStarted(string module_name, ModulePosition position); // Record metric for a video ending within a module. RecordModuleVideoEnded(string module_name, ModulePosition position); // Record metric for a click event on the play button within a module. RecordModulePlayClicked(string module_name, ModulePosition position); // Record metric for a click event on the pause button within a module. RecordModulePauseClicked(string module_name, ModulePosition position); // Record metric for a click event on the restart button within a module. RecordModuleRestartClicked(string module_name, ModulePosition position); // Record metric when browser commands are executed. RecordBrowserCommandExecuted(); // Record metric when the QR code toggle is expanded/collapsed. RecordQrCodeToggled(bool expanded); // Record metric when the user clicks any navigation. RecordNavClick(); // Record metric when the user clicks on a feature tile. RecordFeatureTileNavigation(); // Record metric when the user clicks on a carousel scroll button. RecordCarouselScrollButtonClick(); // Record metric when the user expands/collapses media. RecordExpandMediaToggled(string module_name, bool expanded); // Record metric when the user clicks on a CTA. RecordCtaClick(); // Record metric when the user clicks on the next button. RecordNextButtonClick(); };