<!--
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.
-->

<!--
This file is used to generate a comprehensive list of Sharing histograms
along with a detailed description for each histogram.

For best practices on writing histogram descriptions, see
https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md

Please follow the instructions in the OWNERS file in this directory to find a
reviewer. If no OWNERS file exists, please consider signing up at
go/reviewing-metrics (Googlers only), as all subdirectories are expected to
have an OWNERS file. As a last resort you can send the CL to
chromium-metrics-reviews@google.com.
-->

<histogram-configuration>

<histograms>

<histogram name="Sharing.AnyShareStarted" enum="ShareSourceAndroid"
    expires_after="never">
  <owner>dimich@chromium.org</owner>
  <owner>sophey@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <improvement direction="HIGHER_IS_BETTER"/>
  <summary>
    The UI surface that started any share attempt. Android only.

    This is a vital metric for the sharing team; please do not remove it or
    change its behavior without consulting the metric owners.
  </summary>
</histogram>

<histogram name="Sharing.AnyShareStartedDesktop" enum="ShareSourceDesktop"
    expires_after="never">
  <owner>dimich@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <improvement direction="HIGHER_IS_BETTER"/>
  <summary>
    The UI surface that started any share attempt. Desktop only.

    This is a vital metric for the sharing team; please do not remove it or
    change its behavior without consulting the metric owners.
  </summary>
</histogram>

<histogram name="Sharing.ClickToCallDevicesToShow" units="devices"
    expires_after="2022-10-23">
<!-- Name completed by histogram_suffixes name="SharingClickToCallUi" -->

  <owner>mvanouwerkerk@chromium.org</owner>
  <owner>peter@chromium.org</owner>
  <summary>
    The number of available devices that are about to be shown in a UI for
    picking a device to start a phone call on. Desktop only.
  </summary>
</histogram>

<histogram name="Sharing.ClickToCallDialerPresent" enum="BooleanPresent"
    expires_after="2023-06-25">
  <owner>mvanouwerkerk@chromium.org</owner>
  <owner>knollr@chromium.org</owner>
  <summary>
    Logged when we try to fire a dial intent in click to call. Distinguishes
    between if the user has an app that can handle dial intent or not. Android
    only.
  </summary>
</histogram>

<histogram name="Sharing.ClickToCallDialogShown" enum="SharingDialogType"
    expires_after="2021-10-25">
  <owner>mvanouwerkerk@chromium.org</owner>
  <owner>knollr@chromium.org</owner>
  <summary>
    Logged whenever a dialog is shown for the Click to Call feature. Desktop
    only.
  </summary>
</histogram>

<histogram name="Sharing.ClickToCallPhoneNumberValid" enum="BooleanValid"
    expires_after="M98">
  <owner>knollr@chromium.org</owner>
  <owner>peter@chromium.org</owner>
  <summary>
    Records if a received phone number is valid. Invalid numbers might suggest
    that the remote device tried to send malicious data. Logged when handling a
    Click to Call message on Android received from a Chrome desktop instance.
  </summary>
</histogram>

<histogram name="Sharing.ClickToCallSelectedAppIndex" units="index"
    expires_after="2023-03-05">
<!-- Name completed by histogram_suffixes name="SharingClickToCallUi" -->

  <owner>mvanouwerkerk@chromium.org</owner>
  <owner>peter@chromium.org</owner>
  <summary>
    The index of the app selected by the user for Click to Call. Zero based.
    Desktop only.
  </summary>
</histogram>

<histogram name="Sharing.ClickToCallSelectedDeviceIndex" units="index"
    expires_after="2024-03-24">
<!-- Name completed by histogram_suffixes name="SharingClickToCallUi" -->

  <owner>mvanouwerkerk@chromium.org</owner>
  <owner>peter@chromium.org</owner>
  <summary>
    The index of the device selected by the user for Click to Call. Zero based.
    Desktop only.
  </summary>
</histogram>

<histogram name="Sharing.DefaultSharesheetAndroid.Opened" enum="ShareOrigin"
    expires_after="2024-03-24">
  <owner>wenyufu@chromium.org</owner>
  <owner>sophey@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records the origin of the share that opened the default sharesheet. Recorded
    when the sharesheeet is opened.
  </summary>
</histogram>

<histogram name="Sharing.MessageReceivedType" enum="SharingMessageType"
    expires_after="2024-02-20">
  <owner>mvanouwerkerk@chromium.org</owner>
  <owner>peter@chromium.org</owner>
  <summary>
    The type of SharingMessage (aka the PayloadCase). This is logged when a
    message is received through FCM by the handler in the Sharing service. All
    platforms.
  </summary>
