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

<variants name="AppendCommandsSlice">
  <variant name="Append"/>
  <variant name="Truncate"/>
</variants>

<variants name="CommandStorageSessionType">
  <variant name="AppRestore"/>
  <variant name="SessionRestore"/>
  <variant name="TabRestore"/>
</variants>

<variants name="EncryptedStatus">
  <variant name="Cleartext"/>
  <variant name="Encrypted"/>
</variants>

<variants name="SmartRestartTabCount">
  <variant name="" summary="all sessions"/>
  <variant name=".HighTab" summary="sessions with more than 20 tabs"/>
  <variant name=".LowTab" summary="sessions with 1-5 tabs"/>
  <variant name=".MediumTab" summary="sessions with 6-20 tabs"/>
</variants>

<histogram name="Session.Android.TabbedSessionContainedGoogleSearch"
    enum="Boolean" expires_after="2027-01-17">
  <owner>nafisabedin@google.com</owner>
  <owner>yfriedman@chromium.org</owner>
  <summary>
    Records true if the Google Search Results Page is ever visited during a
    session for a given ChromeTabbedActivity, false otherwise.

    Recorded when an UMA Session ends.
  </summary>
</histogram>

<histogram name="Session.Background.TotalDuration" units="ms"
    expires_after="2027-01-03">
  <owner>asvitkine@chromium.org</owner>
  <owner>src/base/metrics/OWNERS</owner>
  <summary>
    Sum of this metric yields the total time Chrome was running in the
    background. A single session may be represented by multiple values, so that
    this histogram is always present in an uploaded log that represents
    background activity.

    Android-only.
  </summary>
</histogram>

<histogram name="Session.BrowserFullscreen.DurationUpTo24H" units="ms"
    expires_after="2027-02-07">
  <owner>avi@chromium.org</owner>
  <owner>chrome-mac-dev@google.com</owner>
  <summary>
    The total time a Chrome browser window spends in fullscreen. Content
    fullscreen is not represented. Records are capped at 24 hours.

    The metric is recorded when a browser window exits fullscreen or after 24
    hours has elapsed, whichever comes first. This includes quitting the browser
    while in fullscreen.

    Mac-only.
  </summary>
</histogram>

<histogram
    name="Session.CommandStorageBackend.{SessionType}.{EncryptedStatus}.AppendCommands.{Slice}.Duration"
    units="ms" expires_after="2027-01-01">
  <owner>sammon@google.com</owner>
  <owner>dljames@chromium.org</owner>
  <summary>
    The duration of the AppendCommands operation for {SessionType} sessions
    ({EncryptedStatus}), when the truncate parameter was {Slice}. AppendCommands
    is typically called periodically during a browser session to save the
    current session state.
  </summary>
  <token key="SessionType" variants="CommandStorageSessionType"/>
  <token key="EncryptedStatus" variants="EncryptedStatus"/>
  <token key="Slice" variants="AppendCommandsSlice"/>
</histogram>

<histogram
    name="Session.CommandStorageBackend.{SessionType}.{EncryptedStatus}.AppendCommands.{Slice}.FileSize"
    units="bytes" expires_after="2027-01-01">
  <owner>sammon@google.com</owner>
  <owner>dljames@chromium.org</owner>
  <summary>
    The size of the file written by CommandStorageBackend for {SessionType}
    sessions ({EncryptedStatus}), when the truncate parameter was {Slice}.
    Recorded each time the file is written successfully. The file is written
    periodically during a browser session to save the current session state.
  </summary>
  <token key="SessionType" variants="CommandStorageSessionType"/>
  <token key="EncryptedStatus" variants="EncryptedStatus"/>
  <token key="Slice" variants="AppendCommandsSlice"/>
</histogram>

<histogram
    name="Session.CommandStorageBackend.{SessionType}.{EncryptedStatus}.AppendCommands.{Slice}.Status"
    enum="CommandStorageWriteStatus" expires_after="2027-01-01">
  <owner>sammon@google.com</owner>
  <owner>dljames@chromium.org</owner>
  <summary>
    The result of the AppendCommands operation for {SessionType} sessions
    ({EncryptedStatus}), when the truncate parameter was {Slice}. AppendCommands
    is typically called periodically during a browser session to save the
    current session state.
  </summary>
  <token key="SessionType" variants="CommandStorageSessionType"/>
  <token key="EncryptedStatus" variants="EncryptedStatus"/>
  <token key="Slice" variants="AppendCommandsSlice"/>
</histogram>

<histogram
    name="Session.CommandStorageBackend.{SessionType}.{EncryptedStatus}.ReadLastSessionCommands.Duration"
    units="ms" expires_after="2027-01-01">
  <owner>sammon@google.com</owner>
  <owner>dljames@chromium.org</owner>
  <summary>
    The duration of the ReadLastSessionCommands operation for {SessionType}
    sessions ({EncryptedStatus}). ReadLastSessionCommands is typically called
    during browser startup to restore the previous session state.
  </summary>
  <token key="SessionType" variants="CommandStorageSessionType"/>
  <token key="EncryptedStatus" variants="EncryptedStatus"/>
</histogram>

<histogram
    name="Session.CommandStorageBackend.{SessionType}.{EncryptedStatus}.ReadLastSessionCommands.Status"
    enum="CommandStorageReadStatus" expires_after="2027-01-01">
  <owner>sammon@google.com</owner>
  <owner>dljames@chromium.org</owner>
  <summary>
    The result of the ReadLastSessionCommands operation for {SessionType}
    sessions ({EncryptedStatus}). ReadLastSessionCommands is typically called
    during browser startup to restore the previous session state.
  </summary>
  <token key="SessionType" variants="CommandStorageSessionType"/>
  <token key="EncryptedStatus" variants="EncryptedStatus"/>
</histogram>

