#include "chrome/browser/web_applications/isolated_web_apps/key_distribution/iwa_key_distribution_info_provider.h"
#include "base/base64.h"
#include "base/containers/map_util.h"
#include "base/files/file_util.h"
#include "base/memory/singleton.h"
#include "base/no_destructor.h"
#include "base/task/thread_pool.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "chrome/browser/web_applications/isolated_web_apps/key_distribution/proto/key_distribution.pb.h"
namespace web_app {
namespace {
IwaKeyDistributionInfoProvider::KeyRotations& GetDevModeKeyRotationData() { … }
base::expected<IwaKeyDistributionInfoProvider::KeyRotations,
IwaKeyDistributionInfoProvider::ComponentUpdateError>
LoadKeyDistributionDataImpl(const base::FilePath& file_path) { … }
}
BASE_FEATURE(…);
IwaKeyDistributionInfoProvider::KeyRotationInfo::KeyRotationInfo(
std::optional<PublicKeyData> public_key)
: … { … }
IwaKeyDistributionInfoProvider::KeyRotationInfo::~KeyRotationInfo() = default;
IwaKeyDistributionInfoProvider::KeyRotationInfo::KeyRotationInfo(
const KeyRotationInfo&) = default;
base::Value IwaKeyDistributionInfoProvider::KeyRotationInfo::AsDebugValue()
const { … }
IwaKeyDistributionInfoProvider* IwaKeyDistributionInfoProvider::GetInstance() { … }
const IwaKeyDistributionInfoProvider::KeyRotationInfo*
IwaKeyDistributionInfoProvider::GetKeyRotationInfo(
const std::string& web_bundle_id) const { … }
void IwaKeyDistributionInfoProvider::LoadKeyDistributionData(
const base::Version& component_version,
const base::FilePath& file_path) { … }
IwaKeyDistributionInfoProvider::IwaKeyDistributionInfoProvider()
: … { … }
IwaKeyDistributionInfoProvider::~IwaKeyDistributionInfoProvider() = default;
void IwaKeyDistributionInfoProvider::OnKeyDistributionDataLoaded(
const base::Version& component_version,
base::expected<KeyRotations, ComponentUpdateError> result) { … }
void IwaKeyDistributionInfoProvider::AddObserver(Observer* observer) { … }
void IwaKeyDistributionInfoProvider::RemoveObserver(Observer* observer) { … }
void IwaKeyDistributionInfoProvider::RotateKeyForDevMode(
base::PassKey<WebAppInternalsHandler>,
const std::string& web_bundle_id,
const std::optional<std::vector<uint8_t>>& rotated_key) { … }
base::Value IwaKeyDistributionInfoProvider::AsDebugValue() const { … }
void IwaKeyDistributionInfoProvider::DispatchComponentUpdateSuccess(
const base::Version& component_version) const { … }
void IwaKeyDistributionInfoProvider::DispatchComponentUpdateError(
const base::Version& component_version,
ComponentUpdateError error) const { … }
IwaKeyDistributionInfoProvider::ComponentData::ComponentData(
base::Version version,
KeyRotations key_rotations)
: … { … }
IwaKeyDistributionInfoProvider::ComponentData::~ComponentData() = default;
IwaKeyDistributionInfoProvider::ComponentData::ComponentData(
const ComponentData&) = default;
}