</histogram>

<histogram name="Sharing.PreparePreviewFaviconDuration" units="ms"
    expires_after="2024-01-21">
  <owner>wenyufu@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    The time to download the favicon as the image preview for sharing an link
    using Android share sheet. Recorded when sharing a link with Android share
    sheet only.
  </summary>
</histogram>

<histogram name="Sharing.QRCodeGeneration.Duration" units="ms"
    expires_after="2024-03-17">
  <owner>danakj@chromium.org</owner>
  <owner>lukasza@chromium.org</owner>
  <owner>petewil@chromium.org</owner>
  <summary>
    The end-to-end time to encode a QR image.

    This metric captures end-to-end time which may include the overhead of
    spawning a utility process as well as the time needed to translate input
    bytes into QR pixels (see also the &quot;BytesToQrPixels2&quot; metric) and
    into QR image (see also the &quot;QrPixelsToQrImage2&quot; metric).

    Recorded whenever `chrome/services/qrcode_generator` generates a QR code.
    For example: when using the omnibox to share the URL via QR code, when using
    WebAuthn, or when generating an RMA.
  </summary>
</histogram>

<histogram name="Sharing.QRCodeGeneration.Duration.BytesToQrPixels2"
    units="microseconds" expires_after="2023-11-12">
  <owner>danakj@chromium.org</owner>
  <owner>lukasza@chromium.org</owner>
  <owner>petewil@chromium.org</owner>
  <summary>
    The time to translate the sequence of input bytes into a vector of QR pixels
    (this is not a QR _image_ just yet - see &quot;QrPixelsToQrImage2&quot;
    metric for that).

    Recorded whenever `chrome/services/qrcode_generator` generates a QR code.
    For example: when using the omnibox to share the URL via QR code, when using
    WebAuthn, or when generating an RMA.

    The metric is reported for only clients with high-resolution clocks (i.e.
    excludes a small percentage of Windows users population). This is okay,
    because we are mostly interested in comparing C++ vs Rust and it seems okay
    to assume that such comparison would give similar results for the filtered
    and non-filtered population.
  </summary>
</histogram>

<histogram name="Sharing.QRCodeGeneration.Duration.QrPixelsToQrImage2"
    units="microseconds" expires_after="2024-03-17">
  <owner>danakj@chromium.org</owner>
  <owner>lukasza@chromium.org</owner>
  <owner>petewil@chromium.org</owner>
  <summary>
    The time to translate QR pixels (a vector of light/dark QR pixels) into a QR
    image (an upscaled `SkBitmap` with an optional Dino painted in the middle).

    Recorded whenever `chrome/services/qrcode_generator` generates a QR code.
    For example: when using the omnibox to share the URL via QR code, when using
    WebAuthn, or when generating an RMA.

    The metric is reported for only clients with high-resolution clocks (i.e.
    excludes a small percentage of Windows users population). This is okay,
    because we are mostly interested in comparing C++ vs Rust and it seems okay
    to assume that such comparison would give similar results for the filtered
    and non-filtered population.
  </summary>
</histogram>

<histogram name="Sharing.Screenshot.Action" enum="SharingScreenshotAction"
    expires_after="2023-11-19">
  <owner>jeffreycohen@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Logged when actions are taken in the sharing screenshot image editing
    feature.
  </summary>
</histogram>

<histogram name="Sharing.ScreenshotFallback.Action"
    enum="SharingScreenshotFallbackAction" expires_after="2022-12-25">
  <owner>jeffreycohen@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Logged when actions are taken in the sharing screenshot fallback feature.
  </summary>
</histogram>

<histogram name="Sharing.ScrollCapture.BitmapGeneratorStatus"
    enum="SharingScrollCaptureBitmapGenerationStatus"
    expires_after="2024-10-01">
  <owner>ckitagawa@chromium.org</owner>
  <owner>src/components/paint_preview/OWNERS</owner>
  <summary>
    Records the status of the Bitmap Generator when capturing scroll capture
    long screenshot. Recorded after the page capture request is sent to the
    paint_preview capture service and compositor, when the service is no longer
    busy. This metric is only emitted on Android S+.
  </summary>
</histogram>

<histogram name="Sharing.ScrollCapture.SuccessfulCaptureDuration" units="ms"
    expires_after="2024-10-01">
  <owner>ckitagawa@chromium.org</owner>
  <owner>src/components/paint_preview/OWNERS</owner>
  <summary>
    Records the total time spent capturing a long screenshot of a page using
    scroll capture. It is recorded when a scroll capture request successfully
    finishes. This metric is only emitted on Android S+.
  </summary>
