#include "chrome/browser/web_applications/os_integration/shortcut_sub_manager.h"
#include <string>
#include <utility>
#include "base/containers/flat_map.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.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"
#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_icon_manager.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/sync/base/time.h"
#if BUILDFLAG(IS_MAC)
#include "chrome/browser/web_applications/os_integration/mac/app_shim_registry.h"
#endif
namespace web_app {
namespace {
enum class CreationResult { … };
}
ShortcutSubManager::ShortcutSubManager(Profile& profile,
WebAppProvider& provider)
: … { … }
ShortcutSubManager::~ShortcutSubManager() = default;
void ShortcutSubManager::Configure(
const webapps::AppId& app_id,
proto::WebAppOsIntegrationState& desired_state,
base::OnceClosure configure_done) { … }
void ShortcutSubManager::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 ShortcutSubManager::ForceUnregister(const webapps::AppId& app_id,
base::OnceClosure callback) { … }
void ShortcutSubManager::CreateShortcut(
const webapps::AppId& app_id,
std::optional<SynchronizeOsOptions> synchronize_options,
base::OnceClosure on_complete,
std::unique_ptr<ShortcutInfo> shortcut_info) { … }
void ShortcutSubManager::UpdateShortcut(
const webapps::AppId& app_id,
std::optional<SynchronizeOsOptions> synchronize_options,
const std::u16string& old_app_title,
base::OnceClosure on_complete,
std::unique_ptr<ShortcutInfo> shortcut_info) { … }
void ShortcutSubManager::OnShortcutsDeleted(const webapps::AppId& app_id,
base::OnceClosure final_callback,
bool success) { … }
void ShortcutSubManager::StoreIconDataFromDisk(
proto::ShortcutDescription* shortcut,
base::flat_map<SquareSizePx, base::Time> time_map) { … }
}