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 MOJO_RUNNER_CONTEXT_H_ | 5 #ifndef MOJO_RUNNER_CONTEXT_H_ |
6 #define MOJO_RUNNER_CONTEXT_H_ | 6 #define MOJO_RUNNER_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "mojo/edk/embedder/process_delegate.h" | 11 #include "mojo/edk/embedder/process_delegate.h" |
12 #include "mojo/runner/task_runners.h" | 12 #include "mojo/runner/task_runners.h" |
13 #include "mojo/runner/url_resolver.h" | 13 #include "mojo/runner/url_resolver.h" |
14 #include "mojo/shell/application_manager.h" | 14 #include "mojo/shell/application_manager.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace shell { | 17 namespace runner { |
18 | 18 |
19 class NativeApplicationLoader; | 19 class NativeApplicationLoader; |
20 | 20 |
21 // The "global" context for the shell's main process. | 21 // The "global" context for the shell's main process. |
22 class Context : public ApplicationManager::Delegate, | 22 class Context : public shell::ApplicationManager::Delegate, |
23 public embedder::ProcessDelegate { | 23 public embedder::ProcessDelegate { |
24 public: | 24 public: |
25 Context(); | 25 Context(); |
26 ~Context() override; | 26 ~Context() override; |
27 | 27 |
28 static void EnsureEmbedderIsInitialized(); | 28 static void EnsureEmbedderIsInitialized(); |
29 | 29 |
30 // Point to the directory containing installed services, such as the network | 30 // Point to the directory containing installed services, such as the network |
31 // service. By default this directory is used as the base URL for resolving | 31 // service. By default this directory is used as the base URL for resolving |
32 // unknown mojo: URLs. The network service will be loaded from this directory, | 32 // unknown mojo: URLs. The network service will be loaded from this directory, |
(...skipping 16 matching lines...) Expand all Loading... |
49 // which must remain alive until after Shutdown() is called. Returns true on | 49 // which must remain alive until after Shutdown() is called. Returns true on |
50 // success. | 50 // success. |
51 bool Init(); | 51 bool Init(); |
52 | 52 |
53 // If Init() was called and succeeded, this must be called before destruction. | 53 // If Init() was called and succeeded, this must be called before destruction. |
54 void Shutdown(); | 54 void Shutdown(); |
55 | 55 |
56 void Run(const GURL& url); | 56 void Run(const GURL& url); |
57 | 57 |
58 TaskRunners* task_runners() { return task_runners_.get(); } | 58 TaskRunners* task_runners() { return task_runners_.get(); } |
59 ApplicationManager* application_manager() { return &application_manager_; } | 59 shell::ApplicationManager* application_manager() { |
| 60 return &application_manager_; |
| 61 } |
60 URLResolver* url_resolver() { return &url_resolver_; } | 62 URLResolver* url_resolver() { return &url_resolver_; } |
61 | 63 |
62 private: | 64 private: |
63 class NativeViewportApplicationLoader; | 65 class NativeViewportApplicationLoader; |
64 | 66 |
65 // ApplicationManager::Delegate overrides. | 67 // ApplicationManager::Delegate overrides. |
66 GURL ResolveMappings(const GURL& url) override; | 68 GURL ResolveMappings(const GURL& url) override; |
67 GURL ResolveMojoURL(const GURL& url) override; | 69 GURL ResolveMojoURL(const GURL& url) override; |
68 | 70 |
69 // ProcessDelegate implementation. | 71 // ProcessDelegate implementation. |
70 void OnShutdownComplete() override; | 72 void OnShutdownComplete() override; |
71 | 73 |
72 void OnApplicationEnd(const GURL& url); | 74 void OnApplicationEnd(const GURL& url); |
73 | 75 |
74 std::set<GURL> app_urls_; | 76 std::set<GURL> app_urls_; |
75 scoped_ptr<TaskRunners> task_runners_; | 77 scoped_ptr<TaskRunners> task_runners_; |
76 ApplicationManager application_manager_; | 78 shell::ApplicationManager application_manager_; |
77 URLResolver url_resolver_; | 79 URLResolver url_resolver_; |
78 GURL shell_file_root_; | 80 GURL shell_file_root_; |
79 GURL command_line_cwd_; | 81 GURL command_line_cwd_; |
80 | 82 |
81 DISALLOW_COPY_AND_ASSIGN(Context); | 83 DISALLOW_COPY_AND_ASSIGN(Context); |
82 }; | 84 }; |
83 | 85 |
84 } // namespace shell | 86 } // namespace runner |
85 } // namespace mojo | 87 } // namespace mojo |
86 | 88 |
87 #endif // MOJO_RUNNER_CONTEXT_H_ | 89 #endif // MOJO_RUNNER_CONTEXT_H_ |
OLD | NEW |