| // Copyright 2023 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module hats.mojom; |
| |
| // Interface for setting up connection to allow calls between the hats web |
| // page and native code. |
| interface PageHandlerFactory { |
| // Called from hats page JS to set up native handler. |
| CreatePageHandler(pending_remote<Page> page, |
| pending_receiver<PageHandler> handler); |
| }; |
| |
| // Called from TS side of chrome-untrusted://hats (Renderer -> Browser) |
| interface PageHandler { |
| // Notifies the browser that a survey has been successfully loaded and is |
| // being displayed within the WebContents. |
| OnSurveyLoaded(); |
| // This event is triggered when the user finishes the entire survey. This will |
| // be triggered before the 'thank you' card is displayed. |
| OnSurveyCompleted(); |
| // Notifies the browser that the survey has been closed and is not being |
| // displayed. |
| OnSurveyClosed(); |
| }; |
| |
| // Called from C++ side of chrome-untrusted://hats. (Browser -> Renderer) |
| interface Page { |
| // Requests the HaTS survey using the API key and given parameters, |
| // as described in go/hats/client/web. |
| // `api_key` is the API Key for the HaTS service. |
| // `trigger_id` is the ID corresponding to the particular survey to be shown. |
| // `enable_testing` is set to true if the survey should always be triggered, |
| // used for testing. Testing mode responses are isolated from production |
| // responses. |
| // `language_list` is the list of preferred languages for the survey. Please |
| // use BCP47 based language codes. The list is in order of preference |
| // and, if available, the language from the list can be used to override |
| // the default configured language of the survey. |
| // `product_specific_data_json` is the json string for the product specific |
| // data associated with this survey. Product specific data for a particular |
| // survey is as declared in chrome/browser/ui/hats/survey_config.cc. |
| RequestSurvey(string api_key, |
| string trigger_id, |
| bool enable_testing, |
| array<string> language_list, |
| string product_specific_data_json); |
| }; |