Upload upstream chromium 76.0.3809.146
[platform/framework/web/chromium-efl.git] / apps / launcher.h
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef APPS_LAUNCHER_H_
6 #define APPS_LAUNCHER_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "extensions/common/api/app_runtime.h"
13 #include "extensions/common/constants.h"
14
15 class GURL;
16
17 namespace base {
18 class CommandLine;
19 class FilePath;
20 }
21
22 namespace content {
23 class BrowserContext;
24 }
25
26 namespace extensions {
27 class Extension;
28 namespace api {
29 namespace app_runtime {
30 struct ActionData;
31 }
32 }
33 }
34
35 namespace apps {
36
37 // Launches the platform app |app|. Creates appropriate launch data for the
38 // |command_line| fields present. |app| and |context| must not be NULL. An empty
39 // |command_line| means there is no launch data. If non-empty,
40 // |current_directory| is used to expand any relative paths on the command line.
41 // |source| is one of the enumerated values which trace how the app is launched.
42 void LaunchPlatformAppWithCommandLine(
43     content::BrowserContext* context,
44     const extensions::Extension* app,
45     const base::CommandLine& command_line,
46     const base::FilePath& current_directory,
47     extensions::AppLaunchSource source,
48     extensions::api::app_runtime::PlayStoreStatus play_store_status =
49         extensions::api::app_runtime::PlayStoreStatus::
50             PLAY_STORE_STATUS_UNKNOWN);
51
52 // As above but includes |launch_id|, an id that can be passed to
53 // an app when launched in order to support multiple shelf items per app.
54 void LaunchPlatformAppWithCommandLineAndLaunchId(
55     content::BrowserContext* context,
56     const extensions::Extension* app,
57     const std::string& launch_id,
58     const base::CommandLine& command_line,
59     const base::FilePath& current_directory,
60     extensions::AppLaunchSource source,
61     extensions::api::app_runtime::PlayStoreStatus play_store_status =
62         extensions::api::app_runtime::PlayStoreStatus::
63             PLAY_STORE_STATUS_UNKNOWN);
64
65 // Launches the platform app |app| by issuing an onLaunched event with the
66 // contents of |file_path| available through the launch data.
67 void LaunchPlatformAppWithPath(content::BrowserContext* context,
68                                const extensions::Extension* app,
69                                const base::FilePath& file_path);
70
71 // Launches the platform app |app| with the specific |action_data|. |file_path|
72 // is an optional argument and if present contains the file that the app should
73 // open w.r.t. the given action.
74 void LaunchPlatformAppWithAction(
75     content::BrowserContext* context,
76     const extensions::Extension* app,
77     std::unique_ptr<extensions::api::app_runtime::ActionData> action_data,
78     const base::FilePath& file_path);
79
80 // Launches the platform app |app|. |source| tells us how the app is launched.
81 void LaunchPlatformApp(content::BrowserContext* context,
82                        const extensions::Extension* app,
83                        extensions::AppLaunchSource source);
84
85 // Launches the platform app |app| with |handler_id| and the contents of
86 // |file_paths| available through the launch data. |handler_id| corresponds to
87 // the id of the file_handlers item in the manifest that resulted in a match
88 // that triggered this launch.
89 void LaunchPlatformAppWithFileHandler(
90     content::BrowserContext* context,
91     const extensions::Extension* app,
92     const std::string& handler_id,
93     const std::vector<base::FilePath>& file_paths);
94
95 // Launches the platform app |app| with |handler_id|, |url| and |referrer_url|
96 // available through the launch data. |handler_id| corresponds to the id of the
97 // file_handlers item in the manifest that resulted in a match that triggered
98 // this launch.
99 void LaunchPlatformAppWithUrl(content::BrowserContext* context,
100                               const extensions::Extension* app,
101                               const std::string& handler_id,
102                               const GURL& url,
103                               const GURL& referrer_url);
104
105 void RestartPlatformApp(content::BrowserContext* context,
106                         const extensions::Extension* app);
107
108 }  // namespace apps
109
110 #endif  // APPS_LAUNCHER_H_