chromium/chrome/browser/apps/app_service/browser_app_launcher.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/apps/app_service/browser_app_launcher.h"

#include <memory>
#include <utility>

#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/extensions/app_launch_params.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_util.h"
#include "extensions/common/extension.h"
#include "url/gurl.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/apps/app_service/launch_utils.h"
#include "chrome/browser/apps/app_service/metrics/app_platform_metrics.h"
#include "chrome/browser/ash/app_list/arc/arc_app_utils.h"
#include "components/app_restore/app_launch_info.h"
#include "components/app_restore/full_restore_save_handler.h"
#include "components/app_restore/full_restore_utils.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/intent.h"
#include "components/sessions/core/session_id.h"
#endif

namespace {

void OnLaunchCompleteReportRestoreMetrics(
    base::OnceCallback<void(content::WebContents*)> callback,
    Profile* profile,
    int restore_id,
    apps::AppLaunchParams params_for_restore,
    base::WeakPtr<Browser> browser,
    base::WeakPtr<content::WebContents> web_contents,
    apps::LaunchContainer launch_container) {}

void LaunchAppWithParamsImpl(
    apps::AppLaunchParams params,
    Profile* profile,
    base::OnceCallback<void(content::WebContents*)> on_complete) {}
}  // namespace

namespace apps {

BrowserAppLauncher::BrowserAppLauncher(Profile* profile) :{}

BrowserAppLauncher::~BrowserAppLauncher() = default;

#if !BUILDFLAG(IS_CHROMEOS)
void BrowserAppLauncher::LaunchAppWithParams(
    AppLaunchParams params,
    base::OnceCallback<void(content::WebContents*)> callback) {}
#endif  // !BUILDFLAG(IS_CHROMEOS)

content::WebContents* BrowserAppLauncher::LaunchAppWithParamsForTesting(
    AppLaunchParams params) {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
void BrowserAppLauncher::LaunchPlayStoreWithExtensions() {
  const extensions::Extension* extension =
      extensions::ExtensionRegistry::Get(profile_)->GetInstalledExtension(
          arc::kPlayStoreAppId);
  DCHECK(extension);
  DCHECK(extensions::util::IsAppLaunchable(arc::kPlayStoreAppId, profile_));
  LaunchAppWithParamsImpl(
      CreateAppLaunchParamsUserContainer(
          profile_, extension, WindowOpenDisposition::NEW_WINDOW,
          apps::LaunchSource::kFromChromeInternal),
      profile_, base::DoNothing());
}
#endif

}  // namespace apps