#include "components/optimization_guide/core/model_execution/json_response_parser.h"
#include <optional>
#include "base/functional/callback.h"
#include "base/types/expected.h"
#include "base/values.h"
#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.h"
#include "components/optimization_guide/core/model_execution/response_parser.h"
#include "components/optimization_guide/proto/features/tab_organization.pb.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
namespace optimization_guide {
namespace {
ResponseParser::Result ExtractProto(
std::string type_name,
base::expected<base::Value, std::string> parse_result) { … }
}
JsonResponseParser::JsonResponseParser(
const proto::OnDeviceModelExecutionOutputConfig& config)
: … { … }
JsonResponseParser::~JsonResponseParser() = default;
void JsonResponseParser::ParseAsync(const std::string& redacted_output,
ResultCallback callback) const { … }
JsonResponseParserFactory::JsonResponseParserFactory() = default;
JsonResponseParserFactory::~JsonResponseParserFactory() = default;
std::unique_ptr<ResponseParser> JsonResponseParserFactory::CreateParser(
const proto::OnDeviceModelExecutionOutputConfig& config) { … }
}