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_SHELL_STANDALONE_CONTEXT_H_ | 5 #ifndef MOJO_SHELL_STANDALONE_CONTEXT_H_ |
6 #define MOJO_SHELL_STANDALONE_CONTEXT_H_ | 6 #define MOJO_SHELL_STANDALONE_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/shell/application_manager.h" | 15 #include "mojo/shell/application_manager.h" |
16 #include "mojo/shell/standalone/scoped_user_data_dir.h" | 16 #include "mojo/shell/standalone/scoped_user_data_dir.h" |
17 #include "mojo/shell/standalone/task_runners.h" | 17 #include "mojo/shell/standalone/task_runners.h" |
18 #include "mojo/shell/standalone/tracer.h" | 18 #include "mojo/shell/standalone/tracer.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 | 20 |
21 namespace mojo { | 21 namespace mojo { |
22 namespace shell { | 22 namespace shell { |
23 class NativeApplicationLoader; | 23 class NativeApplicationLoader; |
24 class PackageManagerImpl; | |
25 | 24 |
26 // The "global" context for the shell's main process. | 25 // The "global" context for the shell's main process. |
27 class Context : public edk::ProcessDelegate { | 26 class Context : public edk::ProcessDelegate { |
28 public: | 27 public: |
29 Context(); | 28 Context(); |
30 ~Context() override; | 29 ~Context() override; |
31 | 30 |
32 static void EnsureEmbedderIsInitialized(); | 31 static void EnsureEmbedderIsInitialized(); |
33 | 32 |
34 // This must be called with a message loop set up for the current thread, | 33 // This must be called with a message loop set up for the current thread, |
(...skipping 10 matching lines...) Expand all Loading... |
45 | 44 |
46 // Run the application specified on the commandline. When the app finishes, | 45 // Run the application specified on the commandline. When the app finishes, |
47 // |callback| is run if not null, otherwise the message loop is quit. | 46 // |callback| is run if not null, otherwise the message loop is quit. |
48 void RunCommandLineApplication(const base::Closure& callback); | 47 void RunCommandLineApplication(const base::Closure& callback); |
49 | 48 |
50 TaskRunners* task_runners() { return task_runners_.get(); } | 49 TaskRunners* task_runners() { return task_runners_.get(); } |
51 ApplicationManager* application_manager() { | 50 ApplicationManager* application_manager() { |
52 return application_manager_.get(); | 51 return application_manager_.get(); |
53 } | 52 } |
54 | 53 |
55 PackageManagerImpl* package_manager() { return package_manager_; } | |
56 | |
57 private: | 54 private: |
58 class NativeViewportApplicationLoader; | 55 class NativeViewportApplicationLoader; |
59 | 56 |
60 // ProcessDelegate implementation. | 57 // ProcessDelegate implementation. |
61 void OnShutdownComplete() override; | 58 void OnShutdownComplete() override; |
62 | 59 |
63 void OnApplicationEnd(const GURL& url); | 60 void OnApplicationEnd(const GURL& url); |
64 | 61 |
65 ScopedUserDataDir scoped_user_data_dir; | 62 ScopedUserDataDir scoped_user_data_dir; |
66 std::set<GURL> app_urls_; | 63 std::set<GURL> app_urls_; |
67 scoped_ptr<TaskRunners> task_runners_; | 64 scoped_ptr<TaskRunners> task_runners_; |
68 // Ensure this is destructed before task_runners_ since it owns a message pipe | 65 // Ensure this is destructed before task_runners_ since it owns a message pipe |
69 // that needs the IO thread to destruct cleanly. | 66 // that needs the IO thread to destruct cleanly. |
70 Tracer tracer_; | 67 Tracer tracer_; |
71 // Owned by |application_manager_|. | |
72 PackageManagerImpl* package_manager_; | |
73 scoped_ptr<ApplicationManager> application_manager_; | 68 scoped_ptr<ApplicationManager> application_manager_; |
74 base::Closure app_complete_callback_; | 69 base::Closure app_complete_callback_; |
75 base::Time main_entry_time_; | 70 base::Time main_entry_time_; |
76 | 71 |
77 DISALLOW_COPY_AND_ASSIGN(Context); | 72 DISALLOW_COPY_AND_ASSIGN(Context); |
78 }; | 73 }; |
79 | 74 |
80 } // namespace shell | 75 } // namespace shell |
81 } // namespace mojo | 76 } // namespace mojo |
82 | 77 |
83 #endif // MOJO_SHELL_STANDALONE_CONTEXT_H_ | 78 #endif // MOJO_SHELL_STANDALONE_CONTEXT_H_ |
OLD | NEW |