#include "components/services/app_service/public/cpp/preferred_apps_impl.h"
#include <iterator>
#include <utility>
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
#include "base/sequence_checker.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
#include "components/services/app_service/public/cpp/intent_filter_util.h"
#include "components/services/app_service/public/cpp/preferred_apps_converter.h"
namespace {
const base::FilePath::CharType kPreferredAppsDirname[] = …);
enum class PreferredAppsFileIOAction { … };
enum class PreferredAppsUpdateAction { … };
void LogPreferredAppEntryCount(int entry_count) { … }
void WriteDataBlocking(const base::FilePath& preferred_apps_file,
const std::string& preferred_apps) { … }
std::string ReadDataBlocking(const base::FilePath& preferred_apps_file) { … }
}
namespace apps {
PreferredAppsImpl::PreferredAppsImpl(
Host* host,
const base::FilePath& profile_dir,
base::OnceClosure read_completed_for_testing,
base::OnceClosure write_completed_for_testing)
: … { … }
PreferredAppsImpl::~PreferredAppsImpl() { … }
void PreferredAppsImpl::RemovePreferredApp(const std::string& app_id) { … }
void PreferredAppsImpl::SetSupportedLinksPreference(
const std::string& app_id,
IntentFilters all_link_filters) { … }
void PreferredAppsImpl::RemoveSupportedLinksPreference(
const std::string& app_id) { … }
void PreferredAppsImpl::InitializePreferredApps() { … }
void PreferredAppsImpl::WriteToJSON(
const base::FilePath& profile_dir,
const apps::PreferredAppsList& preferred_apps) { … }
void PreferredAppsImpl::WriteCompleted() { … }
void PreferredAppsImpl::ReadFromJSON(const base::FilePath& profile_dir) { … }
void PreferredAppsImpl::ReadCompleted(std::string preferred_apps_string) { … }
void PreferredAppsImpl::RunAfterPreferredAppsReady(base::OnceClosure task) { … }
void PreferredAppsImpl::RemovePreferredAppImpl(const std::string& app_id) { … }
void PreferredAppsImpl::SetSupportedLinksPreferenceImpl(
const std::string& app_id,
IntentFilters all_link_filters) { … }
void PreferredAppsImpl::RemoveSupportedLinksPreferenceImpl(
const std::string& app_id) { … }
}