Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: mojo/shell/runner/common/client_util.cc

Issue 1801963002: Change primordial pipes to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase onto catalog CL Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/runner/common/client_util.h ('k') | mojo/shell/runner/host/child_process_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/runner/common/client_util.cc
diff --git a/mojo/shell/runner/common/client_util.cc b/mojo/shell/runner/common/client_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2c264bd27812cce7a4a27f3ce2a91f20e6c46a4a
--- /dev/null
+++ b/mojo/shell/runner/common/client_util.cc
@@ -0,0 +1,38 @@
+// 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.
+
+#include "mojo/shell/runner/common/client_util.h"
+
+#include <string>
+
+#include "base/command_line.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/shell/runner/common/switches.h"
+
+namespace mojo {
+namespace shell {
+
+mojom::ShellClientPtr PassShellClientRequestOnCommandLine(
+ base::CommandLine* command_line) {
+ std::string token = edk::GenerateRandomToken();
+ command_line->AppendSwitchASCII(switches::kPrimordialPipeToken, token);
+
+ mojom::ShellClientPtr client;
+ client.Bind(
+ mojom::ShellClientPtrInfo(edk::CreateParentMessagePipe(token), 0));
+ return client;
+}
+
+mojom::ShellClientRequest GetShellClientRequestFromCommandLine() {
+ std::string token =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kPrimordialPipeToken);
+ mojom::ShellClientRequest request;
+ if (!token.empty())
+ request.Bind(edk::CreateChildMessagePipe(token));
+ return request;
+}
+
+} // namespace shell
+} // namespace mojo
« no previous file with comments | « mojo/shell/runner/common/client_util.h ('k') | mojo/shell/runner/host/child_process_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698