chromium/components/browser_sync/sync_client_utils.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/browser_sync/sync_client_utils.h"

#include <algorithm>
#include <functional>
#include <set>
#include <string>
#include <utility>
#include <vector>

#include "base/barrier_closure.h"
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "components/password_manager/core/browser/password_form.h"
#include "components/password_manager/core/browser/password_store/password_store_consumer.h"
#include "components/password_manager/core/browser/password_store/password_store_interface.h"
#include "components/reading_list/core/dual_reading_list_model.h"
#include "components/sync/base/data_type_histogram.h"
#include "components/sync/base/features.h"
#include "components/sync/service/local_data_description.h"
#include "components/sync_bookmarks/bookmark_model_view.h"
#include "components/sync_bookmarks/local_bookmark_model_merger.h"
#include "components/url_formatter/elide_url.h"
#include "ui/base/models/tree_node_iterator.h"

namespace browser_sync {

namespace {

const syncer::DataTypeSet kSupportedTypes =;

template <typename ContainerT, typename F>
syncer::LocalDataDescription CreateLocalDataDescription(ContainerT&& items,
                                                        F&& url_extractor) {}

// Returns urls of all the bookmarks which can be moved to the account store,
// i.e. it does not include folders nor managed bookmarks.
std::vector<GURL> GetAllUserBookmarksExcludingFolders(
    sync_bookmarks::BookmarkModelView* model) {}

// Returns the latest of a password form's last used time, last update time and
// creation time.
base::Time GetLatestOfTimeLastUsedOrModifiedOrCreated(
    const password_manager::PasswordForm& form) {}

// Some of the services required for data migrations might not exist (e.g.
// disabled for some reason) or may not have initialized (initialization is
// ongoing or failed). In these cases, a sensible fallback is to exclude the
// affected types. This function returns the set of types that are usable,
// i.e. their dependent services are available and ready.
syncer::DataTypeSet FilterUsableTypes(
    syncer::DataTypeSet types,
    password_manager::PasswordStoreInterface* profile_password_store,
    password_manager::PasswordStoreInterface* account_password_store,
    sync_bookmarks::BookmarkModelView* local_bookmark_model_view,
    sync_bookmarks::BookmarkModelView* account_bookmark_model_view,
    reading_list::DualReadingListModel* reading_list_model) {}

}  // namespace

// A class to represent individual local data query requests.
class LocalDataQueryHelper::LocalDataQueryRequest
    : public password_manager::PasswordStoreConsumer {};

LocalDataQueryHelper::LocalDataQueryHelper(
    password_manager::PasswordStoreInterface* profile_password_store,
    password_manager::PasswordStoreInterface* account_password_store,
    bookmarks::BookmarkModel* bookmark_model,
    reading_list::DualReadingListModel* dual_reading_list_model)
    :{}

LocalDataQueryHelper::~LocalDataQueryHelper() = default;

void LocalDataQueryHelper::Run(
    syncer::DataTypeSet types,
    base::OnceCallback<void(
        std::map<syncer::DataType, syncer::LocalDataDescription>)> callback) {}

void LocalDataQueryHelper::OnRequestComplete(
    LocalDataQueryRequest* request,
    base::OnceCallback<void(
        std::map<syncer::DataType, syncer::LocalDataDescription>)> callback) {}

// A class to represent individual local data migration requests.
class LocalDataMigrationHelper::LocalDataMigrationRequest
    : public password_manager::PasswordStoreConsumer {};

LocalDataMigrationHelper::LocalDataMigrationHelper(
    password_manager::PasswordStoreInterface* profile_password_store,
    password_manager::PasswordStoreInterface* account_password_store,
    bookmarks::BookmarkModel* bookmark_model,
    reading_list::DualReadingListModel* dual_reading_list_model)
    :{}

LocalDataMigrationHelper::~LocalDataMigrationHelper() = default;

void LocalDataMigrationHelper::Run(syncer::DataTypeSet types) {}

syncer::DataTypeSet LocalDataMigrationHelper::GetTypesWithOngoingMigrations()
    const {}

void LocalDataMigrationHelper::OnRequestComplete(
    LocalDataMigrationRequest* request) {}

}  // namespace browser_sync