Revert of AppShell: pass command-line files to app as launch data (patchset #3 id:40001 of https://codereview.chromium.org/2824553002/ )
Reason for revert:
TBR was insufficient for commit
Original issue's description:
> AppShell: pass command-line files to app as launch data
>
> An app that registers file handlers can be passed filenames on the
> command line to use those files.
>
> BUG=679870
> TBR=benwells@chromium.org # DEPS
>
> Review-Url: https://codereview.chromium.org/2824553002
> Cr-Commit-Position: refs/heads/master@{#469827}
> Committed: https://chromium.googlesource.com/chromium/src/+/b7b29db1011a7b8e0e8816449e2209305402a46a
TBR=rkc@chromium.org,benwells@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=679870
Review-Url: https://codereview.chromium.org/2864603007
Cr-Commit-Position: refs/heads/master@{#469893}
diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn
index b25f58b..31e9417 100644
--- a/extensions/shell/BUILD.gn
+++ b/extensions/shell/BUILD.gn
@@ -32,7 +32,6 @@
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 b807024..eeb99ae5 100644
--- a/extensions/shell/DEPS
+++ b/extensions/shell/DEPS
@@ -1,4 +1,7 @@
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 274f5f61..e834fe1 100644
--- a/extensions/shell/browser/DEPS
+++ b/extensions/shell/browser/DEPS
@@ -1,5 +1,4 @@
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 74a5473..c73a35f9 100644
--- a/extensions/shell/browser/default_shell_browser_main_delegate.cc
+++ b/extensions/shell/browser/default_shell_browser_main_delegate.cc
@@ -4,11 +4,9 @@
#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"
@@ -45,25 +43,22 @@
base::CommandLine::StringType::const_iterator>
tokenizer(path_list, FILE_PATH_LITERAL(","));
- const Extension* launch_app = nullptr;
+ std::string launch_id;
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 && !launch_app)
- launch_app = extension;
+ if (!extension)
+ continue;
+ if (launch_id.empty())
+ launch_id = extension->id();
}
- 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 {
+ if (!launch_id.empty())
+ extension_system->LaunchApp(launch_id);
+ else
LOG(ERROR) << "Could not load any apps.";
- }
} else {
LOG(ERROR) << "--" << switches::kLoadApps
<< " unset; boredom is in your future";