1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef APPS_LAUNCHER_H_
6 #define APPS_LAUNCHER_H_
12 #include "extensions/common/api/app_runtime.h"
13 #include "extensions/common/constants.h"
26 namespace extensions {
29 namespace app_runtime {
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(content::BrowserContext* context,
43 const extensions::Extension* app,
44 const base::CommandLine& command_line,
45 const base::FilePath& current_directory,
46 extensions::AppLaunchSource source);
48 // 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.
50 void LaunchPlatformAppWithCommandLineAndLaunchId(
51 content::BrowserContext* context,
52 const extensions::Extension* app,
53 const std::string& launch_id,
54 const base::CommandLine& command_line,
55 const base::FilePath& current_directory,
56 extensions::AppLaunchSource source);
58 // Launches the platform app |app| by issuing an onLaunched event with the
59 // contents of |file_path| available through the launch data.
60 void LaunchPlatformAppWithPath(content::BrowserContext* context,
61 const extensions::Extension* app,
62 const base::FilePath& file_path);
64 // Launches the platform app |app| by issuing an onLaunched event with the
65 // contents of |file_paths| available through the launch data.
66 void LaunchPlatformAppWithFilePaths(
67 content::BrowserContext* context,
68 const extensions::Extension* app,
69 const std::vector<base::FilePath>& file_paths);
71 // Launches the platform app |app| with the specific |action_data|.
72 void LaunchPlatformAppWithAction(
73 content::BrowserContext* context,
74 const extensions::Extension* app,
75 extensions::api::app_runtime::ActionData action_data);
77 // Launches the platform app |app|. |source| tells us how the app is launched.
78 void LaunchPlatformApp(content::BrowserContext* context,
79 const extensions::Extension* app,
80 extensions::AppLaunchSource source);
82 // Launches the platform app |app| with |handler_id| and the contents of
83 // |file_paths| available through the launch data. |handler_id| corresponds to
84 // the id of the file_handlers item in the manifest that resulted in a match
85 // that triggered this launch.
86 void LaunchPlatformAppWithFileHandler(
87 content::BrowserContext* context,
88 const extensions::Extension* app,
89 const std::string& handler_id,
90 const std::vector<base::FilePath>& file_paths);
92 // 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
96 void LaunchPlatformAppWithUrl(content::BrowserContext* context,
97 const extensions::Extension* app,
98 const std::string& handler_id,
100 const GURL& referrer_url);
102 void RestartPlatformApp(content::BrowserContext* context,
103 const extensions::Extension* app);
107 #endif // APPS_LAUNCHER_H_