1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
// Copyright 2017 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_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_PROTO_CONVERSIONS_H_
#define COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_PROTO_CONVERSIONS_H_
#include "components/download/internal/background_service/entry.h"
#include "components/download/internal/background_service/proto/entry.pb.h"
#include "components/download/internal/background_service/proto/request.pb.h"
#include "components/download/internal/background_service/proto/scheduling.pb.h"
namespace download {
class ProtoConversions {
public:
static Entry EntryFromProto(const protodb::Entry& proto);
static protodb::Entry EntryToProto(const Entry& entry);
static std::unique_ptr<std::vector<Entry>> EntryVectorFromProto(
std::unique_ptr<std::vector<protodb::Entry>> proto);
static std::unique_ptr<std::vector<protodb::Entry>> EntryVectorToProto(
std::unique_ptr<std::vector<Entry>> entries);
protected:
static protodb::Entry_State RequestStateToProto(Entry::State state);
static Entry::State RequestStateFromProto(protodb::Entry_State state);
static protodb::DownloadClient DownloadClientToProto(DownloadClient client);
static DownloadClient DownloadClientFromProto(protodb::DownloadClient client);
static SchedulingParams::NetworkRequirements NetworkRequirementsFromProto(
protodb::SchedulingParams_NetworkRequirements network_requirements);
static protodb::SchedulingParams_NetworkRequirements
NetworkRequirementsToProto(
SchedulingParams::NetworkRequirements network_requirements);
static SchedulingParams::BatteryRequirements BatteryRequirementsFromProto(
protodb::SchedulingParams_BatteryRequirements battery_requirements);
static protodb::SchedulingParams_BatteryRequirements
BatteryRequirementsToProto(
SchedulingParams::BatteryRequirements battery_requirements);
static SchedulingParams::Priority SchedulingPriorityFromProto(
protodb::SchedulingParams_Priority priority);
static protodb::SchedulingParams_Priority SchedulingPriorityToProto(
SchedulingParams::Priority priority);
static SchedulingParams SchedulingParamsFromProto(
const protodb::SchedulingParams& proto);
static void SchedulingParamsToProto(const SchedulingParams& scheduling_params,
protodb::SchedulingParams* proto);
static RequestParams RequestParamsFromProto(
const protodb::RequestParams& proto);
static void RequestParamsToProto(const RequestParams& request_params,
protodb::RequestParams* proto);
};
} // namespace download
#endif // COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_PROTO_CONVERSIONS_H_
|