#include "chrome/browser/web_applications/os_integration/web_app_file_handler_registration.h"
#include <memory>
#include <string>
#include <vector>
#include "base/check_is_test.h"
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/nix/xdg_util.h"
#include "base/no_destructor.h"
#include "base/strings/string_util.h"
#include "chrome/browser/shell_integration_linux.h"
#include "chrome/browser/web_applications/os_integration/os_integration_manager.h"
#include "chrome/browser/web_applications/os_integration/os_integration_test_override.h"
#include "chrome/browser/web_applications/os_integration/web_app_shortcut.h"
namespace web_app {
namespace {
enum class RegistrationResult { … };
constexpr const char* kRegistrationResultMetric = …;
constexpr const char* kUnregistrationResultMetric = …;
void RecordRegistration(RegistrationResult result, bool install) { … }
void OnMimeInfoDatabaseUpdated(bool install,
ResultCallback result_callback,
bool registration_succeeded) { … }
UpdateMimeInfoDatabaseOnLinuxCallback&
GetUpdateMimeInfoDatabaseCallbackForTesting() { … }
void RefreshMimeInfoCache() { … }
bool UpdateMimeInfoDatabase(bool install,
base::FilePath filename,
std::string file_contents) { … }
void UninstallMimeInfoOnLinux(const webapps::AppId& app_id,
const base::FilePath& profile_path,
ResultCallback on_done) { … }
}
bool ShouldRegisterFileHandlersWithOs() { … }
bool FileHandlingIconsSupportedByOs() { … }
void RegisterFileHandlersWithOs(const webapps::AppId& app_id,
const std::string& app_name,
const base::FilePath& profile_path,
const apps::FileHandlers& file_handlers,
ResultCallback callback) { … }
void UnregisterFileHandlersWithOs(const webapps::AppId& app_id,
const base::FilePath& profile_path,
ResultCallback callback) { … }
void InstallMimeInfoOnLinux(const webapps::AppId& app_id,
const base::FilePath& profile_path,
const apps::FileHandlers& file_handlers,
ResultCallback done_callback) { … }
void SetUpdateMimeInfoDatabaseOnLinuxCallbackForTesting(
UpdateMimeInfoDatabaseOnLinuxCallback callback) { … }
}