chromium/components/webapps/browser/install_result_code.h

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

#ifndef COMPONENTS_WEBAPPS_BROWSER_INSTALL_RESULT_CODE_H_
#define COMPONENTS_WEBAPPS_BROWSER_INSTALL_RESULT_CODE_H_

#include <iosfwd>

namespace webapps {

// The result of an attempted web app installation, uninstallation or update.
//
// This is an enum, instead of a struct with multiple fields (e.g. one field for
// success or failure, one field for whether action was taken), because we want
// to track metrics for the overall cross product of the these axes.
//
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused. Update corresponding enums.xml entry
// when making changes here.
enum class InstallResultCode {};

// Checks if InstallResultCode is not a failure.
bool IsSuccess(InstallResultCode code);

// Checks if InstallResultCode indicates a new app was installed.
bool IsNewInstall(InstallResultCode code);

std::ostream& operator<<(std::ostream& os, InstallResultCode code);

}  // namespace webapps

#endif  // COMPONENTS_WEBAPPS_BROWSER_INSTALL_RESULT_CODE_H_