blob: 350316be13d2a3ead4dd7b52c4dd8d017c1858d5 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_SYNC_INSTALL_DELEGATE_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_SYNC_INSTALL_DELEGATE_H_
#include <memory>
#include <vector>
#include "base/callback_forward.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
namespace web_app {
class WebApp;
// WebAppSyncBridge delegates sync-initiated installs and uninstalls using
// this interface.
class SyncInstallDelegate {
public:
virtual ~SyncInstallDelegate() = default;
using RepeatingInstallCallback =
base::RepeatingCallback<void(const AppId& app_id,
InstallResultCode code)>;
using RepeatingUninstallCallback =
base::RepeatingCallback<void(const AppId& app_id, bool uninstalled)>;
// |web_apps| are already registered and owned by the registrar.
virtual void InstallWebAppsAfterSync(std::vector<WebApp*> web_apps,
RepeatingInstallCallback callback) = 0;
// |web_apps| are already unregistered and not owned by the registrar.
virtual void UninstallWebAppsAfterSync(
std::vector<std::unique_ptr<WebApp>> web_apps,
RepeatingUninstallCallback callback) = 0;
};
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_SYNC_INSTALL_DELEGATE_H_