blob: 450fbf32115443b7dd1152483024cb8fb3a1ff8e [file] [log] [blame]
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "storage/browser/file_system/file_system_util.h"
#include "storage/common/file_system/file_system_types.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
namespace storage {
blink::mojom::StorageType FileSystemTypeToQuotaStorageType(
FileSystemType type) {
if (blink::features::IsPersistentQuotaIsTemporaryQuota() &&
(type == kFileSystemTypeTemporary || type == kFileSystemTypePersistent)) {
return blink::mojom::StorageType::kTemporary;
}
switch (type) {
case kFileSystemTypeTemporary:
return blink::mojom::StorageType::kTemporary;
case kFileSystemTypePersistent:
return blink::mojom::StorageType::kPersistent;
case kFileSystemTypeSyncable:
case kFileSystemTypeSyncableForInternalSync:
return blink::mojom::StorageType::kSyncable;
default:
return blink::mojom::StorageType::kUnknown;
}
}
} // namespace storage