Chromium Code Reviews| Index: extensions/shell/browser/default_shell_browser_main_delegate.cc |
| diff --git a/extensions/shell/browser/default_shell_browser_main_delegate.cc b/extensions/shell/browser/default_shell_browser_main_delegate.cc |
| index c73a35f9a32ec88318951cca6826cc892bc1f66a..74a5473756ea4a453834ff2fc0ec751a318e294c 100644 |
| --- a/extensions/shell/browser/default_shell_browser_main_delegate.cc |
| +++ b/extensions/shell/browser/default_shell_browser_main_delegate.cc |
| @@ -4,9 +4,11 @@ |
| #include "extensions/shell/browser/default_shell_browser_main_delegate.h" |
| +#include "apps/launcher.h" |
| #include "base/command_line.h" |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| +#include "base/path_service.h" |
| #include "base/strings/string_tokenizer.h" |
| #include "build/build_config.h" |
| #include "extensions/common/switches.h" |
| @@ -43,22 +45,25 @@ void DefaultShellBrowserMainDelegate::Start( |
| base::CommandLine::StringType::const_iterator> |
| tokenizer(path_list, FILE_PATH_LITERAL(",")); |
| - std::string launch_id; |
| + const Extension* launch_app = nullptr; |
| while (tokenizer.GetNext()) { |
| base::FilePath app_absolute_dir = |
| base::MakeAbsoluteFilePath(base::FilePath(tokenizer.token())); |
| const Extension* extension = extension_system->LoadApp(app_absolute_dir); |
| - if (!extension) |
| - continue; |
| - if (launch_id.empty()) |
| - launch_id = extension->id(); |
| + if (extension && !launch_app) |
| + launch_app = extension; |
| } |
| - if (!launch_id.empty()) |
| - extension_system->LaunchApp(launch_id); |
| - else |
| + if (launch_app) { |
| + base::FilePath current_directory; |
| + base::PathService::Get(base::DIR_CURRENT, ¤t_directory); |
| + apps::LaunchPlatformAppWithCommandLineAndLaunchId( |
|
rkc
2017/05/02 23:49:34
Out of curiousity, what's the difference between S
michaelpg
2017/05/05 21:01:40
^ being able to provide the extra parameters. The
rkc
2017/05/05 21:05:20
Ah - can we just delete it then?
|
| + browser_context, launch_app, launch_app->id(), *command_line, |
| + current_directory, SOURCE_COMMAND_LINE); |
| + } else { |
| LOG(ERROR) << "Could not load any apps."; |
| + } |
| } else { |
| LOG(ERROR) << "--" << switches::kLoadApps |
| << " unset; boredom is in your future"; |