// 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/chromeos_buildflags.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 { … }; // The built-in app's histogram name. This is used for logging so do not change // the order of this enum. enum class BuiltInAppName { … }; // 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_ASH) // 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_ASH) } // namespace apps #endif // CHROME_BROWSER_APPS_APP_SERVICE_METRICS_APP_SERVICE_METRICS_H_