<histogram name="Session.CommandStorageManager.EncryptedBackendUninitialized"
    enum="SessionEncryptedBackendUninitialized" expires_after="2027-01-01">
  <owner>sammon@google.com</owner>
  <owner>dljames@chromium.org</owner>
  <summary>
    Records when the encrypted backend is accessed before it has been
    initialized. The enum indicates which operation attempted the access.
  </summary>
</histogram>

<histogram name="Session.CommandStorageManager.EncryptedReadMatch"
    enum="SessionReadComparisonResult" expires_after="2027-01-01">
  <owner>sammon@google.com</owner>
  <owner>dljames@chromium.org</owner>
  <summary>
    The result of comparing the commands read from the cleartext and encrypted
    backends. Recorded after the commands are read from the cleartext and
    encrypted backends when the feature flag allows.
  </summary>
</histogram>

<histogram name="Session.CommandStorageManager.OnEncryptorReadyDuration"
    units="ms" expires_after="2027-01-01">
  <owner>sammon@google.com</owner>
  <owner>dljames@chromium.org</owner>
  <summary>
    The duration from when OSCryptAsync::GetInstance is requested by a
    CommandStorageManager to when an Encryptor is received via the
    OnEncryptorReady callback. An Encryptor is only requested if
    ShouldWriteEncryptedFiles() is true; this metric is not recorded otherwise.
    Note that there may be multiple CommandStorageManagers (e.g. for different
    session types and different profiles), so this metric may be recorded
    multiple times per app startup.
  </summary>
</histogram>

<histogram name="Session.ID.RestoredDifference" units="Session IDs"
    expires_after="2027-02-07">
  <owner>gambard@chromium.org</owner>
  <owner>sdefresne@chromium.org</owner>
  <summary>
    Records the difference between the highest restored SessionID and the value
    of the pref used for the next SessionID. If the difference is negative, 0 is
    recorded (0 means there is no problem, the session ID's pref was correctly
    restored). Having a value &gt; 0 means that there has been an issue and the
    SessionID was probably not recorded properly. This is recorded after each
    session restoration (so it can be recorded multiple times per run).
  </summary>
</histogram>

<histogram name="Session.IsActive" enum="BooleanActive"
    expires_after="2027-01-17">
  <owner>rogerm@chromium.org</owner>
  <owner>src/base/metrics/OWNERS</owner>
  <summary>
    Warning: This histogram is broken on Android, please use Session.IsActive2
    there instead.

    Was a browsing session active when the UMA record was captured? This metric
    is recorded with every UMA log upload when the session tracker is running
    (which, in principle, should always be the case). This metric is NOT
    recorded in logs that reflect information from a previous session (i.e.,
    &quot;stability logs&quot; or &quot;persistent UMA&quot; data related to the
    previous session but not uploaded during the previous session).

    Recorded on Android, iOS, Windows, Mac, and Linux.

    For information on what's considered &quot;active&quot;, see the histogram
    description for Session.TotalDuration.
  </summary>
</histogram>

<histogram name="Session.IsActive2" enum="BooleanActive"
    expires_after="2027-01-17">
  <owner>rogerm@chromium.org</owner>
  <owner>src/base/metrics/OWNERS</owner>
  <summary>
    Fixes an issue with Session.IsActive where foreground Sessions were not
    marked as active on Android.

    Was a browsing session active when the UMA record was captured? This metric
    is recorded with every UMA log upload when the session tracker is running
    (which, in principle, should always be the case). This metric is NOT
    recorded in logs that reflect information from a previous session (i.e.,
    &quot;stability logs&quot; or &quot;persistent UMA&quot; data related to the
    previous session but not uploaded during the previous session).

    Recorded only on Android.

    For information on what's considered &quot;active&quot;, see the histogram
    description for Session.TotalDuration.
  </summary>
</histogram>

<histogram name="Session.LockedDuration" units="ms" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The duration the screen was locked (OS-level lock) while Chrome was running.
    Recorded when the screen is unlocked or the session ends.
  </summary>
</histogram>

<histogram
    name="Session.LockedDuration.RestartabilityV2.{SmartRestartDuration}"
    enum="SmartRestartability" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    Records the combination of reasons a potential restart during OS lock screen
    was blocked, or 'None' if it was viable. Recorded when the zero-window state
    ends while an update is pending.

    The value is recorded as a bitmask of SmartRestartBlockReason flags. This
    histogram is sliced by the duration the OS was in the Locked state.

    V2: Uses refined logic for 'Unsaved form data' requiring both user
    interaction and a beforeunload handler.
  </summary>
  <token key="SmartRestartDuration">
    <variant name="1To5Min"/>
    <variant name="5To10Min"/>
    <variant name="Over10Min"/>
    <variant name="Under1Min"/>
  </token>
</histogram>

<histogram name="Session.LockedDuration.WithUpdate" units="ms"
    expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The duration the screen was locked (OS-level lock) while Chrome was running
    AND an update was pending (UpgradeDetector). Recorded when the screen is
    unlocked or the session ends.
  </summary>
</histogram>

<histogram name="Session.OpenedTabCounts" units="operations"
    expires_after="2027-01-17">
  <owner>rohitrao@chromium.org</owner>
  <owner>marq@chromium.org</owner>
  <summary>
    The number of times the user changed the active tab (this can happen when
    manually selecting a new tab, when a pre-rendered tab is made active, when
    closing the current tab and the next one is selected) during the current
    session (launch/foregrounding to backgrounding).

    This histogram is only logged on iOS when the application is backgrounded.
  </summary>
</histogram>

<histogram name="Session.Restore.SettingChanged.{SessionRestoreInfobarType}"
    enum="Boolean" expires_after="2027-02-07">
  <owner>musalmaan@chromium.org</owner>
  <owner>koretadaniel@chromium.org</owner>
  <summary>
    Records whether the user changed the session restore setting after being
    shown the session restore infobar that informs the user about
    {SessionRestoreInfobarType}.

    A `true` value is recorded if the user changes the session restore setting
    while the infobar is shown. A `false` value is recorded if the user
    dismisses the infobar without changing the setting (which stops the infobar
    from being shown again), or the user has ignored the infobar and it has been
    shown a max of 3 times.

    This histogram is not recorded if the user changes the setting at any other
    time (i.e. when the session restore infobar is not showing).
  </summary>
  <token key="SessionRestoreInfobarType">
    <variant name="TurnOffFromRestart"
        summary="turning off session restore from browser restart"/>
    <variant name="TurnOnSessionRestore" summary="turning on session restore"/>
  </token>
