#include "components/feed/core/v2/protocol_translator.h"
#include <optional>
#include <string>
#include <utility>
#include "base/logging.h"
#include "base/time/time.h"
#include "components/feed/core/proto/v2/packing.pb.h"
#include "components/feed/core/proto/v2/wire/chrome_feed_response_metadata.pb.h"
#include "components/feed/core/proto/v2/wire/data_operation.pb.h"
#include "components/feed/core/proto/v2/wire/feature.pb.h"
#include "components/feed/core/proto/v2/wire/feed_response.pb.h"
#include "components/feed/core/proto/v2/wire/payload_metadata.pb.h"
#include "components/feed/core/proto/v2/wire/request_schedule.pb.h"
#include "components/feed/core/proto/v2/wire/stream_structure.pb.h"
#include "components/feed/core/proto/v2/wire/token.pb.h"
#include "components/feed/core/v2/feedstore_util.h"
#include "components/feed/core/v2/ios_shared_experiments_translator.h"
#include "components/feed/core/v2/metrics_reporter.h"
#include "components/feed/core/v2/proto_util.h"
#include "components/feed/feed_feature_list.h"
namespace feed {
namespace {
feedstore::StreamStructure::Operation TranslateOperationType(
feedwire::DataOperation::Operation operation) { … }
feedstore::StreamStructure::Type TranslateNodeType(
feedwire::Feature::RenderableUnit renderable_unit) { … }
feedstore::Metadata::StreamMetadata::ContentLifetime TranslateContentLifetime(
feedwire::ContentLifetime content_lifetime) { … }
base::TimeDelta TranslateDuration(const feedwire::Duration& v) { … }
std::optional<RequestSchedule> TranslateRequestSchedule(
base::Time now,
const feedwire::RequestSchedule& v) { … }
struct ConvertedGlobalData { … };
struct ConvertedDataOperation { … };
bool TranslateFeature(feedwire::Feature* feature,
ConvertedDataOperation& result) { … }
std::optional<feedstore::StreamSharedState> TranslateSharedState(
feedwire::ContentId content_id,
feedwire::RenderData& wire_shared_state) { … }
bool TranslatePayload(base::Time now,
feedwire::DataOperation operation,
ConvertedGlobalData* global_data,
ConvertedDataOperation& result) { … }
std::optional<ConvertedDataOperation> TranslateDataOperationInternal(
base::Time now,
feedwire::DataOperation operation,
ConvertedGlobalData* global_data) { … }
}
StreamModelUpdateRequest::StreamModelUpdateRequest() = default;
StreamModelUpdateRequest::~StreamModelUpdateRequest() = default;
StreamModelUpdateRequest::StreamModelUpdateRequest(
const StreamModelUpdateRequest&) = default;
StreamModelUpdateRequest& StreamModelUpdateRequest::operator=(
const StreamModelUpdateRequest&) = default;
RefreshResponseData::RefreshResponseData() = default;
RefreshResponseData::~RefreshResponseData() = default;
RefreshResponseData::RefreshResponseData(RefreshResponseData&&) = default;
RefreshResponseData& RefreshResponseData::operator=(RefreshResponseData&&) =
default;
std::optional<feedstore::DataOperation> TranslateDataOperation(
base::Time now,
feedwire::DataOperation wire_operation) { … }
RefreshResponseData TranslateWireResponse(
feedwire::Response response,
StreamModelUpdateRequest::Source source,
const AccountInfo& account_info,
base::Time current_time) { … }
std::vector<feedstore::DataOperation> TranslateDismissData(
base::Time current_time,
feedpacking::DismissData data) { … }
}