OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_DOWNLOAD_INTERNAL_PROTO_CONVERSIONS_H_ |
| 6 #define COMPONENTS_DOWNLOAD_INTERNAL_PROTO_CONVERSIONS_H_ |
| 7 |
| 8 #include "components/download/internal/entry.h" |
| 9 #include "components/download/internal/proto/entry.pb.h" |
| 10 #include "components/download/internal/proto/request.pb.h" |
| 11 #include "components/download/internal/proto/scheduling.pb.h" |
| 12 |
| 13 namespace download { |
| 14 |
| 15 class ProtoConversions { |
| 16 public: |
| 17 static Entry EntryFromProto(const protodb::Entry& proto); |
| 18 |
| 19 static protodb::Entry EntryToProto(const Entry& entry); |
| 20 |
| 21 static std::unique_ptr<std::vector<Entry>> EntryVectorFromProto( |
| 22 std::unique_ptr<std::vector<protodb::Entry>> proto); |
| 23 |
| 24 static std::unique_ptr<std::vector<protodb::Entry>> EntryVectorToProto( |
| 25 std::unique_ptr<std::vector<Entry>> entries); |
| 26 |
| 27 protected: |
| 28 static protodb::Entry_State RequestStateToProto(Entry::State state); |
| 29 static Entry::State RequestStateFromProto(protodb::Entry_State state); |
| 30 |
| 31 static protodb::DownloadClient DownloadClientToProto(DownloadClient client); |
| 32 static DownloadClient DownloadClientFromProto(protodb::DownloadClient client); |
| 33 |
| 34 static SchedulingParams::NetworkRequirements NetworkRequirementsFromProto( |
| 35 protodb::SchedulingParams_NetworkRequirements network_requirements); |
| 36 static protodb::SchedulingParams_NetworkRequirements |
| 37 NetworkRequirementsToProto( |
| 38 SchedulingParams::NetworkRequirements network_requirements); |
| 39 |
| 40 static SchedulingParams::BatteryRequirements BatteryRequirementsFromProto( |
| 41 protodb::SchedulingParams_BatteryRequirements battery_requirements); |
| 42 static protodb::SchedulingParams_BatteryRequirements |
| 43 BatteryRequirementsToProto( |
| 44 SchedulingParams::BatteryRequirements battery_requirements); |
| 45 |
| 46 static SchedulingParams::Priority SchedulingPriorityFromProto( |
| 47 protodb::SchedulingParams_Priority priority); |
| 48 static protodb::SchedulingParams_Priority SchedulingPriorityToProto( |
| 49 SchedulingParams::Priority priority); |
| 50 |
| 51 static SchedulingParams SchedulingParamsFromProto( |
| 52 const protodb::SchedulingParams& proto); |
| 53 static void SchedulingParamsToProto(const SchedulingParams& scheduling_params, |
| 54 protodb::SchedulingParams* proto); |
| 55 |
| 56 static RequestParams RequestParamsFromProto( |
| 57 const protodb::RequestParams& proto); |
| 58 static void RequestParamsToProto(const RequestParams& request_params, |
| 59 protodb::RequestParams* proto); |
| 60 }; |
| 61 |
| 62 } // namespace download |
| 63 |
| 64 #endif // COMPONENTS_DOWNLOAD_INTERNAL_PROTO_CONVERSIONS_H_ |
OLD | NEW |