</histogram>

<histogram name="Session.SessionCrashed.Bubble"
    enum="SessionCrashedBubbleUserAction" expires_after="2027-05-29">
  <owner>miketaylr@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>How did the user interact with the SessionCrashed Bubble?</summary>
</histogram>

<histogram name="Session.SmartRestart.Lock.ExecutionOutcome{TabCount}"
    enum="SmartRestartExtendedExecutionOutcome" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The final outcome of a Smart Restart attempt triggered by an OS Lock event,
    segmented by {TabCount}.
  </summary>
  <token key="TabCount" variants="SmartRestartTabCount"/>
</histogram>

<histogram name="Session.SmartRestart.Lock.ProtectionReason{TabCount}"
    enum="SmartRestartBlocker" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    Specific reasons that contributed to the restart protection or disallowance
    during an OS Lock event, segmented by {TabCount}. Multiple reasons may be
    logged per session.
  </summary>
  <token key="TabCount" variants="SmartRestartTabCount"/>
</histogram>

<histogram name="Session.SmartRestart.Lock.RemainingTimeAtCancellation"
    units="ms" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The amount of time remaining in the grace period when a smart restart was
    cancelled by the user unlocking the screen. Helps identify close calls.
  </summary>
</histogram>

<histogram name="Session.SmartRestart.Lock.SuppressedBeforeUnloadCount"
    units="tabs" expires_after="2026-12-27">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The absolute count of open tabs that had active beforeunload handlers and
    whose prompts would have been skipped during a warning-suppressed Smart
    Restart relaunch on an OS Lock event. During the initial dry-run phase, this
    records potential suppressions without actually triggering the restart.
  </summary>
</histogram>

<histogram
    name="Session.SmartRestart.Lock.SuppressedBeforeUnloadEngagementScore"
    units="units" expires_after="2026-12-27">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The site engagement score of each tab containing a beforeunload handler
    whose prompt would have been skipped during a warning-suppressed Smart
    Restart relaunch on an OS Lock event. During the initial dry-run phase, this
    records potential suppressions without actually triggering the restart.
  </summary>
</histogram>

<histogram name="Session.SmartRestart.Lock.SuppressedBeforeUnloadRatio"
    units="%" expires_after="2026-12-27">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The percentage of open tabs that had active beforeunload handlers and whose
    prompts would have been skipped during a warning-suppressed Smart Restart
    relaunch on an OS Lock event. During the initial dry-run phase, this records
    potential suppressions without actually triggering the restart.
  </summary>
</histogram>

<histogram name="Session.SmartRestart.Lock.TimeSinceUpgradeDetected"
    units="minutes" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The duration from when an upgrade was first detected until a smart restart
    was successfully executed on an OS Lock event. Recorded in minutes. Captures
    gaps up to 30 days.
  </summary>
</histogram>

<histogram name="Session.SmartRestart.ZeroWindow.ExecutionOutcome"
    enum="SmartRestartExecutionOutcome" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    Records the outcome of a Smart Restart attempt triggered by the Zero Window
    state on macOS.

    Recorded at the end of the restart attempt timer. It identifies whether the
    restart was executed, cancelled by the user opening a window, or blocked by
    the safety policy.
  </summary>
</histogram>

<histogram name="Session.SmartRestart.ZeroWindow.RemainingTimeAtCancellation"
    units="ms" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The amount of time remaining in the grace period when a smart restart was
    cancelled by the user opening a window. Recorded on macOS. Helps identify
    close calls where the browser almost restarted just as the user returned.
  </summary>
</histogram>

<histogram name="Session.SmartRestart.ZeroWindow.TimeSinceUpgradeDetected"
    units="ms" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The duration from when an upgrade was first detected until a smart restart
    was successfully executed. Recorded on macOS just before the background
    relaunch occurs. Captures gaps up to 7 days.
  </summary>
</histogram>

