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

Side by Side Diff: shell/context.h

Issue 868963002: Simplify resolution of mojo: URLs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Comments Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « shell/android/mojo_main.cc ('k') | shell/context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SHELL_CONTEXT_H_ 5 #ifndef SHELL_CONTEXT_H_
6 #define SHELL_CONTEXT_H_ 6 #define SHELL_CONTEXT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "shell/application_manager/application_manager.h" 11 #include "shell/application_manager/application_manager.h"
12 #include "shell/mojo_url_resolver.h" 12 #include "shell/mojo_url_resolver.h"
13 #include "shell/task_runners.h" 13 #include "shell/task_runners.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 16
17 namespace shell { 17 namespace shell {
18 18
19 class DynamicApplicationLoader; 19 class DynamicApplicationLoader;
20 class ExternalApplicationListener; 20 class ExternalApplicationListener;
21 21
22 // The "global" context for the shell's main process. 22 // The "global" context for the shell's main process.
23 class Context : ApplicationManager::Delegate { 23 class Context : ApplicationManager::Delegate {
24 public: 24 public:
25 Context(); 25 Context();
26 ~Context() override; 26 ~Context() override;
27 27
28 // Point to the directory containing installed services, such as the network
29 // service. By default this directory is used as the base URL for resolving
30 // unknown mojo: URLs. The network service will be loaded from this directory,
31 // even when the base URL for unknown mojo: URLs is overridden.
32 void SetShellFileRoot(const base::FilePath& path);
33
34 // Resolve an URL relative to the shell file root. This is a nop for
35 // everything but relative file URLs or URLs without a scheme.
36 GURL ResolveShellFileURL(const std::string& path);
37
28 static void EnsureEmbedderIsInitialized(); 38 static void EnsureEmbedderIsInitialized();
29 bool Init(); 39 bool Init();
30 40
31 void Run(const GURL& url); 41 void Run(const GURL& url);
32 ScopedMessagePipeHandle ConnectToServiceByName( 42 ScopedMessagePipeHandle ConnectToServiceByName(
33 const GURL& application_url, 43 const GURL& application_url,
34 const std::string& service_name); 44 const std::string& service_name);
35 45
36 TaskRunners* task_runners() { return task_runners_.get(); } 46 TaskRunners* task_runners() { return task_runners_.get(); }
37 ApplicationManager* application_manager() { return &application_manager_; } 47 ApplicationManager* application_manager() { return &application_manager_; }
38 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; } 48 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; }
39 49
40 private: 50 private:
41 class NativeViewportApplicationLoader; 51 class NativeViewportApplicationLoader;
42 52
43 // ApplicationManager::Delegate override. 53 // ApplicationManager::Delegate override.
44 void OnApplicationError(const GURL& url) override; 54 void OnApplicationError(const GURL& url) override;
45 GURL ResolveURL(const GURL& url) override; 55 GURL ResolveURL(const GURL& url) override;
46 GURL ResolveMappings(const GURL& url) override; 56 GURL ResolveMappings(const GURL& url) override;
47 57
48 std::set<GURL> app_urls_; 58 std::set<GURL> app_urls_;
49 scoped_ptr<TaskRunners> task_runners_; 59 scoped_ptr<TaskRunners> task_runners_;
50 scoped_ptr<ExternalApplicationListener> listener_; 60 scoped_ptr<ExternalApplicationListener> listener_;
51 ApplicationManager application_manager_; 61 ApplicationManager application_manager_;
52 MojoURLResolver mojo_url_resolver_; 62 MojoURLResolver mojo_url_resolver_;
63 GURL shell_file_root_;
53 64
54 DISALLOW_COPY_AND_ASSIGN(Context); 65 DISALLOW_COPY_AND_ASSIGN(Context);
55 }; 66 };
56 67
57 } // namespace shell 68 } // namespace shell
58 } // namespace mojo 69 } // namespace mojo
59 70
60 #endif // SHELL_CONTEXT_H_ 71 #endif // SHELL_CONTEXT_H_
OLDNEW
« no previous file with comments | « shell/android/mojo_main.cc ('k') | shell/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698