chromium/components/sync/service/local_data_description.cc

// Copyright 2023 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/sync/service/local_data_description.h"

#include <algorithm>
#include <ranges>
#include <set>
#include <utility>
#include <vector>

#include "base/i18n/message_formatter.h"
#include "base/strings/utf_string_conversions.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"

#if BUILDFLAG(IS_ANDROID)
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"

// Must come after all includes for JniType conversions.
#include "components/sync/android/jni_headers/LocalDataDescription_jni.h"

using base::android::ToJavaArrayOfStrings;
#endif

namespace syncer {

LocalDataDescription::LocalDataDescription() = default;

LocalDataDescription::LocalDataDescription(const std::vector<GURL>& all_urls)
    :{}

LocalDataDescription::LocalDataDescription(const LocalDataDescription&) =
    default;

LocalDataDescription& LocalDataDescription::operator=(
    const LocalDataDescription&) = default;

LocalDataDescription::LocalDataDescription(LocalDataDescription&&) = default;

LocalDataDescription& LocalDataDescription::operator=(LocalDataDescription&&) =
    default;

LocalDataDescription::~LocalDataDescription() = default;

std::u16string GetDomainsDisplayText(const LocalDataDescription& description) {}

void PrintTo(const LocalDataDescription& desc, std::ostream* os) {}

#if BUILDFLAG(IS_ANDROID)
base::android::ScopedJavaLocalRef<jobject> ConvertToJavaLocalDataDescription(
    JNIEnv* env,
    const LocalDataDescription& local_data_description) {
  return Java_LocalDataDescription_Constructor(
      env, local_data_description.item_count,
      base::android::ToJavaArrayOfStrings(env, local_data_description.domains),
      local_data_description.domain_count);
}

std::u16string JNI_LocalDataDescription_GetDomainsDisplayText(
    JNIEnv* env,
    int item_count,
    std::vector<std::string>& domains,
    int domain_count) {
  LocalDataDescription description;
  description.item_count = item_count;
  description.domains = std::move(domains);
  description.domain_count = domain_count;
  return GetDomainsDisplayText(std::move(description));
}
#endif

}  // namespace syncer