#include "apps/launcher.h"
#include <memory>
#include <set>
#include <utility>
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/services/app_service/public/cpp/file_handler_info.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/api/app_runtime/app_runtime_api.h"
#include "extensions/browser/api/file_handlers/app_file_handler_util.h"
#include "extensions/browser/api/file_handlers/directory_util.h"
#include "extensions/browser/api/file_handlers/mime_util.h"
#include "extensions/browser/entry_info.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/granted_file_entry.h"
#include "extensions/browser/lazy_context_id.h"
#include "extensions/browser/lazy_context_task_queue.h"
#include "extensions/browser/process_manager.h"
#include "extensions/common/api/app_runtime.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest_handlers/kiosk_mode_info.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permissions_data.h"
#include "net/base/filename_util.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/app_restore/app_launch_info.h"
#include "components/app_restore/full_restore_utils.h"
#include "components/user_manager/user_manager.h"
#endif
app_runtime;
BrowserThread;
AppRuntimeEventRouter;
EventRouter;
Extension;
ExtensionHost;
GrantedFileEntry;
CreateEntryInfos;
CreateFileEntry;
FileHandlerCanHandleEntry;
FileHandlerForId;
HasFileSystemWritePermission;
PrepareFilesForWritableApp;
namespace apps {
namespace {
bool DoMakePathAbsolute(const base::FilePath& current_directory,
base::FilePath* file_path) { … }
class PlatformAppPathLauncher
: public base::RefCountedThreadSafe<PlatformAppPathLauncher> { … };
}
void LaunchPlatformAppWithCommandLine(content::BrowserContext* context,
const extensions::Extension* app,
const base::CommandLine& command_line,
const base::FilePath& current_directory,
extensions::AppLaunchSource source) { … }
void LaunchPlatformAppWithCommandLineAndLaunchId(
content::BrowserContext* context,
const extensions::Extension* app,
const std::string& launch_id,
const base::CommandLine& command_line,
const base::FilePath& current_directory,
extensions::AppLaunchSource source) { … }
void LaunchPlatformAppWithPath(content::BrowserContext* context,
const Extension* app,
const base::FilePath& file_path) { … }
void LaunchPlatformAppWithFilePaths(
content::BrowserContext* context,
const extensions::Extension* app,
const std::vector<base::FilePath>& file_paths) { … }
void LaunchPlatformAppWithAction(content::BrowserContext* context,
const extensions::Extension* app,
app_runtime::ActionData action_data) { … }
void LaunchPlatformApp(content::BrowserContext* context,
const Extension* app,
extensions::AppLaunchSource source) { … }
void LaunchPlatformAppWithFileHandler(
content::BrowserContext* context,
const Extension* app,
const std::string& handler_id,
const std::vector<base::FilePath>& entry_paths) { … }
void RestartPlatformApp(content::BrowserContext* context,
const Extension* app) { … }
void LaunchPlatformAppWithUrl(content::BrowserContext* context,
const Extension* app,
const std::string& handler_id,
const GURL& url,
const GURL& referrer_url) { … }
}