#ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_RESPONSE_H_
#define CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_RESPONSE_H_
#include <vector>
#include "base/files/file_path.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
#include "net/http/http_response_headers.h"
#include "storage/browser/blob/blob_data_handle.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace content {
struct CONTENT_EXPORT BackgroundFetchResponse {
BackgroundFetchResponse(
const std::vector<GURL>& url_chain,
const scoped_refptr<const net::HttpResponseHeaders>& headers);
BackgroundFetchResponse(const BackgroundFetchResponse&) = delete;
BackgroundFetchResponse& operator=(const BackgroundFetchResponse&) = delete;
~BackgroundFetchResponse();
const std::vector<GURL> url_chain;
const scoped_refptr<const net::HttpResponseHeaders> headers;
};
struct CONTENT_EXPORT BackgroundFetchResult {
enum class FailureReason {
NONE,
NETWORK,
TIMEDOUT,
CANCELLED,
FETCH_ERROR,
};
BackgroundFetchResult(std::unique_ptr<BackgroundFetchResponse> response,
base::Time response_time,
FailureReason failure_reason);
BackgroundFetchResult(std::unique_ptr<BackgroundFetchResponse> response,
base::Time response_time,
const base::FilePath& path,
absl::optional<storage::BlobDataHandle> blob_handle,
uint64_t file_size);
BackgroundFetchResult(const BackgroundFetchResult&) = delete;
BackgroundFetchResult& operator=(const BackgroundFetchResult&) = delete;
~BackgroundFetchResult();
std::unique_ptr<BackgroundFetchResponse> response;
const base::Time response_time;
const base::FilePath file_path;
absl::optional<storage::BlobDataHandle> blob_handle;
const uint64_t file_size = 0;
FailureReason failure_reason;
};
}
#endif