</histogram>

<histogram name="Sharing.SendMessageResult" enum="SharingSendMessageResult"
    expires_after="2024-03-24">
<!-- Name completed by histogram_suffixes SharingChannelType,
    SharingDevicePlatform, SharingMessage, and SharingPulseInterval. -->

  <owner>peter@chromium.org</owner>
  <owner>knollr@chromium.org</owner>
  <summary>
    Result of sending a SharingMessage by the Sharing service. Logged after the
    send message callback is run. Not logged for sending ack messages. All
    platforms.
  </summary>
</histogram>

<histogram name="Sharing.SendTabToSelf.NotificationStatus"
    enum="SendTabToSelfNotificationStatus" expires_after="2024-03-17">
  <owner>jeffreycohen@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Status of STTS notifications. Recorded whenever a target device is chosen, a
    recieved notification is shown, or an action is taken on the notification.
  </summary>
</histogram>

<histogram name="Sharing.SharedClipboardDevicesToShow" units="devices"
    expires_after="M88">
  <owner>mvanouwerkerk@chromium.org</owner>
  <owner>knollr@chromium.org</owner>
  <summary>
    The number of available devices that are about to be shown in a UI for
    picking a device to share the clipboard with. On desktop, it gets recorded
    when the user right clicks on selected text. On Android, it gest recorded
    when the user does long press, share and &quot;Send text to Your
    Devices&quot;.
  </summary>
</histogram>

<histogram name="Sharing.SharedClipboardDialogShown" enum="SharingDialogType"
    expires_after="M88">
  <owner>mvanouwerkerk@chromium.org</owner>
  <owner>knollr@chromium.org</owner>
  <summary>
    Logged whenever a dialog is shown for the Shared Clipboard feature.
  </summary>
</histogram>

<histogram name="Sharing.SharedClipboardSelectedDeviceIndex" units="index"
    expires_after="M88">
  <owner>mvanouwerkerk@chromium.org</owner>
  <owner>knollr@chromium.org</owner>
  <summary>
    The index of the device selected by the user for Shared Clipboard gets
    recorded when the user chooses the destination device for sharing text. Zero
    based.
  </summary>
</histogram>

<histogram name="Sharing.SharingHubAndroid.Opened" enum="ShareOrigin"
    expires_after="2024-03-24">
  <owner>wenyufu@chromium.org</owner>
  <owner>sophey@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records the origin of the share that opened the sharing hub. Recorded when
    the sharing hub is opened.
  </summary>
</histogram>

<histogram name="Sharing.SharingHubAndroid.ThirdPartyAppUsage"
    enum="SharingHubBottomRowIndex" expires_after="2024-01-21">
  <owner>wenyufu@chromium.org</owner>
  <owner>sophey@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records the index of the third party app selected from the bottom row of the
    sharing hub.
  </summary>
</histogram>

<histogram name="Sharing.SharingHubAndroid.TimeToShare" units="ms"
    expires_after="2024-03-24">
  <owner>wenyufu@chromium.org</owner>
  <owner>sophey@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records the amount of time taken for the user to select a share target after
    initiating a share.
  </summary>
</histogram>

<histogram name="Sharing.SharingHubAndroid.TimeToShowShareSheet" units="ms"
    expires_after="2024-01-21">
  <owner>wenyufu@chromium.org</owner>
  <owner>sophey@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records the amount of time taken for the custom share sheet to open after a
    share was initiated.
  </summary>
</histogram>

<histogram name="Sharing.SharingHubAndroid.{DetailedContentType}.{ShareStatus}"
    enum="LinkToggleState" expires_after="2024-03-24">
  <owner>wenyufu@chromium.org</owner>
  <owner>sophey@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records what the link toggle state is when a share of a
    {DetailedContentType} is {ShareStatus}.
  </summary>
  <token key="DetailedContentType">
    <variant name="Gif"/>
    <variant name="HighlightedText"/>
    <variant name="Image"/>
    <variant name="LightweightReaction"/>
    <variant name="NotSpecified"/>
    <variant name="Screenshot"/>
    <variant name="Webnotes"/>
  </token>
  <token key="ShareStatus">
    <variant name="Completed"/>
    <variant name="InProgress"/>
  </token>
</histogram>