<histogram name="Session.TotalDuration" units="ms" expires_after="never">
<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->

  <owner>asvitkine@chromium.org</owner>
  <owner>chrisha@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The length of a session (launch/foregrounding to quitting/backgrounding) in
    milliseconds, recorded at the end of the session. See
    Session.TotalDurationMax1Day for the same histogram with a higher maximum
    value. (The one's maximum is 1 hour.)

    Windows/Mac/Linux: Sessions only include time a browser window is visible.
    Time when Chrome is visible but not with a regular browsing window will not
    count. For example, neither the &quot;profile picker&quot;, which is
    sometimes shown at startup, nor the first-run experience flow will count as
    active time in Chrome when calculating Session.TotalDuration.

    Windows/Mac/Linux: An active session ends (i) when the user puts another app
    in the foreground, unless audio is playing. (The Chrome windows can still be
    shown. What matters is that a different app has focus.) (ii) when Chrome
    quits. (iii) when the screensaver turns on (again, unless audio is playing).
    (iv) when the user is inactive for five minutes (again, unless audio is
    playing). In this case (starting in M-55), that five minutes is not included
    in the sesson length. (v) when audio stops playing, if the user has been
    inactive for five minutes or Chrome is not in the foreground. Also, until
    M69, there was a bug that caused double-counting of some sessions.

    ChromeOS: not implemented. The ChromeOS histogram Platform.DailyUseTime is
    somewhat similar.

    Android: Session boundaries are wonky. Thus, only look at total duration for
    a client over a day; don't look at individual durations. A session ends (i)
    when the Chrome app leaves the foreground. This sounds obvious yet there are
    many subtle though common edge cases here. Going to the Android Home screen
    via the Home button is an obvious case. Yet, merely pressing the Recents
    button, even if the user reselects the Chrome app (i.e., doesn't leave the
    app) also ends a session. Another set of cases is the screen time-out
    (blanking the screen) or the lock screen. Either will cause Chrome to be
    considered to leave the foreground, ending the session. (ii) some in-app
    actions. Yes, some in-app events trigger the end of a session.

    Android continued: These in-app actions that trigger the end of a session
    can mostly be considered bugs. Cases: (a) switching to viewing Bookmarks,
    History, Downloads, or Settings causes the session to end. Note that
    switching out of those modes does not cause the end of a session, only
    switching in. Oddly, though the interface looks similar, switching to Recent
    Tabs does not trigger the end of a session. Nor does going into the tab
    switcher view. (b) modal pop-ups. JavaScript dialogs and other things that
    take focus away from the Chrome activity can cause this metric to record a
    session end prematurely. See: crbug.com/678276. (c) switching Chrome from as
    a single app in the foreground into multi-window mode. (d) switching Chrome
    from being one of a set of multi-window apps that are displayed to be the
    only app displayed.

    iOS: A session starts when Chrome is launched to the foreground and ends
    when Chrome leaves the screen. This is generally straightforward. Chrome
    leaves the screen when the screen goes blank or shows the lock screen, when
    Chrome clicks a link that opens in another app, or when the user switches to
    another app in the app switcher. Note that, unlike on desktop, even if
    Chrome is playing media in the background or in picture-in-picture mode, the
    session is still terminated when Chrome leaves the screen. Also note that if
    Chrome starts in Safe Mode, the session will only start when the user quits
    Safe Mode. When multiple windows are used, the session is considered ongoing
    as long as there is at least one foreground Chrome window. This was revised
    in M-89 to support multiple windows. In M-87 and M-88, nothing was logged
    due to a bug. Before M-86, a similar metric was recorded, with some
    differences in edge cases. See the old histogram description for more
    details.

    This histogram is of special interest to the chrome-analysis-team@. Do not
    change its semantics or retire it without talking to them first.
  </summary>
</histogram>

<histogram
    name="Session.TotalDuration.IgnoreNonInteractiveTimeForOSLaunchedSessions"
    units="ms" expires_after="2026-12-27">
  <owner>atharvmaan@google.com</owner>
  <owner>chrome-desktop-ui-waterloo@google.com</owner>
  <summary>
    The length of a desktop session (launch/foregrounding to
    quitting/backgrounding) in milliseconds, recorded at the end of the session.

    For the first session of an OS-launched Chrome instance, the start time is
    considered to be the time of the first interactive user event rather than
    the actual start of the session. This excludes the time Chrome spent running
    without user interaction. For all other sessions, the start time is the
    actual session start time.

    This histogram is similar to Session.TotalDuration, but filters out
    non-interactive time at the beginning of OS-launched sessions. Unlike
    Session.TotalDuration, it is only recorded on desktop platforms.
  </summary>
</histogram>

<histogram name="Session.TotalDuration.NotOptedInToSyncWithAccount" units="ms"
    expires_after="never">
<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->

  <owner>bsazonov@chromium.org</owner>
  <owner>droger@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>tschumann@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    This histogram is in the process of being replaced with the equivalent
    histogram Session.TotalDurationMax1Day.NotOptedInToSyncWithAccount; the only
    difference is the histogram bucket ranges.

    The amount of active browsing time that was spent with sync disabled while
    having a valid refresh token for the primary account. This corresponds to
    the case when the user did not opt in to sync, or sync is disabled due to
    another reason, e.g. enterprise policy. Note that auth errors are not
    counted here, but rather in
    Session.TotalDuration.NotOptedInToSyncWithAccountInAuthError.

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their signin or
    sync status changes. These end-points are when the metric is emitted. For
    details on how &quot;stopped interacting with the browser&quot; is decided,
    see the description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.

    This histogram is of special interest to the chrome-analysis-team@ and
    chrome-signin-team@. Do not change its semantics or retire it without
    talking to them first.
  </summary>
</histogram>

<histogram name="Session.TotalDuration.NotOptedInToSyncWithAccountInAuthError"
    units="ms" expires_after="never">
<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->

  <owner>bsazonov@chromium.org</owner>
  <owner>droger@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>tschumann@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    This histogram is in the process of being replaced with the equivalent
    histogram
    Session.TotalDurationMax1Day.NotOptedInToSyncWithAccountInAuthError; the
    only difference is the histogram bucket ranges.

    The amount of active browsing time that was spent with sync disabled while
    having a primary account with an invalid refresh token. This corresponds to
    the case when the user did not opt in to sync, or sync is disabled due to
    another reason, e.g. enterprise policy.

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their signin or
    sync status changes. These end-points are when the metric is emitted. For
    details on how &quot;stopped interacting with the browser&quot; is decided,
    see the description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.

    This histogram is of special interest to the chrome-analysis-team@ and
    chrome-signin-team@. Do not change its semantics or retire it without
    talking to them first.
  </summary>
</histogram>

<histogram name="Session.TotalDuration.NotOptedInToSyncWithoutAccount"
    units="ms" expires_after="never">
<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->

  <owner>bsazonov@chromium.org</owner>
  <owner>droger@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>tschumann@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    This histogram is in the process of being replaced with the equivalent
    histogram Session.TotalDurationMax1Day.NotOptedInToSyncWithoutAccount; the
    only difference is the histogram bucket ranges.

    The amount of active browsing time that was spent with sync disabled and
    signed out of Chrome (no primary account or invalid token for the primary
    account).

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their signin or
    sync status changes. These end-points are when the metric is emitted. For
    details on how &quot;stopped interacting with the browser&quot; is decided,
    see the description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.

    Note: As part of crbug/1223007, we discovered this histogram was recorded
    for Guest and System profiles which wasn't intentional. This was fixed in
    M93.

    After launching background logging in the late February 2021 on Android,
    this metric started recording for instances that were running in the
    background, even if Chrome had never come to foreground. The bug was fixed
    in M92, and after that the metric is recorded only after an instance becomes
    foregrounded at least once. Hence a glitch is visible in the Feb-Aug 2021
    data for Android.

    This histogram is of special interest to the chrome-analysis-team@ and
    chrome-signin-team@. Do not change its semantics or retire it without
    talking to them first.
  </summary>
</histogram>

<histogram name="Session.TotalDuration.OptedInToSyncWithAccount" units="ms"
    expires_after="never">
<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->

  <owner>bsazonov@chromium.org</owner>
  <owner>droger@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>tschumann@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    This histogram is in the process of being replaced with the equivalent
    histogram Session.TotalDurationMax1Day.OptedInToSyncWithAccount; the only
    difference is the histogram bucket ranges.

    The total session duration (see Session.TotalDuration) that was spent with
    sync enabled and signed in to Chrome (valid token for the primary account).

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their signin or
    sync status changes. These end-points are when the metric is emitted. For
    details on how &quot;stopped interacting with the browser&quot; is decided,
    see the description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.

    This histogram is of special interest to the chrome-analysis-team@ and
    chrome-signin-team@. Do not change its semantics or retire it without
    talking to them first.
  </summary>
</histogram>

<histogram name="Session.TotalDuration.OptedInToSyncWithoutAccount" units="ms"
    expires_after="never">
<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->

  <owner>bsazonov@chromium.org</owner>
  <owner>droger@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>tschumann@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    This histogram is in the process of being replaced with the equivalent
    histogram Session.TotalDurationMax1Day.OptedInToSyncWithoutAccount; the only
    difference is the histogram bucket ranges.

    The total session duration (see Session.TotalDuration) that was being spent
    with sync inactive due to an invalid refresh token for the primary account
    (a.k.a. sync in an auth error state). Note that in this state, the user has
    already opted in to sync previously. This corresponds to the so-called
    &quot;Sync paused&quot; state.

    This can for example be the case when a user, that previously opted in to
    sync, signed out of the web on desktop, changed their password, or otherwise
    invalidated their signin.

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their signin or
    sync status changes. These end-points are when the metric is emitted. For
    details on how &quot;stopped interacting with the browser&quot; is decided,
    see the description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.

    After launching background logging in the late February 2021 on Android,
    this metric started recording for instances that were running in the
    background, even if Chrome had never come to foreground. The bug was fixed
    in M92, and after that the metric is recorded only after an instance becomes
    foregrounded at least once. Hence a glitch is visible in the Feb-Aug 2021
    data for Android.

    This histogram is of special interest to the chrome-analysis-team@ and
    chrome-signin-team@. Do not change its semantics or retire it without
    talking to them first.
  </summary>
</histogram>

<histogram name="Session.TotalDuration.TabletMode" units="ms"
    expires_after="2027-01-02">
  <owner>robliao@chromium.org</owner>
  <owner>gerchiko@microsoft.com</owner>
  <owner>wangsongjin@microsoft.com</owner>
  <owner>input-dev@chromium.org</owner>
  <summary>
    Time spent in tablet mode in each session (as defined by
    DesktopSessionDurationTracker). Samples correspond one-to-one with
    Session.TotalDuration samples.

    This histogram should be analyzed with Session.TotalDuration. For example,
    the sum of this histogram divided by the sum of Session.TotalDuration is the
    total proportion of active browsing time spent in tablet mode.
  </summary>
</histogram>

<histogram name="Session.TotalDuration.TouchMode" units="times"
    expires_after="2024-01-14">
  <owner>collinbaker@chromium.org</owner>
  <owner>top-chrome-desktop-ui@google.com</owner>
  <summary>
    Time spent in touch mode in each session (as defined by
    DesktopSessionDurationTracker). Samples correspond one-to-one with
    Session.TotalDuration samples.

    This histogram should be analyzed with Session.TotalDuration. For example,
    the sum of this histogram divided by the sum of Session.TotalDuration is the
    total proportion of active browsing time spent in touch mode.
  </summary>
</histogram>

<histogram name="Session.TotalDuration.WithAccount" units="ms"
    expires_after="never">
<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->

  <owner>bsazonov@chromium.org</owner>
  <owner>droger@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>tschumann@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <summary>
    This histogram is in the process of being replaced with the equivalent
    histogram Session.TotalDurationMax1Day.WithAccount; the only difference is
    the histogram bucket ranges.

    The total session duration (see Session.TotalDuration) that was spent with a
    Google account signed into the content area.

    The difference between the With(out)Account measurements and the
    Opted(In/Out)ToSyncWith(out)Account measurements is that these metrics are
    derived from the user's cookies, not their refresh tokens.

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their signin
    status changes. These end-points are when the metric is emitted. For details
    on how &quot;stopped interacting with the browser&quot; is decided, see the
    description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.

    This histogram is of special interest to the chrome-signin-team@. Do not
    change its semantics or retire it without talking to them first.
  </summary>
</histogram>

<histogram name="Session.TotalDuration.WithoutAccount" units="ms"
    expires_after="never">
<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->

  <owner>bsazonov@chromium.org</owner>
  <owner>droger@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>tschumann@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <summary>
    This histogram is in the process of being replaced with the equivalent
    histogram Session.TotalDurationMax1Day.WithoutAccount; the only difference
    is the histogram bucket ranges.

    The total session duration (see Session.TotalDuration) that was spent
    without a Google account signed into the content area.

    The difference between the With(out)Account measurements and the
    Opted(In/Out)ToSyncWith(out)Account measurements is that these metrics are
    derived from the user's cookies, not their refresh tokens.

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their signin
    status changes. These end-points are when the metric is emitted. For details
    on how &quot;stopped interacting with the browser&quot; is decided, see the
    description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.

    Note: As part of crbug/1223007, we discovered this histogram was recorded
    for Guest and System profiles which wasn't intentional. This was fixed in
    M93.

    This histogram is of special interest to the chrome-signin-team@. Do not
    change its semantics or retire it without talking to them first.
  </summary>
</histogram>

<histogram name="Session.TotalDurationMax1Day" units="ms" expires_after="never">
<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->

  <owner>asvitkine@chromium.org</owner>
  <owner>chrisha@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The length of a session (launch/foregrounding to quitting/backgrounding) in
    milliseconds, recorded at the end of the session. See Session.TotalDuration
    for details on how the end of a session is decided. The histogram
    Session.TotalDuration records exactly the same values as this histogram,
    just with a smaller maximum value. (That one's maximum is 1 hour.)

    This histogram is of special interest to the chrome-analysis-team@. Do not
    change its semantics or retire it without talking to them first.
  </summary>
</histogram>

<histogram name="Session.TotalDurationMax1Day.{HistorySyncState}{Profile}"
    units="ms" expires_after="2027-02-07">
  <owner>mastiz@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <summary>
    The amount of active browsing time that was spent with history sync
    {HistorySyncState}.

    History sync counts as enabled if EITHER the user opted in to sync and did
    not disable history, OR (on supported platforms) the user is signed-in (but
    not syncing) and specifically opted in to history. Either way, if history is
    disabled by enterprise policy, that counts as NOT enabled.

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their history sync
    status changes. These end-points are when the metric is emitted. For details
    on how &quot;stopped interacting with the browser&quot; is decided, see the
    description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.

    {Profile}
  </summary>
  <token key="HistorySyncState">
    <variant name="WithHistorySync"
        summary="enabled (with or without persistent auth error)"/>
    <variant name="WithHistorySyncAndAuthError"
        summary="enabled but with persistent auth error"/>
    <variant name="WithHistorySyncWithoutAuthError"
        summary="enabled and without persistent auth error"/>
    <variant name="WithoutHistorySync" summary="NOT enabled"/>
  </token>
  <token key="Profile" variants="ProfileIndex"/>
</histogram>

<histogram name="Session.TotalDurationMax1Day.{IdentityState}{Profile}"
    units="ms" expires_after="never">
<!-- expires-never: powers go/chromesync-dash (internal) -->

  <owner>bsazonov@chromium.org</owner>
  <owner>droger@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>tschumann@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    {IdentityState}

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their signin or
    sync status changes. These end-points are when the metric is emitted. For
    details on how &quot;stopped interacting with the browser&quot; is decided,
    see the description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.

    This histogram is of special interest to the chrome-analysis-team@ and
    chrome-signin-team@. Do not change its semantics or retire it without
    talking to them first.

    {Profile}
  </summary>
  <token key="IdentityState">
    <variant name="NotOptedInToSyncWithAccount"
        summary="The amount of active browsing time that was spent with sync
                 disabled while having a valid refresh token for the primary
                 account. This corresponds to the case when the user did not
                 opt in to sync, or sync is disabled due to another reason,
                 e.g. enterprise policy. Note that auth errors are not
                 counted here, but rather in
                 Session.TotalDurationMax1Day.NotOptedInToSyncWithAccountInAuthError."/>
    <variant name="NotOptedInToSyncWithAccountInAuthError"
        summary="The amount of active browsing time that was spent with sync
                 disabled while having a primary account with an invalid
                 refresh token. This corresponds to the case when the user
                 did not opt in to sync, or sync is disabled due to another
                 reason, e.g. enterprise policy."/>
    <variant name="NotOptedInToSyncWithoutAccount"
        summary="The amount of active browsing time that was spent with sync
                 disabled and signed out of Chrome (no primary account or
                 invalid token for the primary account). Note: As part of
                 crbug.com/1223007, we discovered this histogram was recorded
                 for Guest and System profiles which wasn't intentional. This
                 was fixed in M93. After launching background logging in the
                 late February 2021 on Android, this metric started recording
                 for instances that were running in the background, even if
                 Chrome had never come to foreground. The bug was fixed in
                 M92, and after that the metric is recorded only after an
                 instance becomes foregrounded at least once. Hence a glitch
                 is visible in the Feb-Aug 2021 data for Android."/>
    <variant name="OptedInToSyncWithAccount"
        summary="The total session duration (see Session.TotalDuration) that
                 was spent with sync enabled and signed in to Chrome (valid
                 token for the primary account)."/>
    <variant name="OptedInToSyncWithoutAccount"
        summary="The total session duration (see Session.TotalDuration) that
                 was being spent with sync inactive due to an invalid refresh
                 token for the primary account (a.k.a. sync in an auth error
                 state). Note that in this state, the user has already opted
                 in to sync previously. This corresponds to the so-called
                 &quot;Sync paused&quot; state. This can for example be the
                 case when a user, that previously opted in to sync, signed
                 out of the web on desktop, changed their password, or
                 otherwise invalidated their signin. After launching
                 background logging in the late February 2021 on Android,
                 this metric started recording for instances that were
                 running in the background, even if Chrome had never come to
                 foreground. The bug was fixed in M92, and after that the
                 metric is recorded only after an instance becomes
                 foregrounded at least once. Hence a glitch is visible in the
                 Feb-Aug 2021 data for Android."/>
    <variant name="WithAccount"
        summary="The total session duration (see Session.TotalDuration) that
                 was spent with a Google account signed into the content
                 area. The difference between the With(out)Account
                 measurements and the Opted(In/Out)ToSyncWith(out)Account
                 measurements is that these metrics are derived from the
                 user's cookies, not their refresh tokens."/>
    <variant name="WithoutAccount"
        summary="The total session duration (see Session.TotalDuration) that
                 was spent without a Google account signed into the content
                 area. The difference between the With(out)Account
                 measurements and the Opted(In/Out)ToSyncWith(out)Account
                 measurements is that these metrics are derived from the
                 user's cookies, not their refresh tokens. Note: As part of
                 crbug.com/1223007, we discovered this histogram was recorded
                 for Guest and System profiles which wasn't intentional. This
                 was fixed in M93."/>
  </token>
  <token key="Profile" variants="ProfileIndex"/>
</histogram>

<histogram name="Session.TotalDurationMax1Day.{MsbbState}" units="ms"
    expires_after="2027-02-07">
  <owner>mastiz@chromium.org</owner>
  <owner>msarda@chromium.org</owner>
  <owner>treib@chromium.org</owner>
  <owner>chrome-signin-team@google.com</owner>
  <summary>
    The amount of active browsing time that was spent with &quot;Make Searches
    and Browsing Better&quot; {MsbbState}.

    This time is measured from when the user starts interacting with the browser
    until either they stopped interacting with the browser or their history sync
    status changes. These end-points are when the metric is emitted. For details
    on how &quot;stopped interacting with the browser&quot; is decided, see the
    description of Session.TotalDuration.

    Because a duration can end either because the user became inactive or
    because their status changed, the distribution of individual durations
    measured are unlikely to be helpful. Instead, please compare total
    durations.

    This metric is recorded on Win/Mac/Linux/iOS/Android.

    One caveat with this metric is that if the user has multiple profiles open
    at the same time, their session activity will be logged from all the
    profiles, instead of only from the profile that the user is using at that
    moment.
  </summary>
  <token key="MsbbState">
    <variant name="WithMsbb" summary="enabled"/>
    <variant name="WithoutMsbb" summary="NOT enabled"/>
  </token>
</histogram>

<histogram name="Session.WebStates.LoadingTimeOnMainThread" units="ms"
    expires_after="2026-12-31">
  <owner>fedegermi@google.com</owner>
  <owner>sdefresne@chromium.org</owner>
  <summary>
    The time spent on the main thread to restore a session as a continuous task.
    It's recorded every time a session is loaded (which happens on application
    startup or when the user re-open a recently closed windows on iPad). This
    includes loading the data from disk as this happens on the main thread.

    Large values for this histogram is indicative of jank for the user as the
    main thread is blocked for the duration reported in the histogram in one
    giant operation.
  </summary>
</histogram>

<histogram name="Session.WebStates.NativeRestoreHasFetchers"
    enum="BooleanHasFetchers" expires_after="2026-12-31">
  <owner>justincohen@chromium.org</owner>
  <owner>michaeldo@chromium.org</owner>
  <summary>
    Records whether the WKWebView native session restore has any fetchers or
    not. Recorded each time a native session restore is attempted.
  </summary>
</histogram>

<histogram name="Session.WebStates.NativeRestoreSession" enum="BooleanSuccess"
    expires_after="2026-12-31">
  <owner>justincohen@chromium.org</owner>
  <owner>michaeldo@chromium.org</owner>
  <summary>
    Records whether generic WKWebView native session restore succeeded in
    creating navigation items. Recorded each time a generic native session
    restore is attempted (if data exists).
  </summary>
</histogram>

<histogram name="Session.WebStates.NativeRestoreSessionFromCache"
    enum="BooleanSuccess" expires_after="2026-12-31">
  <owner>justincohen@chromium.org</owner>
  <owner>michaeldo@chromium.org</owner>
  <summary>
    Records whether WKWebView native session restore from cached data succeeded
    in creating navigation items. Recorded each time a cached native session
    restore is attempted (if data exists).
  </summary>
</histogram>

<histogram name="Session.WebStates.NativeRestoreSessionFromCacheHasData"
    enum="BooleanHasData" expires_after="2026-12-31">
  <owner>justincohen@chromium.org</owner>
  <owner>michaeldo@chromium.org</owner>
  <summary>
    Records whether the WKWebView native session restore from cached data
    fetcher has data or not. Recorded each time a cached native session restore
    is attempted.
  </summary>
</histogram>

<histogram name="Session.WebStates.NativeRestoreSessionHasData"
    enum="BooleanHasData" expires_after="2026-12-31">
  <owner>justincohen@chromium.org</owner>
  <owner>michaeldo@chromium.org</owner>
  <summary>
    Records whether the generic WKWebView native session restore fetcher has
    data or not. Recorded each time a generic native session restore is
    attempted.
  </summary>
</histogram>

<histogram name="Session.WebStates.SavingTimeOnMainThread" units="ms"
    expires_after="2026-12-31">
  <owner>fedegermi@google.com</owner>
  <owner>sdefresne@chromium.org</owner>
  <summary>
    The time spend on the main thread to save a session as a continuous task.
    It's recorded every time a session is saved (which is scheduled on page
    loads, tab changes and app backgrounding, but repeating events may be
    collapsed). This does not include the time spent writing the file on disk
    (since it is done on a background sequence).

    Large values for this histogram is indicative of jank for the user as the
    main thread is blocked for the duration reported in the histogram in one
    giant operation.
  </summary>
