#ifndef CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_DATABASE_HELPERS_H_
#define CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_DATABASE_HELPERS_H_
#include <string>
#include "content/browser/background_fetch/background_fetch.pb.h"
#include "content/common/background_fetch/background_fetch_types.h"
#include "content/common/content_export.h"
#include "content/public/browser/background_fetch_delegate.h"
#include "third_party/blink/public/common/service_worker/service_worker_status_code.h"
namespace content {
namespace background_fetch {
const char kSeparator[] = …;
const char kActiveRegistrationUniqueIdKeyPrefix[] = …;
const char kRegistrationKeyPrefix[] = …;
const char kUIOptionsKeyPrefix[] = …;
const char kPendingRequestKeyPrefix[] = …;
const char kActiveRequestKeyPrefix[] = …;
const char kCompletedRequestKeyPrefix[] = …;
const char kStorageVersionKeyPrefix[] = …;
CONTENT_EXPORT std::string ActiveRegistrationUniqueIdKey(
const std::string& developer_id);
CONTENT_EXPORT std::string RegistrationKey(const std::string& unique_id);
std::string UIOptionsKey(const std::string& unique_id);
std::string PendingRequestKeyPrefix(const std::string& unique_id);
std::string PendingRequestKey(const std::string& unique_id, int request_index);
std::string ActiveRequestKeyPrefix(const std::string& unique_id);
std::string ActiveRequestKey(const std::string& unique_id, int request_index);
std::string CompletedRequestKeyPrefix(const std::string& unique_id);
std::string CompletedRequestKey(const std::string& unique_id,
int request_index);
CONTENT_EXPORT std::string StorageVersionKey(const std::string& unique_id);
enum class DatabaseStatus { … };
DatabaseStatus ToDatabaseStatus(blink::ServiceWorkerStatusCode status);
bool ToBackgroundFetchRegistration(
const proto::BackgroundFetchMetadata& metadata_proto,
blink::mojom::BackgroundFetchRegistrationData* registration_data);
CONTENT_EXPORT blink::StorageKey GetMetadataStorageKey(
const content::proto::BackgroundFetchMetadata& metadata_proto);
bool MojoFailureReasonFromRegistrationProto(
proto::BackgroundFetchRegistration_BackgroundFetchFailureReason
proto_failure_reason,
blink::mojom::BackgroundFetchFailureReason* failure_reason);
CONTENT_EXPORT GURL MakeCacheUrlUnique(const GURL& url,
const std::string& unique_id,
size_t request_index);
CONTENT_EXPORT GURL RemoveUniqueParamFromCacheURL(const GURL& url,
const std::string& unique_id);
}
}
#endif