File: app_service_metrics.h

package info (click to toggle)
chromium 139.0.7258.127-1~deb13u1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,096 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (119 lines) | stat: -rw-r--r-- 3,625 bytes parent folder | download | duplicates (6)
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
113
114
115
116
117
118
119
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_APPS_APP_SERVICE_METRICS_APP_SERVICE_METRICS_H_
#define CHROME_BROWSER_APPS_APP_SERVICE_METRICS_APP_SERVICE_METRICS_H_

#include <map>
#include <string>

#include "build/build_config.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"

namespace apps {

// The default app's histogram name. This is used for logging so do
// not change the order of this enum.
// https://docs.google.com/document/d/1WJ-BjlVOM87ygIsdDBCyXxdKw3iS5EtNGm1fWiWhfIs
// If you're adding to this enum with the intention that it will be logged,
// update the DefaultAppName enum listing in tools/metrics/histograms/enums.xml.
enum class DefaultAppName {
  // Legacy calculator chrome app was replaced by a PWA in m96.
  kCalculatorChromeApp = 10,
  kText = 11,
  kGetHelp = 12,
  // Gallery was replaced by MediaApp in M86 and deleted in M91.
  kDeletedGalleryChromeApp = 13,
  // VideoPlayer was replaced by MediaApp in M93 and deleted in M96.
  kDeletedVideoPlayerChromeApp = 14,
  kAudioPlayer = 15,
  kChromeCanvas = 16,
  kCamera = 17,
  kHelpApp = 18,
  kMediaApp = 19,
  kChrome = 20,
  kDocs = 21,
  kDrive = 22,
  kDuo = 23,
  kFiles = 24,
  kGmail = 25,
  kKeep = 26,
  kPhotos = 27,
  kPlayBooks = 28,
  kPlayGames = 29,
  kPlayMovies = 30,
  kPlayMusic = 31,
  kPlayStore = 32,
  kSettings = 33,
  kSheets = 34,
  kSlides = 35,
  kWebStore = 36,
  kYouTube = 37,
  kYouTubeMusic = 38,
  // This is our test SWA. It's only installed in tests.
  kMockSystemApp = 39,
  // Stadia was removed from the web app definitions in M112.
  kDeletedStadia = 40,
  kScanningApp = 41,
  kDiagnosticsApp = 42,
  kPrintManagementApp = 43,
  kShortcutCustomizationApp = 44,
  kShimlessRMAApp = 45,
  kOsFeedbackApp = 46,
  kCursive = 47,
  // MediaAppAudio is scheduled to be absorbed into MediaApp in M97.
  kDeletedMediaAppAudio = 48,
  kProjector = 49,
  kCalculator = 50,
  kFirmwareUpdateApp = 51,
  kGoogleTv = 52,
  kGoogleCalendar = 53,
  kGoogleChat = 54,
  kGoogleMeet = 55,
  kGoogleMaps = 56,
  kGoogleMessages = 57,
  kGemini = 58,
  kMall = 59,
  kSanitizeApp = 60,
  kGraduationApp = 61,
  // Add any new values above this one, and update kMaxValue to the highest
  // enumerator value.
  kMaxValue = kGraduationApp,
};

// The built-in app's histogram name. This is used for logging so do not change
// the order of this enum.
enum class BuiltInAppName {
  kKeyboardShortcutViewer = 0,
  kSettings = 1,
  // kContinueReading = 2, obsolete
  kCameraDeprecated = 3,
  // kDiscover = 4, obsolete
  kPluginVm = 5,
  kReleaseNotes = 6,
  kMaxValue = kReleaseNotes,
};

// Converts an app ID to the corresponding `DefaultAppName`, or nullopt if
// it doesn't match a known ID.
std::optional<apps::DefaultAppName> AppIdToName(const std::string& app_id);

void RecordAppLaunch(const std::string& app_id,
                     apps::LaunchSource launch_source);

// Converts a preinstalled web app ID to the corresponding `DefaultAppName`, or
// nullopt if it doesn't match a known ID.
const std::optional<apps::DefaultAppName> PreinstalledWebAppIdToName(
    const std::string& app_id);

#if BUILDFLAG(IS_CHROMEOS)
// Converts a system web app ID to the corresponding `DefaultAppName`, or
// nullopt if it doesn't match a known ID.
const std::optional<apps::DefaultAppName> SystemWebAppIdToName(
    const std::string& app_id);
#endif  // BUILDFLAG(IS_CHROMEOS)

}  // namespace apps

#endif  // CHROME_BROWSER_APPS_APP_SERVICE_METRICS_APP_SERVICE_METRICS_H_