blob: c25cb6ddca8e41c652bc9c9812873b33c409e6af [file] [log] [blame]
Avi Drissmanda6cecbc2022-09-07 18:10:301// Copyright 2013 The Chromium Authors
[email protected]12e540452012-05-26 07:09:362// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]24c81d692013-08-07 14:09:485#ifndef APPS_LAUNCHER_H_
6#define APPS_LAUNCHER_H_
[email protected]12e540452012-05-26 07:09:367
jdufault9d3e955f2016-08-16 22:19:118#include <memory>
[email protected]af8dc08e2012-11-22 01:58:429#include <string>
[email protected]3113a232014-06-04 09:40:2910#include <vector>
[email protected]af8dc08e2012-11-22 01:58:4211
rkc79bf63c2016-08-25 21:07:2312#include "extensions/common/api/app_runtime.h"
cylee988a9bb52014-11-04 16:39:1613#include "extensions/common/constants.h"
14
[email protected]43197ea22013-09-10 15:31:5615class GURL;
[email protected]12e540452012-05-26 07:09:3616
[email protected]a3ef4832013-02-02 05:12:3317namespace base {
[email protected]2f3b1cc2014-03-17 23:07:1518class CommandLine;
[email protected]a3ef4832013-02-02 05:12:3319class FilePath;
20}
21
michaelpg4d80e562017-04-04 01:48:1422namespace content {
23class BrowserContext;
24}
25
[email protected]24c81d692013-08-07 14:09:4826namespace extensions {
27class Extension;
jdufault9d3e955f2016-08-16 22:19:1128namespace api {
29namespace app_runtime {
30struct ActionData;
31}
32}
[email protected]4e04f1e2012-06-20 03:20:3133}
34
[email protected]24c81d692013-08-07 14:09:4835namespace apps {
[email protected]12e540452012-05-26 07:09:3636
jdufault9d3e955f2016-08-16 22:19:1137// Launches the platform app |app|. Creates appropriate launch data for the
michaelpg4d80e562017-04-04 01:48:1438// |command_line| fields present. |app| and |context| must not be NULL. An empty
jdufault9d3e955f2016-08-16 22:19:1139// |command_line| means there is no launch data. If non-empty,
[email protected]a5a0be02012-07-18 05:51:5440// |current_directory| is used to expand any relative paths on the command line.
cylee988a9bb52014-11-04 16:39:1641// |source| is one of the enumerated values which trace how the app is launched.
Eric Willigers24c32282019-06-11 05:59:1442void LaunchPlatformAppWithCommandLine(content::BrowserContext* context,
43 const extensions::Extension* app,
44 const base::CommandLine& command_line,
45 const base::FilePath& current_directory,
46 extensions::AppLaunchSource source);
[email protected]12e540452012-05-26 07:09:3647
andra.paraschiv4e4fb8bb2016-12-15 11:13:5448// As above but includes |launch_id|, an id that can be passed to
49// an app when launched in order to support multiple shelf items per app.
50void LaunchPlatformAppWithCommandLineAndLaunchId(
michaelpg4d80e562017-04-04 01:48:1451 content::BrowserContext* context,
andra.paraschiv4e4fb8bb2016-12-15 11:13:5452 const extensions::Extension* app,
53 const std::string& launch_id,
54 const base::CommandLine& command_line,
55 const base::FilePath& current_directory,
Eric Willigers24c32282019-06-11 05:59:1456 extensions::AppLaunchSource source);
andra.paraschiv4e4fb8bb2016-12-15 11:13:5457
jdufault9d3e955f2016-08-16 22:19:1158// Launches the platform app |app| by issuing an onLaunched event with the
59// contents of |file_path| available through the launch data.
michaelpg4d80e562017-04-04 01:48:1460void LaunchPlatformAppWithPath(content::BrowserContext* context,
jdufault9d3e955f2016-08-16 22:19:1161 const extensions::Extension* app,
[email protected]a3ef4832013-02-02 05:12:3362 const base::FilePath& file_path);
[email protected]a228c842012-09-04 10:07:0563
nancylingwangd282a5a2020-09-10 07:09:1364// Launches the platform app |app| by issuing an onLaunched event with the
65// contents of |file_paths| available through the launch data.
66void LaunchPlatformAppWithFilePaths(
67 content::BrowserContext* context,
68 const extensions::Extension* app,
69 const std::vector<base::FilePath>& file_paths);
70
Timothy Lohd570e8a2022-03-07 02:23:0071// Launches the platform app |app| with the specific |action_data|.
jdufault9d3e955f2016-08-16 22:19:1172void LaunchPlatformAppWithAction(
michaelpg4d80e562017-04-04 01:48:1473 content::BrowserContext* context,
jdufault9d3e955f2016-08-16 22:19:1174 const extensions::Extension* app,
Claudio DeSouza5b653ce2022-09-07 04:48:2675 extensions::api::app_runtime::ActionData action_data);
jdufault9d3e955f2016-08-16 22:19:1176
77// Launches the platform app |app|. |source| tells us how the app is launched.
michaelpg4d80e562017-04-04 01:48:1478void LaunchPlatformApp(content::BrowserContext* context,
jdufault9d3e955f2016-08-16 22:19:1179 const extensions::Extension* app,
cylee988a9bb52014-11-04 16:39:1680 extensions::AppLaunchSource source);
[email protected]2a69b942013-05-31 09:37:5381
jdufault9d3e955f2016-08-16 22:19:1182// Launches the platform app |app| with |handler_id| and the contents of
[email protected]3113a232014-06-04 09:40:2983// |file_paths| available through the launch data. |handler_id| corresponds to
[email protected]43197ea22013-09-10 15:31:5684// the id of the file_handlers item in the manifest that resulted in a match
85// that triggered this launch.
[email protected]3113a232014-06-04 09:40:2986void LaunchPlatformAppWithFileHandler(
michaelpg4d80e562017-04-04 01:48:1487 content::BrowserContext* context,
jdufault9d3e955f2016-08-16 22:19:1188 const extensions::Extension* app,
[email protected]3113a232014-06-04 09:40:2989 const std::string& handler_id,
90 const std::vector<base::FilePath>& file_paths);
[email protected]af8dc08e2012-11-22 01:58:4291
jdufault9d3e955f2016-08-16 22:19:1192// Launches the platform app |app| with |handler_id|, |url| and |referrer_url|
93// available through the launch data. |handler_id| corresponds to the id of the
94// file_handlers item in the manifest that resulted in a match that triggered
95// this launch.
michaelpg4d80e562017-04-04 01:48:1496void LaunchPlatformAppWithUrl(content::BrowserContext* context,
jdufault9d3e955f2016-08-16 22:19:1197 const extensions::Extension* app,
[email protected]43197ea22013-09-10 15:31:5698 const std::string& handler_id,
99 const GURL& url,
100 const GURL& referrer_url);
101
michaelpg4d80e562017-04-04 01:48:14102void RestartPlatformApp(content::BrowserContext* context,
103 const extensions::Extension* app);
[email protected]fc2a40f2013-03-13 13:14:57104
[email protected]24c81d692013-08-07 14:09:48105} // namespace apps
[email protected]12e540452012-05-26 07:09:36106
[email protected]24c81d692013-08-07 14:09:48107#endif // APPS_LAUNCHER_H_