<histogram name="Sharing.SharingHubDesktop.CrOSSharesheetResult"
    enum="SharingHubSharesheetResult" expires_after="2024-03-17">
  <owner>tsergeant@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records whether the user selects a share target after opening the Chrome OS
    sharesheet.
  </summary>
</histogram>

<histogram name="Sharing.SharingHubDesktop.TimeToFetchFaviconPreviewImage"
    units="ms" expires_after="2023-03-12">
  <obsolete>
    Never actually logged in production, removed in M111.
  </obsolete>
  <owner>ellyjones@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records the elapsed time (in milliseconds) between the sharing hub becoming
    visible on screen and the favicon image (if there is one) replacing the
    default image. Only logged for cases where the favicon is both present and
    is delivered to the sharing hub asynchronously, so this metric tracks how
    slow async favicon fetching is.
  </summary>
</histogram>

<histogram name="Sharing.SharingHubDesktop.TimeToFetchHQPreviewImage"
    units="ms" expires_after="2023-03-12">
  <obsolete>
    Never actually logged in production, removed in M111.
  </obsolete>
  <owner>ellyjones@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records the elapsed time (in milliseconds) between the sharing hub becoming
    visible on screen and the high-quality image (if there is one) replacing the
    default image. Only logged for cases where such a replacement eventually
    happens - pages with no high-quality image do not produce an entry. This
    metric essentially tracks how slow asynchronous HQ image fetching is.
  </summary>
</histogram>

<histogram name="Sharing.SharingHubDesktop.TimeToShow" units="ms"
    expires_after="2023-12-04">
  <owner>ellyjones@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    Records the elapsed time (in milliseconds) between the user gesture that
    should summon the sharing hub and the sharing hub actually becoming visible
    on screen.
  </summary>
</histogram>

<histogram name="Sharing.SmsFetcherAvailableDeviceCount" units="devices"
    expires_after="2024-03-01">
  <owner>yigu@chromium.org</owner>
  <owner>src/content/browser/sms/OWNERS</owner>
  <summary>
    The number of available devices when making a request on desktop which is
    triggered by calling the WebOTP API. This is logged once per API call.
    Desktop only.
  </summary>
</histogram>

<histogram name="Sharing.SmsFetcherClientNameIsEmpty" enum="BooleanEmpty"
    expires_after="2024-03-01">
  <owner>yigu@chromium.org</owner>
  <owner>src/content/browser/sms/OWNERS</owner>
  <summary>
    Records whether the remote client name is empty. This could happen on early
    version of Chrome. This is logged once per notification when asking for user
    permission to submit the one-time-passwords on the remote device.
  </summary>
</histogram>

<histogram name="Sharing.SmsFetcherScreenOnAndUnlocked" enum="Boolean"
    expires_after="2024-03-01">
  <owner>yigu@chromium.org</owner>
  <owner>src/content/browser/sms/OWNERS</owner>
  <summary>
    Records whether the phone is on and unlocked when we show the notification
    to users. False if either the phone is locked or the phone does not have a
    screen lock but the screen is off. This is logged once per notification.
  </summary>
</histogram>

<histogram name="Sharing.SmsFetcherTapWithChromeDestroyed" enum="Boolean"
    expires_after="2024-03-01">
  <owner>yigu@chromium.org</owner>
  <owner>src/content/browser/sms/OWNERS</owner>
  <summary>
    Records whether a user taps/dismisses the notification after Chrome is
    destroyed. This could happen if the user manually swipes away Chrome from
    the task switcher or the OS decides to destroy Chrome due to lack of memory
    etc. This is logged once per user action on the notification.
  </summary>
</histogram>

<histogram name="Sharing.WebRtc.IceConfigFetched" units="ice_servers"
    expires_after="2022-04-03">
  <owner>peter@chromium.org</owner>
  <owner>knollr@chromium.org</owner>
  <summary>
    Number of ice servers fetched by network traversal API call. Logged after
    receiving response of API call.
  </summary>
</histogram>

<histogram name="Sharing.{ShareSurface}.ShareContentType"
    enum="SharingContentTypeAndroid" expires_after="2024-03-24">
  <owner>wenyufu@chromium.org</owner>
  <owner>src/chrome/browser/share/OWNERS</owner>
  <summary>
    The content type being shared when using a share sheet. Recorded when share
    is sent to share sheet for {ShareSurface}. Android only.
  </summary>
  <token key="ShareSurface">
    <variant name="DefaultSharesheetAndroid" summary="System share sheet"/>
    <variant name="SharingHubAndroid" summary="Chrome's sharing hub"/>
  </token>
</histogram>

</histograms>

</histogram-configuration>
