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

Unified Diff: mojo/runner/context.h

Issue 1343823002: Revert of Move fetching logic out of ApplicationManager, eliminate url mappings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/runner/child_process_host_unittest.cc ('k') | mojo/runner/context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/runner/context.h
diff --git a/mojo/runner/context.h b/mojo/runner/context.h
index 52537666ee68928dd8ea85a1d776c81dbd2a9a61..7e15a77b77dda3d61cc98743a22b74f4be59e3df 100644
--- a/mojo/runner/context.h
+++ b/mojo/runner/context.h
@@ -5,7 +5,6 @@
#ifndef MOJO_RUNNER_CONTEXT_H_
#define MOJO_RUNNER_CONTEXT_H_
-#include <set>
#include <string>
#include "base/callback_forward.h"
@@ -14,8 +13,8 @@
#include "mojo/edk/embedder/process_delegate.h"
#include "mojo/runner/scoped_user_data_dir.h"
#include "mojo/runner/task_runners.h"
+#include "mojo/runner/url_resolver.h"
#include "mojo/shell/application_manager.h"
-#include "url/gurl.h"
namespace mojo {
namespace runner {
@@ -23,12 +22,31 @@
class NativeApplicationLoader;
// The "global" context for the shell's main process.
-class Context : public embedder::ProcessDelegate {
+class Context : public shell::ApplicationManager::Delegate,
+ public embedder::ProcessDelegate {
public:
- explicit Context(const base::FilePath& shell_file_root);
+ Context();
~Context() override;
static void EnsureEmbedderIsInitialized();
+
+ // Point to the directory containing installed services, such as the network
+ // service. By default this directory is used as the base URL for resolving
+ // unknown mojo: URLs. The network service will be loaded from this directory,
+ // even when the base URL for unknown mojo: URLs is overridden.
+ void SetShellFileRoot(const base::FilePath& path);
+
+ // Resolve an URL relative to the shell file root. This is a nop for
+ // everything but relative file URLs or URLs without a scheme.
+ GURL ResolveShellFileURL(const std::string& path);
+
+ // Override the CWD, which is used for resolving file URLs passed in from the
+ // command line.
+ void SetCommandLineCWD(const base::FilePath& path);
+
+ // Resolve an URL relative to the CWD mojo_shell was invoked from. This is a
+ // nop for everything but relative file URLs or URLs without a scheme.
+ GURL ResolveCommandLineURL(const std::string& path);
// This must be called with a message loop set up for the current thread,
// which must remain alive until after Shutdown() is called. Returns true on
@@ -49,11 +67,19 @@
TaskRunners* task_runners() { return task_runners_.get(); }
shell::ApplicationManager* application_manager() {
- return application_manager_.get();
+ return &application_manager_;
}
+ URLResolver* url_resolver() { return &url_resolver_; }
private:
class NativeViewportApplicationLoader;
+
+ // ApplicationManager::Delegate overrides.
+ GURL ResolveMappings(const GURL& url) override;
+ GURL ResolveMojoURL(const GURL& url) override;
+ bool CreateFetcher(
+ const GURL& url,
+ const shell::Fetcher::FetchCallback& loader_callback) override;
// ProcessDelegate implementation.
void OnShutdownComplete() override;
@@ -63,7 +89,10 @@
ScopedUserDataDir scoped_user_data_dir;
std::set<GURL> app_urls_;
scoped_ptr<TaskRunners> task_runners_;
- scoped_ptr<shell::ApplicationManager> application_manager_;
+ shell::ApplicationManager application_manager_;
+ URLResolver url_resolver_;
+ GURL shell_file_root_;
+ GURL command_line_cwd_;
base::Closure app_complete_callback_;
base::Time main_entry_time_;
« no previous file with comments | « mojo/runner/child_process_host_unittest.cc ('k') | mojo/runner/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698