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

Unified Diff: mojo/shell/native_application_support.cc

Issue 1057603003: Simplify mojo_shell since it's now only used for Mandoline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update scripts Created 5 years, 8 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/desktop/launcher_process.cc ('k') | mojo/shell/shell_apptest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/native_application_support.cc
diff --git a/mojo/shell/native_application_support.cc b/mojo/shell/native_application_support.cc
index 55ae2cf96a1ad7c768485ce165dd22baece2a2f8..9df3ed887f0975f090035e082af7ef672ad9d1fe 100644
--- a/mojo/shell/native_application_support.cc
+++ b/mojo/shell/native_application_support.cc
@@ -4,6 +4,7 @@
#include "mojo/shell/native_application_support.h"
+#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
@@ -104,6 +105,26 @@ bool RunNativeApplication(base::NativeLibrary app_library,
init_go_runtime();
}
+#if !defined(OS_WIN)
+ // On Windows, initializing base::CommandLine with null parameters gets the
+ // process's command line from the OS. Other platforms need it to be passed
+ // in. This needs to be passed in before the app initializes the command line,
+ // which is done as soon as it loads.
+ typedef void (*InitCommandLineArgs)(int, const char* const*);
+ InitCommandLineArgs init_command_line_args =
+ reinterpret_cast<InitCommandLineArgs>(
+ base::GetFunctionPointerFromNativeLibrary(app_library,
+ "InitCommandLineArgs"));
+ if (init_command_line_args) {
+ int argc = 0;
+ base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
+ const char** argv = new const char* [cmd_line->argv().size()];
+ for (auto& arg : cmd_line->argv())
+ argv[argc++] = arg.c_str();
+ init_command_line_args(argc, argv);
+ }
+#endif
+
typedef MojoResult (*MojoMainFunction)(MojoHandle);
MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>(
base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain"));
« no previous file with comments | « mojo/shell/desktop/launcher_process.cc ('k') | mojo/shell/shell_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698