diff --git a/apps/DEPS b/apps/DEPS index 77d24b5933b3e0..8d827715530cad 100644 --- a/apps/DEPS +++ b/apps/DEPS @@ -5,6 +5,8 @@ include_rules = [ "+components/keyed_service", "+components/user_manager", "+extensions", + # app_shell may depend on apps, but not vice versa. + "-extensions/shell", "+net/base", ] diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn index 31e941770c490d..b25f58b4d7f29b 100644 --- a/extensions/shell/BUILD.gn +++ b/extensions/shell/BUILD.gn @@ -32,6 +32,7 @@ source_set("app_shell_lib") { deps = [ ":resources", ":version_header", + "//apps", "//base", "//components/guest_view/browser", "//components/guest_view/common", diff --git a/extensions/shell/DEPS b/extensions/shell/DEPS index eeb99ae5d8c730..b8070248d7c54b 100644 --- a/extensions/shell/DEPS +++ b/extensions/shell/DEPS @@ -1,7 +1,4 @@ include_rules = [ - # The apps module has dependencies on chrome. - "-apps", - # Individual subdirectories should have their own DEPS that include # their allowed directories. "-extensions/shell", diff --git a/extensions/shell/browser/DEPS b/extensions/shell/browser/DEPS index e834fe113bd83c..274f5f61769e10 100644 --- a/extensions/shell/browser/DEPS +++ b/extensions/shell/browser/DEPS @@ -1,4 +1,5 @@ include_rules = [ + "+apps", "+chromeos", "+components/keyed_service", "+components/nacl/browser", diff --git a/extensions/shell/browser/default_shell_browser_main_delegate.cc b/extensions/shell/browser/default_shell_browser_main_delegate.cc index c73a35f9a32ec8..74a5473756ea4a 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( + 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";