1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112

ash / wm / desks / templates / saved_desk_metrics_util.h [blame]

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

#ifndef ASH_WM_DESKS_TEMPLATES_SAVED_DESK_METRICS_UTIL_H_
#define ASH_WM_DESKS_TEMPLATES_SAVED_DESK_METRICS_UTIL_H_

#include "ash/ash_export.h"
#include "ash/public/cpp/desk_template.h"
#include "base/time/time.h"
#include "components/desks_storage/core/desk_model.h"

namespace ash {

// Histogram names for desk templates.
constexpr char kLoadTemplateGridHistogramName[] =
    "Ash.DeskTemplate.LoadTemplateGrid";
constexpr char kDeleteTemplateHistogramName[] =
    "Ash.DeskTemplate.DeleteTemplate";
constexpr char kNewTemplateHistogramName[] = "Ash.DeskTemplate.NewTemplate";
constexpr char kLaunchTemplateHistogramName[] =
    "Ash.DeskTemplate.LaunchFromTemplate";
constexpr char kAddOrUpdateTemplateStatusHistogramName[] =
    "Ash.DeskTemplate.AddOrUpdateTemplateStatus";
constexpr char kTemplateWindowCountHistogramName[] =
    "Ash.DeskTemplate.WindowCount";
constexpr char kTemplateTabCountHistogramName[] = "Ash.DeskTemplate.TabCount";
constexpr char kTemplateWindowAndTabCountHistogramName[] =
    "Ash.DeskTemplate.WindowAndTabCount";
constexpr char kUserTemplateCountHistogramName[] =
    "Ash.DeskTemplate.UserTemplateCount";
constexpr char kTemplateUnsupportedAppDialogShowHistogramName[] =
    "Ash.DeskTemplate.UnsupportedAppDialogShow";
constexpr char kReplaceTemplateHistogramName[] =
    "Ash.DeskTemplate.ReplaceTemplate";

// Histogram names for Save & Recall.
constexpr char kNewSaveAndRecallHistogramName[] =
    "Ash.DeskTemplate.NewSaveAndRecall";
constexpr char kDeleteSaveAndRecallHistogramName[] =
    "Ash.DeskTemplate.DeleteSaveAndRecall";
constexpr char kLaunchSaveAndRecallHistogramName[] =
    "Ash.DeskTemplate.LaunchSaveAndRecall";
constexpr char kSaveAndRecallWindowCountHistogramName[] =
    "Ash.DeskTemplate.SaveAndRecallWindowCount";
constexpr char kSaveAndRecallTabCountHistogramName[] =
    "Ash.DeskTemplate.SaveAndRecallTabCount";
constexpr char kSaveAndRecallWindowAndTabCountHistogramName[] =
    "Ash.DeskTemplate.SaveAndRecallWindowAndTabCount";
constexpr char kUserSaveAndRecallCountHistogramName[] =
    "Ash.DeskTemplate.UserSaveAndRecallCount";
constexpr char kReplaceSaveAndRecallHistogramName[] =
    "Ash.DeskTemplate.ReplaceSaveAndRecall";
constexpr char kTimeBetweenSaveAndRecallHistogramName[] =
    "Ash.DeskTemplate.TimeBetweenSaveAndRecall";
constexpr char kSaveAndRecallUnsupportedAppDialogShowHistogramName[] =
    "Ash.DeskTemplate.SaveAndRecallUnsupportedAppDialogShow";

// Histogram names for Floating Workspace.
constexpr char kLaunchFloatingWorkspaceHistogramName[] =
    "Ash.DeskTemplate.LaunchFloatingWorkspace";
constexpr char kFloatingWorkspaceWindowCountHistogramName[] =
    "Ash.DeskTemplate.FloatingWorkspaceWindowCount";
constexpr char kFloatingWorkspaceTabCountHistogramName[] =
    "Ash.DeskTemplate.FloatingWorkspaceTabCount";
constexpr char kFloatingWorkspaceWindowAndTabCountHistogramName[] =
    "Ash.DeskTemplate.FloatingWorkspaceWindowAndTabCount";

// Histogram names for admin templates.
constexpr char kAdminTemplateWindowCountHistogramName[] =
    "Ash.DeskTemplate.AdminTemplateWindowCount";
constexpr char kAdminTemplateTabCountHistogramName[] =
    "Ash.DeskTemplate.AdminTemplateTabCount";
constexpr char kLaunchAdminTemplateHistogramName[] =
    "Ash.DeskTamplate.LaunchAdminTemplate";

// Histogram names for saved desk buttons/menu options.
constexpr char kSavedDeskButtonsShownHistogramName[] =
    "Ash.DeskTemplate.SavedDeskButtonsShown";
constexpr char kSavedDeskMenuOptionsShownHistogramName[] =
    "Ash.DeskTemplate.SavedDeskMenuOptionsShown";
constexpr char kSaveAsTemplatePressedHistogramName[] =
    "Ash.DeskTemplate.SaveAsTemplatePressed";
constexpr char kSaveForLaterPressedHistogramName[] =
    "Ash.DeskTemplate.SaveForLaterPressed";
constexpr char kShowSavedDeskButtonsRevampDisabledHistogramName[] =
    "Ash.DeskTemplate.ShowSavedDeskButtonsRevampDisabled";
constexpr char kShowSavedDeskButtonsRevampEnabledHistogramName[] =
    "Ash.DeskTemplate.ShowSavedDeskButtonsRevampEnabled";

// Wrappers calls base::uma with correct histogram name.
void RecordLoadSavedDeskLibraryHistogram();
void RecordDeleteSavedDeskHistogram(DeskTemplateType type);
ASH_EXPORT void RecordLaunchSavedDeskHistogram(DeskTemplateType type);
void RecordNewSavedDeskHistogram(DeskTemplateType type);
void RecordReplaceSavedDeskHistogram(DeskTemplateType type);
void RecordAddOrUpdateTemplateStatusHistogram(
    desks_storage::DeskModel::AddOrUpdateEntryStatus status);
void RecordUserSavedDeskCountHistogram(DeskTemplateType type,
                                       size_t entry_count,
                                       size_t max_entry_count);
ASH_EXPORT void RecordWindowAndTabCountHistogram(
    const DeskTemplate& desk_template);
void RecordUnsupportedAppDialogShowHistogram(DeskTemplateType type);
void RecordTimeBetweenSaveAndRecall(base::TimeDelta duration);
void RecordAdminTemplateWindowAndTabCountHistogram(
    const DeskTemplate& desk_template);
void RecordLaunchAdminTemplateHistogram();

}  // namespace ash

#endif  // ASH_WM_DESKS_TEMPLATES_SAVED_DESK_METRICS_UTIL_H_