</histogram>

<histogram name="Session.ZeroWindowDuration" units="ms"
    expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The duration Chrome was running with zero open browser windows (specifically
    TYPE_NORMAL). Recorded when a new window is opened or Chrome quits.

    This metric is only recorded on macOS.
  </summary>
</histogram>

<histogram
    name="Session.ZeroWindowDuration.RestartabilityV2.{SmartRestartDuration}"
    enum="SmartRestartability" expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    Records the combination of reasons a potential restart with zero windows
    open on macOS was blocked, or 'None' if it was viable. Recorded when the
    zero-window state ends while an update is pending.

    The value is recorded as a bitmask of SmartRestartBlockReason flags. This
    histogram is sliced by the duration the browser was in the Zero Window
    state.

    V2: Uses refined logic for 'Unsaved form data' requiring both user
    interaction and a beforeunload handler.
  </summary>
  <token key="SmartRestartDuration">
    <variant name="1To5Min"/>
    <variant name="5To10Min"/>
    <variant name="Over10Min"/>
    <variant name="Under1Min"/>
  </token>
</histogram>

<histogram name="Session.ZeroWindowDuration.WithUpdate" units="ms"
    expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The duration Chrome was running with zero open browser windows (specifically
    TYPE_NORMAL) AND an update was pending. Recorded when a new window is opened
    or Chrome quits.

    This metric is only recorded on macOS.
  </summary>
