chromium/ash/webui/help_app_ui/help_app_ui.mojom

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module ash.help_app.mojom;

import "url/mojom/url.mojom";

// Device info obtained via the DeviceInfoManager.
struct DeviceInfo {
  // The board family of the device. e.g. "brya".
  string board;

  // The model of the device. e.g. "taniks".
  string model;

  // The user type of the profile currently running. e.g. "unmanaged".
  // The possible values for this can be found at
  // https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/apps/user_type_filter.cc;l=27;drc=0d0b76e40dfff0f4ad58d0640cdf2c4df72030d3.
  string user_type;

  // If Steam is allowed for the device, regardless of install status.
  bool is_steam_allowed;
};

/**
 * These values correspond to the ActionType enum found at
 * https://source.chromium.org/chromium/chromium/src/+/main:chromeos/ash/components/scalable_iph/scalable_iph_constants.h;drc=ea198b54e3f6b0cfdd6bacbb01c2307fd1797b63;l=10.
 */
enum ActionTypeId {
  INVALID = 0,
  OPEN_CHROME = 1,
  OPEN_LAUNCHER = 2,
  OPEN_PERSONALIZATION_APP = 3,
  OPEN_PLAY_STORE = 4,
  OPEN_GOOGLE_DOCS = 5,
  OPEN_GOOGLE_PHOTOS = 6,
  OPEN_SETTINGS_PRINTER = 7,
  OPEN_PHONE_HUB = 8,
  OPEN_YOUTUBE = 9,
  OPEN_FILE_MANAGER = 10,
};

// Browser interface for chrome://help-app to bootstrap a connection.
interface PageHandlerFactory {
  // Create a page handler which exposes interfaces implemented in the browser
  // process to the renderer process via |handler|.
  CreatePageHandler(pending_receiver<PageHandler> handler);
};

// An interface implemented in the browser process that is exposed to the
// renderer process for chrome://help-app.
interface PageHandler {
  // Opens the chrome feedback dialog.
  OpenFeedbackDialog() => (string? error_message);

  // Opens the on device app controls part of OS settings.
  ShowOnDeviceAppControls();

  // Opens the parental controls part of OS settings.
  ShowParentalControls();

  // Triggers the call-to-action associated with the given action type id.
  TriggerWelcomeTipCallToAction(ActionTypeId action_type_id);

  // Returns true if Local Search Service integration is enabled.
  IsLssEnabled() => (bool enabled);

  // Returns true if the Help App Launcher Search feature is enabled.
  IsLauncherSearchEnabled() => (bool enabled);

  // Launches the MS365 setup flow (or shows the final screen of the flow if it
  // was already completed).
  LaunchMicrosoft365Setup();

  // Request for the help app release notes notification to be shown, if a
  // notification for the Help App has not yet been shown in the current
  // milestone.
  MaybeShowReleaseNotesNotification();

  // Returns device info obtained via the DeviceInfoManager.
  GetDeviceInfo() => (DeviceInfo device_info);

  // Opens a valid https:// URL in a new browser tab without getting intercepted
  // by URL capturing logic. If the "HelpAppAutoTriggerInstallDialog" feature
  // flag is enabled, this will automatically trigger the install dialog.
  // Failure to provide a valid https:// URL will cause the Help app renderer
  // process to crash.
  OpenUrlInBrowserAndTriggerInstallDialog(url.mojom.Url url);
};