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

Unified Diff: mojo/shell/context.cc

Issue 1082513002: Revert of Simplify mojo_shell since it's now only used for Mandoline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. 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/command_line_util_unittest.cc ('k') | mojo/shell/desktop/launcher_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/context.cc
diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc
index fc56476f819ea3392cb56a58ddb5b08aa9d4b71b..fbde07dd2ab0e6510a0905073a08a30e56ffae25 100644
--- a/mojo/shell/context.cc
+++ b/mojo/shell/context.cc
@@ -30,6 +30,7 @@
#include "mojo/services/tracing/tracing.mojom.h"
#include "mojo/shell/application_manager/application_loader.h"
#include "mojo/shell/application_manager/application_manager.h"
+#include "mojo/shell/command_line_util.h"
#include "mojo/shell/filename_util.h"
#include "mojo/shell/in_process_native_runner.h"
#include "mojo/shell/out_of_process_native_runner.h"
@@ -84,6 +85,22 @@ bool ConfigureURLMappings(const base::CommandLine& command_line,
resolver->AddOriginMapping(GURL(origin_mapping.origin),
GURL(origin_mapping.base_url));
+ if (command_line.HasSwitch(switches::kURLMappings)) {
+ const std::string mappings =
+ command_line.GetSwitchValueASCII(switches::kURLMappings);
+
+ base::StringPairs pairs;
+ if (!base::SplitStringIntoKeyValuePairs(mappings, '=', ',', &pairs))
+ return false;
+ using StringPair = std::pair<std::string, std::string>;
+ for (const StringPair& pair : pairs) {
+ const GURL from(pair.first);
+ const GURL to = context->ResolveCommandLineURL(pair.second);
+ if (!from.is_valid() || !to.is_valid())
+ return false;
+ resolver->AddURLMapping(from, to);
+ }
+ }
return true;
}
« no previous file with comments | « mojo/shell/command_line_util_unittest.cc ('k') | mojo/shell/desktop/launcher_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698