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