chromium/components/live_caption/live_translate_controller.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/live_caption/live_translate_controller.h"

#include <memory>
#include <string>
#include <utility>

#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/metrics_hashes.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "components/live_caption/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
#include "components/soda/constants.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "google_apis/google_api_keys.h"
#include "media/mojo/mojom/speech_recognition_result.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/http/http_request_headers.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "url/gurl.h"

namespace captions {

// Request constants.
const size_t kMaxMessageSize =;  // 1MB
constexpr char kTranslateBodyRequestTemplate[] =;
constexpr char kTranslateUrl[] =;
constexpr char kUploadContentType[] =;

// Response constants.
constexpr char kDataKey[] =;
constexpr char kTranslationsKey[] =;
constexpr char kTranslatedTextKey[] =;

LiveTranslateController::LiveTranslateController(
    PrefService* profile_prefs,
    content::BrowserContext* browser_context)
    :{}

LiveTranslateController::~LiveTranslateController() = default;
// static
void LiveTranslateController::RegisterProfilePrefs(
    user_prefs::PrefRegistrySyncable* registry) {}

void LiveTranslateController::GetTranslation(
    const std::string& result,
    std::string source_language,
    std::string target_language,
    OnTranslateEventCallback callback) {}

void LiveTranslateController::ResetURLLoaderFactory() {}

void LiveTranslateController::OnURLLoadComplete(
    OnTranslateEventCallback callback,
    std::unique_ptr<std::string> response_body) {}

void LiveTranslateController::OnResponseJsonParsed(
    OnTranslateEventCallback callback,
    data_decoder::DataDecoder::ValueOrError result) {}

void LiveTranslateController::OnLiveTranslateEnabledChanged() {}

}  // namespace captions