OLD | NEW |
---|---|
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 void SetShellFileRoot(const base::FilePath& path); | |
Aaron Boodman
2015/01/27 00:37:13
Maybe a better name would be: SetMojoURLRoot?
Nick Bray (chromium)
2015/01/27 01:44:35
I'll comment this, but the fact it is the _file_ r
| |
29 GURL ResolveShellFileURL(const std::string& path); | |
Aaron Boodman
2015/01/27 00:37:13
These two methods need comments.
Nick Bray (chromium)
2015/01/27 01:44:35
Done. <troll>But you could say that's against the
Aaron Boodman
2015/01/27 07:29:54
True, but the reason I brought this up in particul
Nick Bray (chromium)
2015/01/27 16:36:25
More comments are always better, particularly when
| |
30 | |
28 static void EnsureEmbedderIsInitialized(); | 31 static void EnsureEmbedderIsInitialized(); |
29 bool Init(); | 32 bool Init(); |
30 | 33 |
31 void Run(const GURL& url); | 34 void Run(const GURL& url); |
32 ScopedMessagePipeHandle ConnectToServiceByName( | 35 ScopedMessagePipeHandle ConnectToServiceByName( |
33 const GURL& application_url, | 36 const GURL& application_url, |
34 const std::string& service_name); | 37 const std::string& service_name); |
35 | 38 |
36 TaskRunners* task_runners() { return task_runners_.get(); } | 39 TaskRunners* task_runners() { return task_runners_.get(); } |
37 ApplicationManager* application_manager() { return &application_manager_; } | 40 ApplicationManager* application_manager() { return &application_manager_; } |
38 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; } | 41 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; } |
39 | 42 |
40 private: | 43 private: |
41 class NativeViewportApplicationLoader; | 44 class NativeViewportApplicationLoader; |
42 | 45 |
43 // ApplicationManager::Delegate override. | 46 // ApplicationManager::Delegate override. |
44 void OnApplicationError(const GURL& url) override; | 47 void OnApplicationError(const GURL& url) override; |
45 GURL ResolveURL(const GURL& url) override; | 48 GURL ResolveURL(const GURL& url) override; |
46 GURL ResolveMappings(const GURL& url) override; | 49 GURL ResolveMappings(const GURL& url) override; |
47 | 50 |
48 std::set<GURL> app_urls_; | 51 std::set<GURL> app_urls_; |
49 scoped_ptr<TaskRunners> task_runners_; | 52 scoped_ptr<TaskRunners> task_runners_; |
50 scoped_ptr<ExternalApplicationListener> listener_; | 53 scoped_ptr<ExternalApplicationListener> listener_; |
51 ApplicationManager application_manager_; | 54 ApplicationManager application_manager_; |
52 MojoURLResolver mojo_url_resolver_; | 55 MojoURLResolver mojo_url_resolver_; |
56 GURL shell_file_root_; | |
53 | 57 |
54 DISALLOW_COPY_AND_ASSIGN(Context); | 58 DISALLOW_COPY_AND_ASSIGN(Context); |
55 }; | 59 }; |
56 | 60 |
57 } // namespace shell | 61 } // namespace shell |
58 } // namespace mojo | 62 } // namespace mojo |
59 | 63 |
60 #endif // SHELL_CONTEXT_H_ | 64 #endif // SHELL_CONTEXT_H_ |
OLD | NEW |