blob: 661fa127b07b9d7082994f98262d992b5615ae9a [file] [log] [blame]
// Copyright 2018 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_INSTALL_FINALIZER_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_INSTALL_FINALIZER_H_
#include <memory>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/web_applications/components/install_finalizer.h"
struct WebApplicationInfo;
namespace web_app {
class WebApp;
class WebAppIconManager;
class WebAppRegistrar;
class WebAppInstallFinalizer final : public InstallFinalizer {
public:
WebAppInstallFinalizer(WebAppRegistrar* registrar,
WebAppIconManager* icon_manager);
~WebAppInstallFinalizer() override;
// InstallFinalizer:
void FinalizeInstall(const WebApplicationInfo& web_app_info,
InstallFinalizedCallback callback) override;
bool CanCreateOsShortcuts() const override;
void CreateOsShortcuts(const AppId& app_id,
CreateOsShortcutsCallback callback) override;
bool CanPinAppToShelf() const override;
void PinAppToShelf(const AppId& app_id) override;
bool CanReparentTab(const AppId& app_id,
bool shortcut_created) const override;
void ReparentTab(const AppId& app_id,
content::WebContents* web_contents) override;
bool CanRevealAppShim() const override;
void RevealAppShim(const AppId& app_id) override;
private:
void OnDataWritten(InstallFinalizedCallback callback,
std::unique_ptr<WebApp> web_app,
bool success);
WebAppRegistrar* registrar_;
WebAppIconManager* icon_manager_;
base::WeakPtrFactory<WebAppInstallFinalizer> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(WebAppInstallFinalizer);
};
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_INSTALL_FINALIZER_H_