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

Unified Diff: shell/context.cc

Issue 816693006: Fix skydb to work for android (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | sky/tools/debugger/prompt/prompt.cc » ('j') | sky/tools/debugger/prompt/prompt.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/context.cc
diff --git a/shell/context.cc b/shell/context.cc
index 882b358021d33fa857c32b6c170fb07ca6f25206..c10841c221271419f0fe99dec0dfe86eaaee3606 100644
--- a/shell/context.cc
+++ b/shell/context.cc
@@ -14,6 +14,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/strings/string_split.h"
+#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "mojo/application_manager/application_loader.h"
#include "mojo/application_manager/application_manager.h"
@@ -70,11 +71,24 @@ void InitContentHandlers(DynamicApplicationLoader* loader,
if (handlers_spec.empty())
return;
+#if defined(OS_ANDROID)
+ // TODO(eseidel): On Android we pass command line arguments is via the
+ // 'parameters' key on the intent, which we specify during 'am shell start'
+ // via --esa, however that expects comma-separated values and says:
+ // am shell --help:
+ // [--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]
+ // (to embed a comma into a string escape it using "\,")
+ // Whatever takes 'parameters' and constructs a CommandLine is failing to
+ // un-escape the commas, we need to move this fix to that file.
+ ReplaceSubstringsAfterOffset(&handlers_spec, 0, "\\,", ",");
abarth-chromium 2015/01/09 22:59:19 What about \\, ?
+#endif
+
std::vector<std::string> parts;
base::SplitString(handlers_spec, ',', &parts);
if (parts.size() % 2 != 0) {
LOG(ERROR) << "Invalid value for switch " << switches::kContentHandlers
- << ": must be a comma-separated list of mimetype/url pairs.";
+ << ": must be a comma-separated list of mimetype/url pairs."
+ << handlers_spec;
return;
}
@@ -85,6 +99,8 @@ void InitContentHandlers(DynamicApplicationLoader* loader,
<< ": '" << parts[i + 1] << "' is not a valid URL.";
return;
}
+ // TODO(eseidel): We should also validate that the mimetype is valid
+ // net/base/mime_util.h could do this, but we don't want to depend on net.
loader->RegisterContentHandler(parts[i], url);
}
}
« no previous file with comments | « no previous file | sky/tools/debugger/prompt/prompt.cc » ('j') | sky/tools/debugger/prompt/prompt.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698