Adds ability for chrome to behave as mojo_runner

This adds the arg use_mash that is only true on chromeos. Once
compiled with use_mash if you supply --mash to chrome it'll start the
shell inside chrome.
I haven't wired chrome up to start in this environment. Will do that
next.

BUG=581539
TEST=none
R=ben@chromium.org

Review URL: https://codereview.chromium.org/1722743002

Cr-Commit-Position: refs/heads/master@{#377113}


CrOS-Libchrome-Original-Commit: d6439eceec0ac412e5ce440847609a4d807e0f90
diff --git a/mojo/shell/application_manager.cc b/mojo/shell/application_manager.cc
index 1ff5901..0ed6160 100644
--- a/mojo/shell/application_manager.cc
+++ b/mojo/shell/application_manager.cc
@@ -338,7 +338,7 @@
     bool start_sandboxed = false;
     base::FilePath path = util::UrlToFilePath(file_url.To<GURL>());
     scoped_ptr<NativeRunner> runner = native_runner_factory_->Create(path);
-    runner->Start(path, start_sandboxed, std::move(request),
+    runner->Start(path, target, start_sandboxed, std::move(request),
                   base::Bind(&ApplicationManager::ApplicationPIDAvailable,
                              weak_ptr_factory_.GetWeakPtr(), instance->id()),
                   base::Bind(&ApplicationManager::CleanupRunner,
diff --git a/mojo/shell/background/background_shell.cc b/mojo/shell/background/background_shell.cc
index 0fdba19..3a56c81 100644
--- a/mojo/shell/background/background_shell.cc
+++ b/mojo/shell/background/background_shell.cc
@@ -72,10 +72,9 @@
 // Manages the thread to startup mojo.
 class BackgroundShell::MojoThread : public base::SimpleThread {
  public:
-  explicit MojoThread(
-      const std::vector<CommandLineSwitch>& command_line_switches)
+  explicit MojoThread(NativeRunnerDelegate* native_runner_delegate)
       : SimpleThread("mojo-background-shell"),
-        command_line_switches_(command_line_switches) {}
+        native_runner_delegate_(native_runner_delegate) {}
   ~MojoThread() override {}
 
   void CreateShellClientRequest(base::WaitableEvent* signal,
@@ -126,7 +125,7 @@
 
     scoped_ptr<Context> context(new Context);
     context_ = context.get();
-    context_->set_command_line_switches(command_line_switches_);
+    context_->set_native_runner_delegate(native_runner_delegate_);
     context_->Init(shell_dir);
 
     message_loop_->Run();
@@ -156,7 +155,7 @@
   // Created in Run() on the background thread.
   Context* context_ = nullptr;
 
-  const std::vector<CommandLineSwitch> command_line_switches_;
+  NativeRunnerDelegate* native_runner_delegate_;
 
   DISALLOW_COPY_AND_ASSIGN(MojoThread);
 };
@@ -167,10 +166,9 @@
   thread_->Stop();
 }
 
-void BackgroundShell::Init(
-    const std::vector<CommandLineSwitch>& command_line_switches) {
+void BackgroundShell::Init(NativeRunnerDelegate* native_runner_delegate) {
   DCHECK(!thread_);
-  thread_.reset(new MojoThread(command_line_switches));
+  thread_.reset(new MojoThread(native_runner_delegate));
   thread_->Start();
 }
 
diff --git a/mojo/shell/background/background_shell.h b/mojo/shell/background/background_shell.h
index d1e9c41..e04d282 100644
--- a/mojo/shell/background/background_shell.h
+++ b/mojo/shell/background/background_shell.h
@@ -17,7 +17,7 @@
 namespace mojo {
 namespace shell {
 
-struct CommandLineSwitch;
+class NativeRunnerDelegate;
 
 // BackgroundShell starts up the mojo shell on a background thread, and
 // destroys the thread in the destructor. Once created use CreateApplication()
@@ -28,9 +28,8 @@
   BackgroundShell();
   ~BackgroundShell();
 
-  // Starts the background shell. |command_line_switches| are additional
-  // switches applied to any processes spawned by this call.
-  void Init(const std::vector<CommandLineSwitch>& command_line_switches);
+  // Starts the background shell.
+  void Init(NativeRunnerDelegate* native_runner_delegate);
 
   // Obtains an InterfaceRequest for the specified url.
   InterfaceRequest<mojom::ShellClient> CreateShellClientRequest(
diff --git a/mojo/shell/native_runner.h b/mojo/shell/native_runner.h
index 6ab587b..f2d4bc6 100644
--- a/mojo/shell/native_runner.h
+++ b/mojo/shell/native_runner.h
@@ -22,6 +22,8 @@
 namespace mojo {
 namespace shell {
 
+class Identity;
+
 // ApplicationManager requires implementations of NativeRunner and
 // NativeRunnerFactory to run native applications.
 class NativeRunner {
@@ -32,6 +34,7 @@
   // thread/process.
   virtual void Start(
       const base::FilePath& app_path,
+      const Identity& target,
       bool start_sandboxed,
       InterfaceRequest<mojom::ShellClient> request,
       const base::Callback<void(base::ProcessId)>& pid_available_callback,
diff --git a/mojo/shell/native_runner_delegate.h b/mojo/shell/native_runner_delegate.h
new file mode 100644
index 0000000..d2fe826
--- /dev/null
+++ b/mojo/shell/native_runner_delegate.h
@@ -0,0 +1,32 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SHELL_NATIVE_RUNNER_DELEGATE_H_
+#define MOJO_SHELL_NATIVE_RUNNER_DELEGATE_H_
+
+namespace base {
+class CommandLine;
+}
+
+namespace mojo {
+namespace shell {
+
+class Identity;
+
+class NativeRunnerDelegate {
+ public:
+  // Called to adjust the commandline for launching the specified app.
+  // WARNING: this is called on a background thread.
+  virtual void AdjustCommandLineArgumentsForTarget(
+      const Identity& target,
+      base::CommandLine* command_line) = 0;
+
+ protected:
+  virtual ~NativeRunnerDelegate() {}
+};
+
+}  // namespace shell
+}  // namespace mojo
+
+#endif  // MOJO_SHELL_NATIVE_RUNNER_DELEGATE_H_
diff --git a/mojo/shell/runner/host/child_process_host.cc b/mojo/shell/runner/host/child_process_host.cc
index ae79312..b9a1c1f 100644
--- a/mojo/shell/runner/host/child_process_host.cc
+++ b/mojo/shell/runner/host/child_process_host.cc
@@ -21,8 +21,8 @@
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/public/cpp/bindings/interface_ptr_info.h"
 #include "mojo/public/cpp/system/core.h"
+#include "mojo/shell/native_runner_delegate.h"
 #include "mojo/shell/runner/common/switches.h"
-#include "mojo/shell/runner/host/command_line_switch.h"
 
 #if defined(OS_LINUX) && !defined(OS_ANDROID)
 #include "sandbox/linux/services/namespace_sandbox.h"
@@ -35,16 +35,17 @@
 namespace mojo {
 namespace shell {
 
-ChildProcessHost::ChildProcessHost(
-    base::TaskRunner* launch_process_runner,
-    bool start_sandboxed,
-    const base::FilePath& app_path,
-    const std::vector<CommandLineSwitch>& command_line_switches)
+ChildProcessHost::ChildProcessHost(base::TaskRunner* launch_process_runner,
+                                   NativeRunnerDelegate* delegate,
+                                   bool start_sandboxed,
+                                   const Identity& target,
+                                   const base::FilePath& app_path)
     : launch_process_runner_(launch_process_runner),
+      delegate_(delegate),
       start_sandboxed_(start_sandboxed),
+      target_(target),
       app_path_(app_path),
       start_child_process_event_(false, false),
-      command_line_switches_(command_line_switches),
       weak_factory_(this) {
   node_channel_.reset(new edk::PlatformChannelPair);
   primordial_pipe_token_ = edk::GenerateRandomToken();
@@ -55,6 +56,7 @@
 
 ChildProcessHost::ChildProcessHost(ScopedHandle channel)
     : launch_process_runner_(nullptr),
+      delegate_(nullptr),
       start_sandboxed_(false),
       start_child_process_event_(false, false),
       weak_factory_(this) {
@@ -149,8 +151,10 @@
   child_command_line.AppendSwitchASCII(switches::kPrimordialPipeToken,
                                        primordial_pipe_token_);
 
-  for (const CommandLineSwitch& pair : command_line_switches_)
-    child_command_line.AppendSwitchASCII(pair.key, pair.value);
+  if (delegate_) {
+    delegate_->AdjustCommandLineArgumentsForTarget(target_,
+                                                   &child_command_line);
+  }
 
   base::LaunchOptions options;
 #if defined(OS_WIN)
diff --git a/mojo/shell/runner/host/child_process_host.h b/mojo/shell/runner/host/child_process_host.h
index 69e7e4f..0cdbea3 100644
--- a/mojo/shell/runner/host/child_process_host.h
+++ b/mojo/shell/runner/host/child_process_host.h
@@ -19,6 +19,7 @@
 #include "base/synchronization/waitable_event.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
 #include "mojo/public/cpp/system/message_pipe.h"
+#include "mojo/shell/identity.h"
 #include "mojo/shell/runner/child/child_controller.mojom.h"
 #include "mojo/shell/runner/host/child_process_host.h"
 
@@ -29,7 +30,8 @@
 namespace mojo {
 namespace shell {
 
-struct CommandLineSwitch;
+class Identity;
+class NativeRunnerDelegate;
 
 // This class represents a "child process host". Handles launching and
 // connecting a platform-specific "pipe" to the child, and supports joining the
@@ -49,9 +51,10 @@
   // can be sandboxed if |start_sandboxed| is true. |app_path| is a path to the
   // mojo application we wish to start.
   ChildProcessHost(base::TaskRunner* launch_process_runner,
+                   NativeRunnerDelegate* delegate,
                    bool start_sandboxed,
-                   const base::FilePath& app_path,
-                   const std::vector<CommandLineSwitch>& switches);
+                   const Identity& target,
+                   const base::FilePath& app_path);
   // Allows a ChildProcessHost to be instantiated for an existing channel
   // created by someone else (e.g. an app that launched its own process).
   explicit ChildProcessHost(ScopedHandle channel);
@@ -79,7 +82,9 @@
   void AppCompleted(int32_t result);
 
   scoped_refptr<base::TaskRunner> launch_process_runner_;
+  NativeRunnerDelegate* delegate_;
   bool start_sandboxed_;
+  Identity target_;
   const base::FilePath app_path_;
   base::Process child_process_;
   // Used for the ChildController binding.
@@ -98,8 +103,6 @@
   // A token the child can use to connect a primordial pipe to the host.
   std::string primordial_pipe_token_;
 
-  const std::vector<CommandLineSwitch> command_line_switches_;
-
   base::WeakPtrFactory<ChildProcessHost> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(ChildProcessHost);
diff --git a/mojo/shell/runner/host/child_process_host_unittest.cc b/mojo/shell/runner/host/child_process_host_unittest.cc
index 64a63fe..e14d2ac 100644
--- a/mojo/shell/runner/host/child_process_host_unittest.cc
+++ b/mojo/shell/runner/host/child_process_host_unittest.cc
@@ -6,6 +6,8 @@
 
 #include "mojo/shell/runner/host/child_process_host.h"
 
+#include <utility>
+
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/command_line.h"
@@ -18,7 +20,7 @@
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/embedder/process_delegate.h"
 #include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/shell/runner/host/command_line_switch.h"
+#include "mojo/shell/native_runner_delegate.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace mojo {
@@ -40,6 +42,30 @@
   DISALLOW_COPY_AND_ASSIGN(ProcessDelegate);
 };
 
+class NativeRunnerDelegateImpl : public NativeRunnerDelegate {
+ public:
+  NativeRunnerDelegateImpl() {}
+  ~NativeRunnerDelegateImpl() override {}
+
+  size_t get_and_clear_adjust_count() {
+    size_t count = 0;
+    std::swap(count, adjust_count_);
+    return count;
+  }
+
+ private:
+  // NativeRunnerDelegate:
+  void AdjustCommandLineArgumentsForTarget(
+      const Identity& target,
+      base::CommandLine* command_line) override {
+    adjust_count_++;
+  }
+
+  size_t adjust_count_ = 0;
+
+  DISALLOW_COPY_AND_ASSIGN(NativeRunnerDelegateImpl);
+};
+
 #if defined(OS_ANDROID)
 // TODO(qsr): Multiprocess shell tests are not supported on android.
 #define MAYBE_StartJoin DISABLED_StartJoin
@@ -64,9 +90,10 @@
   ProcessDelegate delegate;
   edk::InitIPCSupport(&delegate, io_thread.task_runner());
 
-  ChildProcessHost child_process_host(blocking_pool.get(), false,
-                                      base::FilePath(),
-                                      std::vector<CommandLineSwitch>());
+  NativeRunnerDelegateImpl native_runner_delegate;
+  ChildProcessHost child_process_host(blocking_pool.get(),
+                                      &native_runner_delegate, false,
+                                      Identity(), base::FilePath());
   base::RunLoop run_loop;
   child_process_host.Start(
       base::Bind(&ProcessReadyCallbackAdapater, run_loop.QuitClosure()));
@@ -78,6 +105,7 @@
   EXPECT_EQ(123, exit_code);
   blocking_pool->Shutdown();
   edk::ShutdownIPCSupport();
+  EXPECT_EQ(1u, native_runner_delegate.get_and_clear_adjust_count());
 }
 
 }  // namespace
diff --git a/mojo/shell/runner/host/command_line_switch.h b/mojo/shell/runner/host/command_line_switch.h
deleted file mode 100644
index 8e5224e..0000000
--- a/mojo/shell/runner/host/command_line_switch.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_SHELL_RUNNER_HOST_COMMAND_LINE_SWITCH_H_
-#define MOJO_SHELL_RUNNER_HOST_COMMAND_LINE_SWITCH_H_
-
-#include <string>
-
-namespace mojo {
-namespace shell {
-
-struct CommandLineSwitch {
-  CommandLineSwitch() : is_switch(true) {}
-
-  // If false only the key is used and the switch is treated as a single value.
-  bool is_switch;
-  std::string key;
-  std::string value;
-};
-
-}  // namespace shell
-}  // namespace mojo
-
-#endif  // MOJO_SHELL_RUNNER_HOST_COMMAND_LINE_SWITCH_H_
diff --git a/mojo/shell/runner/host/in_process_native_runner.cc b/mojo/shell/runner/host/in_process_native_runner.cc
index 69738a6..9dd19d0 100644
--- a/mojo/shell/runner/host/in_process_native_runner.cc
+++ b/mojo/shell/runner/host/in_process_native_runner.cc
@@ -12,7 +12,6 @@
 #include "base/task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/threading/platform_thread.h"
-#include "mojo/shell/runner/host/command_line_switch.h"
 #include "mojo/shell/runner/host/native_application_support.h"
 #include "mojo/shell/runner/host/out_of_process_native_runner.h"
 #include "mojo/shell/runner/init.h"
@@ -35,6 +34,7 @@
 
 void InProcessNativeRunner::Start(
     const base::FilePath& app_path,
+    const Identity& target,
     bool start_sandboxed,
     InterfaceRequest<mojom::ShellClient> request,
     const base::Callback<void(base::ProcessId)>& pid_available_callback,
@@ -83,8 +83,8 @@
     const base::FilePath& app_path) {
   // Non-Mojo apps are always run in a new process.
   if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) {
-    return make_scoped_ptr(new OutOfProcessNativeRunner(
-        launch_process_runner_, std::vector<CommandLineSwitch>()));
+    return make_scoped_ptr(
+        new OutOfProcessNativeRunner(launch_process_runner_, nullptr));
   }
   return make_scoped_ptr(new InProcessNativeRunner);
 }
diff --git a/mojo/shell/runner/host/in_process_native_runner.h b/mojo/shell/runner/host/in_process_native_runner.h
index 93216b2..8e62172 100644
--- a/mojo/shell/runner/host/in_process_native_runner.h
+++ b/mojo/shell/runner/host/in_process_native_runner.h
@@ -32,6 +32,7 @@
   // NativeRunner:
   void Start(
       const base::FilePath& app_path,
+      const Identity& target,
       bool start_sandboxed,
       InterfaceRequest<mojom::ShellClient> request,
       const base::Callback<void(base::ProcessId)>& pid_available_callback,
diff --git a/mojo/shell/runner/host/out_of_process_native_runner.cc b/mojo/shell/runner/host/out_of_process_native_runner.cc
index 3ac446c..cea56bc 100644
--- a/mojo/shell/runner/host/out_of_process_native_runner.cc
+++ b/mojo/shell/runner/host/out_of_process_native_runner.cc
@@ -14,7 +14,6 @@
 #include "base/logging.h"
 #include "base/task_runner.h"
 #include "mojo/shell/runner/host/child_process_host.h"
-#include "mojo/shell/runner/host/command_line_switch.h"
 #include "mojo/shell/runner/host/in_process_native_runner.h"
 
 namespace mojo {
@@ -22,9 +21,8 @@
 
 OutOfProcessNativeRunner::OutOfProcessNativeRunner(
     base::TaskRunner* launch_process_runner,
-    const std::vector<CommandLineSwitch>& command_line_switches)
-    : launch_process_runner_(launch_process_runner),
-      command_line_switches_(command_line_switches) {}
+    NativeRunnerDelegate* delegate)
+    : launch_process_runner_(launch_process_runner), delegate_(delegate) {}
 
 OutOfProcessNativeRunner::~OutOfProcessNativeRunner() {
   if (child_process_host_ && !app_path_.empty())
@@ -33,6 +31,7 @@
 
 void OutOfProcessNativeRunner::Start(
     const base::FilePath& app_path,
+    const Identity& target,
     bool start_sandboxed,
     InterfaceRequest<mojom::ShellClient> request,
     const base::Callback<void(base::ProcessId)>& pid_available_callback,
@@ -42,9 +41,8 @@
   DCHECK(app_completed_callback_.is_null());
   app_completed_callback_ = app_completed_callback;
 
-  child_process_host_.reset(new ChildProcessHost(launch_process_runner_,
-                                                 start_sandboxed, app_path,
-                                                 command_line_switches_));
+  child_process_host_.reset(new ChildProcessHost(
+      launch_process_runner_, delegate_, start_sandboxed, target, app_path));
   child_process_host_->Start(base::Bind(
       &OutOfProcessNativeRunner::OnProcessLaunched, base::Unretained(this),
       base::Passed(&request), pid_available_callback));
@@ -86,15 +84,14 @@
 
 OutOfProcessNativeRunnerFactory::OutOfProcessNativeRunnerFactory(
     base::TaskRunner* launch_process_runner,
-    const std::vector<CommandLineSwitch>& command_line_switches)
-    : launch_process_runner_(launch_process_runner),
-      command_line_switches_(command_line_switches) {}
+    NativeRunnerDelegate* delegate)
+    : launch_process_runner_(launch_process_runner), delegate_(delegate) {}
 OutOfProcessNativeRunnerFactory::~OutOfProcessNativeRunnerFactory() {}
 
 scoped_ptr<shell::NativeRunner> OutOfProcessNativeRunnerFactory::Create(
     const base::FilePath& app_path) {
-  return make_scoped_ptr(new OutOfProcessNativeRunner(launch_process_runner_,
-                                                      command_line_switches_));
+  return make_scoped_ptr(
+      new OutOfProcessNativeRunner(launch_process_runner_, delegate_));
 }
 
 }  // namespace shell
diff --git a/mojo/shell/runner/host/out_of_process_native_runner.h b/mojo/shell/runner/host/out_of_process_native_runner.h
index 0edb0aa..6b63c8a 100644
--- a/mojo/shell/runner/host/out_of_process_native_runner.h
+++ b/mojo/shell/runner/host/out_of_process_native_runner.h
@@ -7,8 +7,6 @@
 
 #include <stdint.h>
 
-#include <vector>
-
 #include "base/callback.h"
 #include "base/files/file_path.h"
 #include "base/macros.h"
@@ -23,20 +21,20 @@
 namespace shell {
 
 class ChildProcessHost;
-struct CommandLineSwitch;
+class NativeRunnerDelegate;
 
 // An implementation of |NativeRunner| that loads/runs the given app (from the
 // file system) in a separate process (of its own).
 class OutOfProcessNativeRunner : public NativeRunner {
  public:
-  OutOfProcessNativeRunner(
-      base::TaskRunner* launch_process_runner,
-      const std::vector<CommandLineSwitch>& command_line_switches);
+  OutOfProcessNativeRunner(base::TaskRunner* launch_process_runner,
+                           NativeRunnerDelegate* delegate);
   ~OutOfProcessNativeRunner() override;
 
   // NativeRunner:
   void Start(
       const base::FilePath& app_path,
+      const Identity& identity,
       bool start_sandboxed,
       InterfaceRequest<mojom::ShellClient> request,
       const base::Callback<void(base::ProcessId)>& pid_available_callback,
@@ -56,12 +54,11 @@
       base::ProcessId pid);
 
   base::TaskRunner* const launch_process_runner_;
+  NativeRunnerDelegate* delegate_;
 
   base::FilePath app_path_;
   base::Closure app_completed_callback_;
 
-  std::vector<CommandLineSwitch> command_line_switches_;
-
   scoped_ptr<ChildProcessHost> child_process_host_;
 
   DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunner);
@@ -69,16 +66,15 @@
 
 class OutOfProcessNativeRunnerFactory : public NativeRunnerFactory {
  public:
-  OutOfProcessNativeRunnerFactory(
-      base::TaskRunner* launch_process_runner,
-      const std::vector<CommandLineSwitch>& command_line_switches);
+  OutOfProcessNativeRunnerFactory(base::TaskRunner* launch_process_runner,
+                                  NativeRunnerDelegate* delegate);
   ~OutOfProcessNativeRunnerFactory() override;
 
   scoped_ptr<NativeRunner> Create(const base::FilePath& app_path) override;
 
  private:
   base::TaskRunner* const launch_process_runner_;
-  std::vector<CommandLineSwitch> command_line_switches_;
+  NativeRunnerDelegate* delegate_;
 
   DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunnerFactory);
 };
diff --git a/mojo/shell/standalone/context.cc b/mojo/shell/standalone/context.cc
index a04d259..2c49e73 100644
--- a/mojo/shell/standalone/context.cc
+++ b/mojo/shell/standalone/context.cc
@@ -34,7 +34,6 @@
 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
 #include "mojo/shell/application_loader.h"
 #include "mojo/shell/connect_params.h"
-#include "mojo/shell/runner/host/command_line_switch.h"
 #include "mojo/shell/runner/host/in_process_native_runner.h"
 #include "mojo/shell/runner/host/out_of_process_native_runner.h"
 #include "mojo/shell/standalone/tracer.h"
@@ -99,7 +98,8 @@
 
 Context::Context()
     : io_thread_(CreateIOThread("io_thread")),
-      main_entry_time_(base::Time::Now()) {}
+      main_entry_time_(base::Time::Now()),
+      native_runner_delegate_(nullptr) {}
 
 Context::~Context() {
   DCHECK(!base::MessageLoop::current());
@@ -145,7 +145,7 @@
         new InProcessNativeRunnerFactory(blocking_pool_.get()));
   } else {
     runner_factory.reset(new OutOfProcessNativeRunnerFactory(
-        blocking_pool_.get(), command_line_switches_));
+        blocking_pool_.get(), native_runner_delegate_));
   }
   application_manager_.reset(new ApplicationManager(
       std::move(runner_factory), blocking_pool_.get(), true));
diff --git a/mojo/shell/standalone/context.h b/mojo/shell/standalone/context.h
index 19df61a..e9af8fb 100644
--- a/mojo/shell/standalone/context.h
+++ b/mojo/shell/standalone/context.h
@@ -5,8 +5,6 @@
 #ifndef MOJO_SHELL_STANDALONE_CONTEXT_H_
 #define MOJO_SHELL_STANDALONE_CONTEXT_H_
 
-#include <vector>
-
 #include "base/callback_forward.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
@@ -15,7 +13,6 @@
 #include "base/time/time.h"
 #include "mojo/edk/embedder/process_delegate.h"
 #include "mojo/shell/application_manager.h"
-#include "mojo/shell/runner/host/command_line_switch.h"
 #include "mojo/shell/standalone/tracer.h"
 #include "url/gurl.h"
 
@@ -25,7 +22,7 @@
 
 namespace mojo {
 namespace shell {
-struct CommandLineSwitch;
+class NativeRunnerDelegate;
 
 // The "global" context for the shell's main process.
 class Context : public edk::ProcessDelegate {
@@ -35,9 +32,8 @@
 
   static void EnsureEmbedderIsInitialized();
 
-  void set_command_line_switches(
-      const std::vector<CommandLineSwitch>& command_line_switches) {
-    command_line_switches_ = command_line_switches;
+  void set_native_runner_delegate(NativeRunnerDelegate* delegate) {
+    native_runner_delegate_ = delegate;
   }
 
   // This must be called with a message loop set up for the current thread,
@@ -70,7 +66,8 @@
   Tracer tracer_;
   scoped_ptr<ApplicationManager> application_manager_;
   base::Time main_entry_time_;
-  std::vector<CommandLineSwitch> command_line_switches_;
+
+  NativeRunnerDelegate* native_runner_delegate_;
 
   DISALLOW_COPY_AND_ASSIGN(Context);
 };