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

Unified Diff: mojo/shell/desktop/mojo_main.cc

Issue 627093002: mojo_js_standalone will quit after the last JSApp quits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt to fix the inexplicable fail-to-commit with a resync Created 6 years, 2 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/apps/js/js_app.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/desktop/mojo_main.cc
diff --git a/mojo/shell/desktop/mojo_main.cc b/mojo/shell/desktop/mojo_main.cc
index 0331d3e793daec370661af9b24a1a57698d36970..69b6e1da9c60fffc0bb37d6ea26c9c1c52ce6458 100644
--- a/mojo/shell/desktop/mojo_main.cc
+++ b/mojo/shell/desktop/mojo_main.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <algorithm>
+
#include "base/at_exit.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -35,14 +37,21 @@ void SplitString(const std::string& str, std::vector<std::string>* argv) {
}
#endif
+bool is_empty(const std::string& s) {
+ return s.empty();
+}
+
// The value of app_url_and_args is "<mojo_app_url> [<args>...]", where args
// is a list of "configuration" arguments separated by spaces. If one or more
// arguments are specified they will be available when the Mojo application
// is initialized. See ApplicationImpl::args().
GURL GetAppURLAndSetArgs(const base::CommandLine::StringType& app_url_and_args,
mojo::shell::Context* context) {
+ // SplitString() returns empty strings for extra delimeter characters (' ').
std::vector<std::string> argv;
SplitString(app_url_and_args, &argv);
+ argv.erase(std::remove_if(argv.begin(), argv.end(), is_empty), argv.end());
+
if (argv.empty())
return GURL::EmptyGURL();
GURL app_url(argv[0]);
« no previous file with comments | « mojo/apps/js/js_app.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698