</histogram>

<histogram name="SessionRestore.ForegroundTabFirstPaint4.FinishReason"
    enum="SessionRestoreFinishReason" expires_after="2027-01-03">
  <owner>joenotcharles@google.com</owner>
  <owner>catan-team@chromium.org</owner>
  <summary>
    The reason for which attempt to record
    SessionRestore.ForegroundTabFirstPaint4 was deemed complete. Logged once per
    session restore.

    Warning: this histogram was expired from 2022-10-23 to 2024-02-15; data may
    be missing.
  </summary>
</histogram>

<histogram
    name="SessionRestore.ForegroundTabFirstPaint4{SessionRestoreTabCounts}"
    units="ms" expires_after="2027-02-07">
  <owner>joenotcharles@google.com</owner>
  <owner>catan-team@chromium.org</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time from SessionRestore start until a restored tab's first paint.
    Recorded when a restored tab stays visible from the beginning of session
    restore until its first paint, and no non-restored tab is painted during
    that time. See SessionRestore.ForegroundTabFirstPaint4.FinishReason for when
    this is not recorded.

    Warning: this histogram was expired from 2022-10-23 to 2023-02-22; data may
    be missing. {SessionRestoreTabCounts}
  </summary>
  <token key="SessionRestoreTabCounts">
    <variant name=""/>
    <variant name=".1Tab" summary="1 tab present"/>
    <variant name=".2to3Tabs" summary="2 to 3 tabs present"/>
    <variant name=".4to7Tabs" summary="4 to 7 tabs present"/>
    <variant name=".8to15Tabs" summary="8 to 15 tabs present"/>
    <variant name=".16to31Tabs" summary="16 to 31 tabs present"/>
    <variant name=".32PlusTabs" summary="32 or more tabs present"/>
  </token>
