// 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. #ifndef CHROME_BROWSER_UI_STARTUP_LAUNCH_MODE_RECORDER_H_ #define CHROME_BROWSER_UI_STARTUP_LAUNCH_MODE_RECORDER_H_ #include <optional> #include "base/functional/callback_forward.h" namespace base { class CommandLine; } // These enums describe how Chrome was launched. They are determined from the // command line switches and arguments, not from what Chrome does when launched. // "Web App" is shorthand for Chrome launched with --app or --appid switches, // "Chrome" is Chrome launched with neither of those switches. // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum class LaunchMode { … }; // Computes and records the launch mode based on `command_line` and process // state. The launch mode may be recorded asynchronously. void ComputeAndRecordLaunchMode(const base::CommandLine& command_line); // Computes the launch mode based on `command_line` and process state. Runs // `result_callback` with the result either synchronously or asynchronously on // the caller's sequence. // This is exposed for testing. void ComputeLaunchMode( const base::CommandLine& command_line, base::OnceCallback<void(std::optional<LaunchMode>)> result_callback); // Returns the callback used to record launch modes. This is used by unit tests // to verify its behavior. base::OnceCallback<void(std::optional<LaunchMode>)> GetRecordLaunchModeForTesting(); #endif // CHROME_BROWSER_UI_STARTUP_LAUNCH_MODE_RECORDER_H_