# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Adding a new metric? We have docs for that!
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html

---
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
$tags:
  - 'Toolkit :: Default Browser Agent'

system:
  os_version:
    type: string
    description: >
      The current Windows OS version, usually as a dotted quad ("x.y.z.w") with
      Windows Update Build Revision (UBR), but potentially as a dotted triple
      ("x.y.z") without UBR.
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1850149
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1850149
    data_sensitivity:
      - technical
    notification_emails:
      - install-update@mozilla.com
    expires: never
    send_in_pings:
      - default-agent

  previous_os_version:
    type: string
    description: >
      The Windows OS version before it was changed to the current setting. The
      possible values are the same as for `system.os_version`.

      The OS does not keep track of the previous OS version, so the agent
      records this information itself. That means that it will be inaccurate
      until the first time the default is changed after the agent task begins
      running. Before then, the value of `previous_os_version` will be the same
      as `os_version`.

      This value is updated every time the Default Agent runs, so when the
      default browser is first changed the values for `os_version` and
      `previous_os_version` will be different. But on subsequent executions of
      the Default Agent, the two values will be the same.
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1850149
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1850149
    data_sensitivity:
      - technical
    notification_emails:
      - install-update@mozilla.com
    expires: never
    send_in_pings:
      - default-agent

system_default:
  browser:
    type: string
    description: >
      Which browser is currently set as the system default web browser. This is
      simply a string with the name of the browser binned to a fixed set of
      known browsers.

      Possible values currently include the following (from
      [DefaultBrowser.cpp](https://searchfox.org/firefox-main/source/toolkit/mozapps/defaultagent/DefaultBrowser.cpp)):
      * "error"
      * "" (unknown)
      * "firefox"
      * "chrome"
      * "edge"
      * "edge-chrome"
      * "ie"
      * "opera"
      * "brave"
      * "yandex"
      * "qq-browser"
      * "360-browser"
      * "sogou"
      * "duckduckgo"
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1838755
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1621293
    data_sensitivity:
      - technical
    notification_emails:
      - install-update@mozilla.com
    expires: never
    send_in_pings:
      - default-agent

  previous_browser:
    type: string
    description: >
      Which browser was set as the system default before it was changed to the
      current setting. The possible values are the same as for
      `system_default.browser`.

      The OS does not keep track of previous default settings, so the agent
      records this information itself. That means that it will be inaccurate
      until the first time the default is changed after the agent task begins
      running. Before then, the value of `previous_browser` will be the same
      as `browser`.

      This value is updated every time the Default Agent runs, so when the
      default browser is first changed the values for `browser` and
      `previous_browser` will be different. But on subsequent executions of
      the Default Agent, the two values will be the same.
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1838755
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1621293
    data_sensitivity:
      - technical
    notification_emails:
      - install-update@mozilla.com
    expires: never
    send_in_pings:
      - default-agent

  pdf_handler:
    type: string
    description: >
      Which pdf handler is currently set as the system default handler. This is
      simply a string with the name of the handler binned to a fixed set of
      known handlers.

      Possible values currently include the following (from
      [DefaultPDF.cpp](https://searchfox.org/firefox-main/source/toolkit/mozapps/defaultagent/DefaultPDF.cpp)):
      * "Error"
      * "" (unknown)
      * "Firefox"
      * "Microsoft Edge"
      * "Google Chrome"
      * "Adobe Acrobat"
      * "WPS"
      * "Nitro"
      * "Foxit"
      * "PDF-XChange"
      * "Avast"
      * "Sumatra"
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1756900
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1756900
    data_sensitivity:
      - technical
    notification_emails:
      - install-update@mozilla.com
    expires: never
    send_in_pings:
      - default-agent

notification:
  show_success:
    type: boolean
    description: >
      Whether a notification was shown or not. Possible value include "shown" and "error".
    notification_emails:
        - install-update@mozilla.com
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1838755
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1621293
    expires: never
    send_in_pings:
      - default-agent

  action:
    type: string
    description: >
      The action that the user took in response to the notification. Possible
      values currently include the following:
      * “dismissed-by-timeout”
      * “dismissed-to-action-center”
      * “dismissed-by-button”
      * “dismissed-by-application-hidden”
      * “make-firefox-default-button”
      * “toast-clicked”

      Many of the values correspond to buttons on the notification and should be
      pretty self explanatory, but a few are less so.
      * “dismissed-to-action-center” will be used if the user clicks the arrow in
        the top right corner of the notification to dismiss it to the
        action center.
      * “dismissed-by-application-hidden” is provided because that is a method of
        dismissal that the notification API could give but, in practice, should
        never be seen.
      * “dismissed-by-timeout” indicates that the user did not interact with the
        notification and it timed out.
    notification_emails:
        - install-update@mozilla.com
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1838755
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1621293
    expires: never
    send_in_pings:
      - default-agent

system_pin:
  is_taskbar_pinned:
    type: string
    description: >
      Whether Firefox is currently pinned to the Windows taskbar.

      Possible values:
      * "IsPinned"
      * "NotPinned"
      * "Error"
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2041932
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2041932
    data_sensitivity:
      - technical
    notification_emails:
      - install-update@mozilla.com
    expires: never
    send_in_pings:
      - default-agent

  previous_is_taskbar_pinned:
    type: string
    description: >
      Whether Firefox was pinned to the Windows taskbar as of the previous ping.

      Possible values are the same as for `system_pin.is_taskbar_pinned`.

      The OS does not keep track of previous pin state, so the agent records
      this information itself. That means that it will be inaccurate until the
      first time the pin state changes after the agent task begins running.
      Before then, the value of `previous_is_taskbar_pinned` will be the same
      as `is_taskbar_pinned`.

      This value is updated only when a ping is actually sent, so transitions
      are not missed across rate-limited runs.
    lifetime: application
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2041932
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2041932
    data_sensitivity:
      - technical
    notification_emails:
      - install-update@mozilla.com
    expires: never
    send_in_pings:
      - default-agent

defaultagent:
  days_since_last_app_launch:
    type: quantity
    description: >
      Number of days since the app last launched. Once this reaches 90 days, the installation
      will stop running the default browser agent.
    notification_emails:
        - install-update@mozilla.com
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1843667
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1843667
    data_sensitivity:
      - technical
    expires: never
    send_in_pings:
      - default-agent
    unit: days
