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