chromium/chrome/browser/web_applications/commands/navigate_and_trigger_install_dialog_command.h

// Copyright 2023 The Chromium Authors
// 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_COMMANDS_NAVIGATE_AND_TRIGGER_INSTALL_DIALOG_COMMAND_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_NAVIGATE_AND_TRIGGER_INSTALL_DIALOG_COMMAND_H_

#include <memory>

#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "chrome/browser/web_applications/commands/web_app_command.h"
#include "chrome/browser/web_applications/locks/noop_lock.h"
#include "components/webapps/browser/installable/installable_logging.h"
#include "components/webapps/common/web_app_id.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom-forward.h"
#include "url/gurl.h"

class Profile;

namespace content {
class WebContents;
}

namespace webapps {
class WebAppUrlLoader;
enum class WebAppUrlLoaderResult;
}  // namespace webapps

namespace web_app {

class AppLock;
class WebAppDataRetriever;
class WebAppUiManager;

enum class NavigateAndTriggerInstallDialogCommandResult {};

// The navigation will always succeed. The `result` indicates whether the
// command was able to trigger the install dialog.
NavigateAndTriggerInstallDialogCommandCallback;

// This command navigates to the specified install url and waits for the web app
// manifest to load. If there is an installable web app that the user has not
// installed, the command will automatically trigger the install dialog.
class NavigateAndTriggerInstallDialogCommand
    : public WebAppCommand<NoopLock,
                           NavigateAndTriggerInstallDialogCommandResult> {};

}  // namespace web_app

#endif  // CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_NAVIGATE_AND_TRIGGER_INSTALL_DIALOG_COMMAND_H_