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; |
} |