#include "chrome/browser/web_applications/os_integration/shortcut_menu_handling_sub_manager.h"
#include <utility>
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.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_shortcut.h"
#include "chrome/browser/web_applications/os_integration/web_app_shortcuts_menu.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 "components/sync/base/time.h"
#include "url/gurl.h"
namespace web_app {
namespace {
bool HasShortcutsMenuInfo(const proto::WebAppOsIntegrationState& state) { … }
enum class ShortcutMenuIconDataDiffResult { … };
void MeasureShortcutMenuIconHistograms(int icon_count, int item_count) { … }
}
ShortcutMenuHandlingSubManager::ShortcutMenuHandlingSubManager(
const base::FilePath& profile_path,
WebAppProvider& provider)
: … { … }
ShortcutMenuHandlingSubManager::~ShortcutMenuHandlingSubManager() = default;
void ShortcutMenuHandlingSubManager::Configure(
const webapps::AppId& app_id,
proto::WebAppOsIntegrationState& desired_state,
base::OnceClosure configure_done) { … }
void ShortcutMenuHandlingSubManager::Execute(
const webapps::AppId& app_id,
const std::optional<SynchronizeOsOptions>& synchronize_options,
const proto::WebAppOsIntegrationState& desired_state,
const proto::WebAppOsIntegrationState& current_state,
base::OnceClosure execute_complete) { … }
void ShortcutMenuHandlingSubManager::ForceUnregister(
const webapps::AppId& app_id,
base::OnceClosure callback) { … }
void ShortcutMenuHandlingSubManager::StoreShortcutMenuData(
const webapps::AppId& app_id,
std::vector<WebAppShortcutsMenuItemInfo> shortcut_menu_item_info,
proto::ShortcutMenus* shortcut_menus,
WebAppIconManager::ShortcutIconDataVector downloaded_shortcut_menu_items) { … }
void ShortcutMenuHandlingSubManager::StartShortcutsMenuUnregistration(
const webapps::AppId& app_id,
const proto::WebAppOsIntegrationState& current_state,
base::OnceClosure registration_callback) { … }
void ShortcutMenuHandlingSubManager::ReadIconDataForShortcutsMenu(
const webapps::AppId& app_id,
const proto::WebAppOsIntegrationState& desired_state,
base::OnceClosure execute_complete) { … }
void ShortcutMenuHandlingSubManager::OnIconDataLoadedRegisterShortcutsMenu(
const webapps::AppId& app_id,
const proto::WebAppOsIntegrationState& desired_state,
base::OnceClosure execute_complete,
ShortcutsMenuIconBitmaps shortcut_menu_icon_bitmaps) { … }
}