Index: shell/mojo_url_resolver.cc |
diff --git a/shell/mojo_url_resolver.cc b/shell/mojo_url_resolver.cc |
index 499c6bfcc1af3acef8317712aee93f2b6d3e1b82..1e77629a47259719688ce44784b499ff92a5bdb3 100644 |
--- a/shell/mojo_url_resolver.cc |
+++ b/shell/mojo_url_resolver.cc |
@@ -30,11 +30,10 @@ GURL AddTrailingSlashIfNeeded(const GURL& url) { |
MojoURLResolver::MojoURLResolver() { |
// Needed to treat first component of mojo URLs as host, not path. |
url::AddStandardScheme("mojo"); |
- |
- // By default, resolve mojo URLs to files living alongside the shell. |
+ // By default assume that the local apps reside alongside the shell. |
base::FilePath path; |
PathService::Get(base::DIR_MODULE, &path); |
- default_base_url_ = AddTrailingSlashIfNeeded(FilePathToFileURL(path)); |
+ local_apps_url_ = AddTrailingSlashIfNeeded(FilePathToFileURL(path)); |
} |
MojoURLResolver::~MojoURLResolver() { |
@@ -47,6 +46,12 @@ void MojoURLResolver::SetBaseURL(const GURL& base_url) { |
base_url_ = AddTrailingSlashIfNeeded(base_url); |
} |
+void MojoURLResolver::SetLocalAppsPath(const base::FilePath& local_apps_path) { |
+ local_apps_url_ = |
+ AddTrailingSlashIfNeeded(FilePathToFileURL(local_apps_path)); |
+ DCHECK(local_apps_url_.is_valid()); |
+} |
+ |
void MojoURLResolver::AddCustomMapping(const GURL& mojo_url, |
const GURL& resolved_url) { |
url_map_[mojo_url] = resolved_url; |
@@ -68,7 +73,7 @@ GURL MojoURLResolver::Resolve(const GURL& mojo_url) const { |
if (!base_url_.is_valid() || |
local_file_set_.find(mapped_url) != local_file_set_.end()) { |
// Resolve to a local file URL. |
- return default_base_url_.Resolve(lib); |
+ return local_apps_url_.Resolve(lib); |
} |
// Otherwise, resolve to an URL relative to base_url_. |