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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "mojo/edk/embedder/process_delegate.h" | 14 #include "mojo/edk/embedder/process_delegate.h" |
15 #include "mojo/runner/scoped_user_data_dir.h" | 15 #include "mojo/runner/scoped_user_data_dir.h" |
16 #include "mojo/runner/task_runners.h" | 16 #include "mojo/runner/task_runners.h" |
17 #include "mojo/shell/application_manager.h" | 17 #include "mojo/shell/application_manager.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 | 19 |
20 namespace mojo { | 20 namespace mojo { |
| 21 namespace package_manager { |
| 22 class PackageManagerImpl; |
| 23 } |
21 namespace runner { | 24 namespace runner { |
22 | 25 |
23 class NativeApplicationLoader; | 26 class NativeApplicationLoader; |
24 | 27 |
25 // The "global" context for the shell's main process. | 28 // The "global" context for the shell's main process. |
26 class Context : public embedder::ProcessDelegate { | 29 class Context : public embedder::ProcessDelegate { |
27 public: | 30 public: |
28 explicit Context(const base::FilePath& shell_file_root); | 31 explicit Context(const base::FilePath& shell_file_root); |
29 ~Context() override; | 32 ~Context() override; |
30 | 33 |
(...skipping 14 matching lines...) Expand all Loading... |
45 | 48 |
46 // Run the application specified on the commandline. When the app finishes, | 49 // Run the application specified on the commandline. When the app finishes, |
47 // |callback| is run if not null, otherwise the message loop is quit. | 50 // |callback| is run if not null, otherwise the message loop is quit. |
48 void RunCommandLineApplication(const base::Closure& callback); | 51 void RunCommandLineApplication(const base::Closure& callback); |
49 | 52 |
50 TaskRunners* task_runners() { return task_runners_.get(); } | 53 TaskRunners* task_runners() { return task_runners_.get(); } |
51 shell::ApplicationManager* application_manager() { | 54 shell::ApplicationManager* application_manager() { |
52 return application_manager_.get(); | 55 return application_manager_.get(); |
53 } | 56 } |
54 | 57 |
| 58 package_manager::PackageManagerImpl* package_manager() { |
| 59 return package_manager_; |
| 60 } |
| 61 |
55 private: | 62 private: |
56 class NativeViewportApplicationLoader; | 63 class NativeViewportApplicationLoader; |
57 | 64 |
58 // ProcessDelegate implementation. | 65 // ProcessDelegate implementation. |
59 void OnShutdownComplete() override; | 66 void OnShutdownComplete() override; |
60 | 67 |
61 void OnApplicationEnd(const GURL& url); | 68 void OnApplicationEnd(const GURL& url); |
62 | 69 |
63 ScopedUserDataDir scoped_user_data_dir; | 70 ScopedUserDataDir scoped_user_data_dir; |
64 std::set<GURL> app_urls_; | 71 std::set<GURL> app_urls_; |
65 scoped_ptr<TaskRunners> task_runners_; | 72 scoped_ptr<TaskRunners> task_runners_; |
| 73 base::FilePath shell_file_root_; |
| 74 // Owned by |application_manager_|. |
| 75 package_manager::PackageManagerImpl* package_manager_; |
66 scoped_ptr<shell::ApplicationManager> application_manager_; | 76 scoped_ptr<shell::ApplicationManager> application_manager_; |
67 base::Closure app_complete_callback_; | 77 base::Closure app_complete_callback_; |
68 base::Time main_entry_time_; | 78 base::Time main_entry_time_; |
69 | 79 |
70 DISALLOW_COPY_AND_ASSIGN(Context); | 80 DISALLOW_COPY_AND_ASSIGN(Context); |
71 }; | 81 }; |
72 | 82 |
73 } // namespace runner | 83 } // namespace runner |
74 } // namespace mojo | 84 } // namespace mojo |
75 | 85 |
76 #endif // MOJO_RUNNER_CONTEXT_H_ | 86 #endif // MOJO_RUNNER_CONTEXT_H_ |
OLD | NEW |