</histogram>

<histogram name="SessionRestore.InfoBar.TurnOffFromRestart"
    enum="SessionRestoreInfoBarAction" expires_after="2027-01-03">
  <owner>musalmaan@chromium.org</owner>
  <owner>koretadaniel@chromium.org</owner>
  <summary>
    Records user interaction with the session restore infobar when it is shown
    to inform the user about turning off session restore from browser restart.
  </summary>
</histogram>

<histogram name="SessionRestore.InfoBar.TurnOnSessionRestore"
    enum="SessionRestoreInfoBarAction" expires_after="2027-01-03">
  <owner>musalmaan@chromium.org</owner>
  <owner>koretadaniel@chromium.org</owner>
  <summary>
    Records user interaction with the session restore infobar when it is shown
    to inform the user about turning on session restore.
  </summary>
</histogram>

<histogram name="SessionRestore.PageStateOldVersions" units="version"
    expires_after="2027-01-03">
  <owner>creis@chromium.org</owner>
  <owner>chrome-security-architecture@google.com</owner>
  <summary>
    The number of times a PageState with the given non-current PageState version
    number was decoded during session restore. Old PageState versions with
    sufficiently low usage may be considered for deprecation. See
    page_state_serialization.cc's kCurrentVersion for documentation of each
    version.
  </summary>
