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

Unified Diff: mojo/shell/mojo_url_resolver.cc

Issue 397733003: mojo: kill app_thread before unloading main app library and add tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: also service_manager_unittests Created 6 years, 5 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/mojo_url_resolver.h ('k') | mojo/shell/shell_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/mojo_url_resolver.cc
diff --git a/mojo/shell/mojo_url_resolver.cc b/mojo/shell/mojo_url_resolver.cc
index daa91639ecc6186d23573c505471a43fb451d362..debb3d766c685cbb9828c69d29896a6d7edb67f3 100644
--- a/mojo/shell/mojo_url_resolver.cc
+++ b/mojo/shell/mojo_url_resolver.cc
@@ -38,6 +38,19 @@ MojoURLResolver::MojoURLResolver() {
MojoURLResolver::~MojoURLResolver() {
}
+void MojoURLResolver::SetBaseURL(const GURL& base_url) {
+ DCHECK(base_url.is_valid());
+ base_url_ = base_url;
+ // Force a trailing slash on the base_url to simplify resolving
+ // relative files and URLs below.
+ if (base_url.has_path() && *base_url.path().rbegin() != '/') {
+ std::string path(base_url.path() + '/');
+ GURL::Replacements replacements;
+ replacements.SetPathStr(path);
+ base_url_ = base_url_.ReplaceComponents(replacements);
+ }
+}
+
void MojoURLResolver::AddCustomMapping(const GURL& mojo_url,
const GURL& resolved_url) {
url_map_[mojo_url] = resolved_url;
@@ -62,8 +75,8 @@ GURL MojoURLResolver::Resolve(const GURL& mojo_url) const {
return net::FilePathToFileURL(path);
}
- // Otherwise, resolve to an URL relative to origin_.
- return GURL(origin_ + "/" + lib);
+ // Otherwise, resolve to an URL relative to base_url_.
+ return base_url_.Resolve(lib);
}
} // namespace shell
« no previous file with comments | « mojo/shell/mojo_url_resolver.h ('k') | mojo/shell/shell_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698