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_CONTEXT_H_ | 5 #ifndef MOJO_SHELL_CONTEXT_H_ |
6 #define MOJO_SHELL_CONTEXT_H_ | 6 #define MOJO_SHELL_CONTEXT_H_ |
7 | 7 |
8 #include "mojo/service_manager/service_manager.h" | 8 #include "mojo/service_manager/service_manager.h" |
9 #include "mojo/shell/keep_alive.h" | 9 #include "mojo/shell/keep_alive.h" |
10 #include "mojo/shell/loader.h" | 10 #include "mojo/shell/loader.h" |
11 #include "mojo/shell/storage.h" | 11 #include "mojo/shell/storage.h" |
12 #include "mojo/shell/task_runners.h" | 12 #include "mojo/shell/task_runners.h" |
13 | 13 |
14 #if defined(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
15 #include "base/android/scoped_java_ref.h" | 15 #include "base/android/scoped_java_ref.h" |
16 #endif // defined(OS_ANDROID) | 16 #endif // defined(OS_ANDROID) |
17 | 17 |
18 namespace mojo { | 18 namespace mojo { |
| 19 |
| 20 class Spy; |
| 21 |
19 namespace shell { | 22 namespace shell { |
20 | 23 |
21 class DynamicServiceLoader; | 24 class DynamicServiceLoader; |
22 | 25 |
23 // The "global" context for the shell's main process. | 26 // The "global" context for the shell's main process. |
24 class Context { | 27 class Context { |
25 public: | 28 public: |
26 Context(); | 29 Context(); |
27 ~Context(); | 30 ~Context(); |
28 | 31 |
29 TaskRunners* task_runners() { return &task_runners_; } | 32 TaskRunners* task_runners() { return &task_runners_; } |
30 Storage* storage() { return &storage_; } | 33 Storage* storage() { return &storage_; } |
31 Loader* loader() { return &loader_; } | 34 Loader* loader() { return &loader_; } |
32 ServiceManager* service_manager() { return &service_manager_; } | 35 ServiceManager* service_manager() { return &service_manager_; } |
33 KeepAliveCounter* keep_alive_counter() { return &keep_alive_counter_; } | 36 KeepAliveCounter* keep_alive_counter() { return &keep_alive_counter_; } |
34 | 37 |
35 #if defined(OS_ANDROID) | 38 #if defined(OS_ANDROID) |
36 jobject activity() const { return activity_.obj(); } | 39 jobject activity() const { return activity_.obj(); } |
37 void set_activity(jobject activity) { activity_.Reset(NULL, activity); } | 40 void set_activity(jobject activity) { activity_.Reset(NULL, activity); } |
38 #endif // defined(OS_ANDROID) | 41 #endif // defined(OS_ANDROID) |
39 | 42 |
40 private: | 43 private: |
41 TaskRunners task_runners_; | 44 TaskRunners task_runners_; |
42 Storage storage_; | 45 Storage storage_; |
43 Loader loader_; | 46 Loader loader_; |
44 ServiceManager service_manager_; | 47 ServiceManager service_manager_; |
45 scoped_ptr<DynamicServiceLoader> dynamic_service_loader_; | 48 scoped_ptr<DynamicServiceLoader> dynamic_service_loader_; |
| 49 scoped_ptr<Spy> spy_; |
46 | 50 |
47 #if defined(OS_ANDROID) | 51 #if defined(OS_ANDROID) |
48 base::android::ScopedJavaGlobalRef<jobject> activity_; | 52 base::android::ScopedJavaGlobalRef<jobject> activity_; |
49 #endif // defined(OS_ANDROID) | 53 #endif // defined(OS_ANDROID) |
50 | 54 |
51 KeepAliveCounter keep_alive_counter_; | 55 KeepAliveCounter keep_alive_counter_; |
52 | 56 |
53 DISALLOW_COPY_AND_ASSIGN(Context); | 57 DISALLOW_COPY_AND_ASSIGN(Context); |
54 }; | 58 }; |
55 | 59 |
56 } // namespace shell | 60 } // namespace shell |
57 } // namespace mojo | 61 } // namespace mojo |
58 | 62 |
59 #endif // MOJO_SHELL_CONTEXT_H_ | 63 #endif // MOJO_SHELL_CONTEXT_H_ |
OLD | NEW |