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

Unified Diff: mojo/fetcher/url_resolver.cc

Issue 1419293003: Allow mojo_runner to connect to arbitrary executables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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/application/public/cpp/BUILD.gn ('k') | mojo/runner/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/fetcher/url_resolver.cc
diff --git a/mojo/fetcher/url_resolver.cc b/mojo/fetcher/url_resolver.cc
index 7028f894c0980a6bd79695050d69d03f269e8c94..4663f5e5f85d4ec161c68c52061afaadeef9d708 100644
--- a/mojo/fetcher/url_resolver.cc
+++ b/mojo/fetcher/url_resolver.cc
@@ -19,22 +19,32 @@ URLResolver::URLResolver(const GURL& mojo_base_url)
DCHECK(mojo_base_url_.is_valid());
// Needed to treat first component of mojo URLs as host, not path.
url::AddStandardScheme("mojo", url::SCHEME_WITHOUT_AUTHORITY);
+ url::AddStandardScheme("exe", url::SCHEME_WITHOUT_AUTHORITY);
}
URLResolver::~URLResolver() {
}
GURL URLResolver::ResolveMojoURL(const GURL& mojo_url) const {
- if (mojo_url.scheme() != "mojo") {
+ if (mojo_url.SchemeIs("mojo")) {
+ // It's still a mojo: URL, use the default mapping scheme.
+ std::string query;
+ GURL base_url = shell::GetBaseURLAndQuery(mojo_url, &query);
+ const std::string host = base_url.host();
+ return mojo_base_url_.Resolve(host + "/" + host + ".mojo" + query);
+ } else if (mojo_url.SchemeIs("exe")) {
+#if defined OS_WIN
+ std::string extension = ".exe";
+#else
+ std::string extension;
+#endif
+ std::string query;
+ GURL base_url = shell::GetBaseURLAndQuery(mojo_url, &query);
+ return mojo_base_url_.Resolve(base_url.host() + extension);
+ } else {
// The mapping has produced some sort of non-mojo: URL - file:, http:, etc.
return mojo_url;
}
-
- // It's still a mojo: URL, use the default mapping scheme.
- std::string query;
- GURL base_url = shell::GetBaseURLAndQuery(mojo_url, &query);
- const std::string host = base_url.host();
- return mojo_base_url_.Resolve(host + "/" + host + ".mojo" + query);
}
} // namespace fetcher
« no previous file with comments | « mojo/application/public/cpp/BUILD.gn ('k') | mojo/runner/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698