</histogram>

<histogram name="SessionRestore.TabCount{TabType}" units="tabs"
    expires_after="2027-02-07">
  <owner>joenotcharles@google.com</owner>
  <owner>catan-team@chromium.org</owner>
  <summary>
    The number of {TabType} available to restore in a session. Logged once per
    session restore. Not all of the tabs in the session will ultimately be
    loaded.

    This metric has several variants with suffixes for tabs with different
    properties. The properties aren't mutually exclusive so the sum of all
    variants won't equal SessionRestore.TabCount, which covers all tabs.
  </summary>
  <token key="TabType">
    <variant name="" summary="tabs"/>
    <variant name=".Active" summary="active tabs"/>
    <variant name=".App" summary="tabs whose browser window is an app"/>
    <variant name=".BackgroundNotificationPermission"
        summary="tabs with background notification permission"/>
    <variant name=".Grouped" summary="tabs that are part of tab groups"/>
    <variant name=".InternalPage" summary="tabs hosting internal WebUI pages"/>
    <variant name=".Pinned" summary="pinned tabs"/>
    <variant name=".UpdatesTitleOrFaviconInBackground"
        summary="tabs that update their title or favicon in the background"/>
  </token>
</histogram>

<histogram name="SessionRestore.TabDiffAfterRestart.{Type}" units="tabs"
    expires_after="2027-02-07">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The difference between the number of tabs open before a restart and the
    number of tabs restored for the profile in {Type}. A positive value means
    tabs were lost; a negative value means tabs were gained. Logged once per
    session restore if a pre-restart tab count was saved.
  </summary>
  <token key="Type">
    <variant name="App" summary="app windows"/>
    <variant name="Normal" summary="normal windows"/>
  </token>
</histogram>

<histogram name="SessionRestore.UnrecoverableWriteErrorCount"
    units="operations" expires_after="2022-08-07">
  <owner>sky@chromium.org</owner>
  <owner>davidbienvenu@chromium.org</owner>
  <summary>
    Recorded when SessionService is shutdown (which generally corresponds to
    when chrome is shutdown). The count is the number of times a write error
    happened at a time when it could not immediately be handled.
  </summary>
</histogram>

<histogram name="SessionRestore.WindowDiffAfterRestart.{Type}" units="windows"
    expires_after="2026-12-01">
  <owner>victortan@chromium.org</owner>
  <owner>chrome-analysis-team@google.com</owner>
  <summary>
    The difference between the number of windows open before a restart and the
    number of windows restored for the profile in {Type}. A positive value means
    windows were lost; a negative value means windows were gained. Logged once
    per session restore if a pre-restart window count was saved.
  </summary>
  <token key="Type">
    <variant name="App" summary="app windows"/>
    <variant name="Normal" summary="normal windows"/>
  </token>
</histogram>

</histograms>

</histogram-configuration>
