blob: 3a23411fca97afa3ad3e99813bef30b599c9937c [file] [log] [blame]
[email protected]24c81d692013-08-07 14:09:481// Copyright 2013 The Chromium Authors. All rights reserved.
[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
cylee988a9bb52014-11-04 16:39:1612#include "extensions/common/constants.h"
13
[email protected]43197ea22013-09-10 15:31:5614class GURL;
[email protected]12e540452012-05-26 07:09:3615class Profile;
16
[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
[email protected]24c81d692013-08-07 14:09:4822namespace extensions {
23class Extension;
jdufault9d3e955f2016-08-16 22:19:1124namespace api {
25namespace app_runtime {
26struct ActionData;
27}
28}
[email protected]4e04f1e2012-06-20 03:20:3129}
30
[email protected]24c81d692013-08-07 14:09:4831namespace apps {
[email protected]12e540452012-05-26 07:09:3632
jdufault9d3e955f2016-08-16 22:19:1133// Launches the platform app |app|. Creates appropriate launch data for the
34// |command_line| fields present. |app| and |profile| must not be NULL. An empty
35// |command_line| means there is no launch data. If non-empty,
[email protected]a5a0be02012-07-18 05:51:5436// |current_directory| is used to expand any relative paths on the command line.
cylee988a9bb52014-11-04 16:39:1637// |source| is one of the enumerated values which trace how the app is launched.
[email protected]2a69b942013-05-31 09:37:5338void LaunchPlatformAppWithCommandLine(Profile* profile,
jdufault9d3e955f2016-08-16 22:19:1139 const extensions::Extension* app,
[email protected]2f3b1cc2014-03-17 23:07:1540 const base::CommandLine& command_line,
cylee988a9bb52014-11-04 16:39:1641 const base::FilePath& current_directory,
42 extensions::AppLaunchSource source);
[email protected]12e540452012-05-26 07:09:3643
jdufault9d3e955f2016-08-16 22:19:1144// Launches the platform app |app| by issuing an onLaunched event with the
45// contents of |file_path| available through the launch data.
[email protected]a228c842012-09-04 10:07:0546void LaunchPlatformAppWithPath(Profile* profile,
jdufault9d3e955f2016-08-16 22:19:1147 const extensions::Extension* app,
[email protected]a3ef4832013-02-02 05:12:3348 const base::FilePath& file_path);
[email protected]a228c842012-09-04 10:07:0549
jdufault9d3e955f2016-08-16 22:19:1150// Launches the platform app |app| with the specific |action_data|. |file_path|
51// is an optional argument and if present contains the file that the app should
52// open w.r.t. the given action.
53void LaunchPlatformAppWithAction(
54 Profile* profile,
55 const extensions::Extension* app,
56 std::unique_ptr<extensions::api::app_runtime::ActionData> action_data,
57 const base::FilePath& file_path);
58
59// Launches the platform app |app|. |source| tells us how the app is launched.
[email protected]24c81d692013-08-07 14:09:4860void LaunchPlatformApp(Profile* profile,
jdufault9d3e955f2016-08-16 22:19:1161 const extensions::Extension* app,
cylee988a9bb52014-11-04 16:39:1662 extensions::AppLaunchSource source);
[email protected]2a69b942013-05-31 09:37:5363
jdufault9d3e955f2016-08-16 22:19:1164// Launches the platform app |app| with |handler_id| and the contents of
[email protected]3113a232014-06-04 09:40:2965// |file_paths| available through the launch data. |handler_id| corresponds to
[email protected]43197ea22013-09-10 15:31:5666// the id of the file_handlers item in the manifest that resulted in a match
67// that triggered this launch.
[email protected]3113a232014-06-04 09:40:2968void LaunchPlatformAppWithFileHandler(
69 Profile* profile,
jdufault9d3e955f2016-08-16 22:19:1170 const extensions::Extension* app,
[email protected]3113a232014-06-04 09:40:2971 const std::string& handler_id,
72 const std::vector<base::FilePath>& file_paths);
[email protected]af8dc08e2012-11-22 01:58:4273
jdufault9d3e955f2016-08-16 22:19:1174// Launches the platform app |app| with |handler_id|, |url| and |referrer_url|
75// available through the launch data. |handler_id| corresponds to the id of the
76// file_handlers item in the manifest that resulted in a match that triggered
77// this launch.
[email protected]43197ea22013-09-10 15:31:5678void LaunchPlatformAppWithUrl(Profile* profile,
jdufault9d3e955f2016-08-16 22:19:1179 const extensions::Extension* app,
[email protected]43197ea22013-09-10 15:31:5680 const std::string& handler_id,
81 const GURL& url,
82 const GURL& referrer_url);
83
jdufault9d3e955f2016-08-16 22:19:1184void RestartPlatformApp(Profile* profile, const extensions::Extension* app);
[email protected]fc2a40f2013-03-13 13:14:5785
[email protected]24c81d692013-08-07 14:09:4886} // namespace apps
[email protected]12e540452012-05-26 07:09:3687
[email protected]24c81d692013-08-07 14:09:4888#endif // APPS_LAUNCHER_H_