Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / 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 <string>
9 #include <vector>
10
11 #include "extensions/common/constants.h"
12
13 class GURL;
14 class Profile;
15
16 namespace base {
17 class CommandLine;
18 class FilePath;
19 }
20
21 namespace extensions {
22 class Extension;
23 }
24
25 namespace apps {
26
27 // Launches the platform app |extension|. Creates appropriate launch data for
28 // the |command_line| fields present. |extension| and |profile| must not be
29 // NULL. An empty |command_line| means there is no launch data. If non-empty,
30 // |current_directory| is used to expand any relative paths on the command line.
31 // |source| is one of the enumerated values which trace how the app is launched.
32 void LaunchPlatformAppWithCommandLine(Profile* profile,
33                                       const extensions::Extension* extension,
34                                       const base::CommandLine& command_line,
35                                       const base::FilePath& current_directory,
36                                       extensions::AppLaunchSource source);
37
38 // Launches the platform app |extension| by issuing an onLaunched event
39 // with the contents of |file_path| available through the launch data.
40 void LaunchPlatformAppWithPath(Profile* profile,
41                                const extensions::Extension* extension,
42                                const base::FilePath& file_path);
43
44 // Launches the platform app |extension|. |source| tells us how the app is
45 // launched.
46 void LaunchPlatformApp(Profile* profile,
47                        const extensions::Extension* extension,
48                        extensions::AppLaunchSource source);
49
50 // Launches the platform app |extension| with |handler_id| and the contents of
51 // |file_paths| available through the launch data. |handler_id| corresponds to
52 // the id of the file_handlers item in the manifest that resulted in a match
53 // that triggered this launch.
54 void LaunchPlatformAppWithFileHandler(
55     Profile* profile,
56     const extensions::Extension* extension,
57     const std::string& handler_id,
58     const std::vector<base::FilePath>& file_paths);
59
60 // Launches the platform app |extension| with |handler_id|, |url| and
61 // |referrer_url| available through the launch data. |handler_id| corresponds to
62 // the id of the file_handlers item in the manifest that resulted in a match
63 // that triggered this launch.
64 void LaunchPlatformAppWithUrl(Profile* profile,
65                               const extensions::Extension* extension,
66                               const std::string& handler_id,
67                               const GURL& url,
68                               const GURL& referrer_url);
69
70 void RestartPlatformApp(Profile* profile,
71                         const extensions::Extension* extension);
72
73 }  // namespace apps
74
75 #endif  // APPS_LAUNCHER_H_