| 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 <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "extensions/common/constants.h" | 12 #include "extensions/common/constants.h" |
| 12 | 13 |
| 13 class GURL; | 14 class GURL; |
| 14 class Profile; | 15 class Profile; |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class CommandLine; | 18 class CommandLine; |
| 18 class FilePath; | 19 class FilePath; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace extensions { | 22 namespace extensions { |
| 22 class Extension; | 23 class Extension; |
| 24 namespace api { |
| 25 namespace app_runtime { |
| 26 struct ActionData; |
| 27 } |
| 28 } |
| 23 } | 29 } |
| 24 | 30 |
| 25 namespace apps { | 31 namespace apps { |
| 26 | 32 |
| 27 // Launches the platform app |extension|. Creates appropriate launch data for | 33 // Launches the platform app |app|. Creates appropriate launch data for the |
| 28 // the |command_line| fields present. |extension| and |profile| must not be | 34 // |command_line| fields present. |app| and |profile| must not be NULL. An empty |
| 29 // NULL. An empty |command_line| means there is no launch data. If non-empty, | 35 // |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. | 36 // |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. | 37 // |source| is one of the enumerated values which trace how the app is launched. |
| 32 void LaunchPlatformAppWithCommandLine(Profile* profile, | 38 void LaunchPlatformAppWithCommandLine(Profile* profile, |
| 33 const extensions::Extension* extension, | 39 const extensions::Extension* app, |
| 34 const base::CommandLine& command_line, | 40 const base::CommandLine& command_line, |
| 35 const base::FilePath& current_directory, | 41 const base::FilePath& current_directory, |
| 36 extensions::AppLaunchSource source); | 42 extensions::AppLaunchSource source); |
| 37 | 43 |
| 38 // Launches the platform app |extension| by issuing an onLaunched event | 44 // Launches the platform app |app| by issuing an onLaunched event with the |
| 39 // with the contents of |file_path| available through the launch data. | 45 // contents of |file_path| available through the launch data. |
| 40 void LaunchPlatformAppWithPath(Profile* profile, | 46 void LaunchPlatformAppWithPath(Profile* profile, |
| 41 const extensions::Extension* extension, | 47 const extensions::Extension* app, |
| 42 const base::FilePath& file_path); | 48 const base::FilePath& file_path); |
| 43 | 49 |
| 44 // Launches the platform app |extension|. |source| tells us how the app is | 50 // Launches the platform app |app| with the specific |action_data|. |file_path| |
| 45 // launched. | 51 // is an optional argument and if present contains the file that the app should |
| 52 // open w.r.t. the given action. |
| 53 void 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. |
| 46 void LaunchPlatformApp(Profile* profile, | 60 void LaunchPlatformApp(Profile* profile, |
| 47 const extensions::Extension* extension, | 61 const extensions::Extension* app, |
| 48 extensions::AppLaunchSource source); | 62 extensions::AppLaunchSource source); |
| 49 | 63 |
| 50 // Launches the platform app |extension| with |handler_id| and the contents of | 64 // Launches the platform app |app| with |handler_id| and the contents of |
| 51 // |file_paths| available through the launch data. |handler_id| corresponds to | 65 // |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 | 66 // the id of the file_handlers item in the manifest that resulted in a match |
| 53 // that triggered this launch. | 67 // that triggered this launch. |
| 54 void LaunchPlatformAppWithFileHandler( | 68 void LaunchPlatformAppWithFileHandler( |
| 55 Profile* profile, | 69 Profile* profile, |
| 56 const extensions::Extension* extension, | 70 const extensions::Extension* app, |
| 57 const std::string& handler_id, | 71 const std::string& handler_id, |
| 58 const std::vector<base::FilePath>& file_paths); | 72 const std::vector<base::FilePath>& file_paths); |
| 59 | 73 |
| 60 // Launches the platform app |extension| with |handler_id|, |url| and | 74 // Launches the platform app |app| with |handler_id|, |url| and |referrer_url| |
| 61 // |referrer_url| available through the launch data. |handler_id| corresponds to | 75 // available through the launch data. |handler_id| corresponds to the id of the |
| 62 // the id of the file_handlers item in the manifest that resulted in a match | 76 // file_handlers item in the manifest that resulted in a match that triggered |
| 63 // that triggered this launch. | 77 // this launch. |
| 64 void LaunchPlatformAppWithUrl(Profile* profile, | 78 void LaunchPlatformAppWithUrl(Profile* profile, |
| 65 const extensions::Extension* extension, | 79 const extensions::Extension* app, |
| 66 const std::string& handler_id, | 80 const std::string& handler_id, |
| 67 const GURL& url, | 81 const GURL& url, |
| 68 const GURL& referrer_url); | 82 const GURL& referrer_url); |
| 69 | 83 |
| 70 void RestartPlatformApp(Profile* profile, | 84 void RestartPlatformApp(Profile* profile, const extensions::Extension* app); |
| 71 const extensions::Extension* extension); | |
| 72 | 85 |
| 73 } // namespace apps | 86 } // namespace apps |
| 74 | 87 |
| 75 #endif // APPS_LAUNCHER_H_ | 88 #endif // APPS_LAUNCHER_H_ |
| OLD | NEW |