#include "chrome/browser/web_applications/os_integration/file_handling_sub_manager.h"
#include <utility>
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/os_integration/os_integration_test_override.h"
#include "chrome/browser/web_applications/os_integration/web_app_file_handler_registration.h"
#include "chrome/browser/web_applications/proto/web_app_install_state.pb.h"
#include "chrome/browser/web_applications/proto/web_app_os_integration_state.pb.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_registry_update.h"
#include "chrome/browser/web_applications/web_app_sync_bridge.h"
#include "components/services/app_service/public/cpp/file_handler.h"
#if BUILDFLAG(IS_MAC)
#include "chrome/browser/web_applications/os_integration/os_integration_manager.h"
#endif
namespace web_app {
namespace {
apps::FileHandlers ConvertFileHandlingProtoToFileHandlers(
const proto::FileHandling file_handling_proto) { … }
bool HasFileHandling(
const proto::WebAppOsIntegrationState& os_integration_state) { … }
}
std::set<std::string> GetFileExtensionsFromFileHandlingProto(
const proto::FileHandling& file_handling) { … }
std::set<std::string> GetMimeTypesFromFileHandlingProto(
const proto::FileHandling& file_handling) { … }
FileHandlingSubManager::FileHandlingSubManager(
const base::FilePath& profile_path,
WebAppProvider& provider)
: … { … }
FileHandlingSubManager::~FileHandlingSubManager() = default;
void FileHandlingSubManager::Configure(
const webapps::AppId& app_id,
proto::WebAppOsIntegrationState& desired_state,
base::OnceClosure configure_done) { … }
void FileHandlingSubManager::Execute(
const webapps::AppId& app_id,
const std::optional<SynchronizeOsOptions>& synchronize_options,
const proto::WebAppOsIntegrationState& desired_state,
const proto::WebAppOsIntegrationState& current_state,
base::OnceClosure callback) { … }
void FileHandlingSubManager::ForceUnregister(const webapps::AppId& app_id,
base::OnceClosure callback) { … }
void FileHandlingSubManager::Unregister(
const webapps::AppId& app_id,
const proto::WebAppOsIntegrationState& desired_state,
const proto::WebAppOsIntegrationState& current_state,
base::OnceClosure callback) { … }
void FileHandlingSubManager::Register(
const webapps::AppId& app_id,
const proto::WebAppOsIntegrationState& desired_state,
base::OnceClosure callback) { … }
}