OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_STATIC_APPLICATION_LOADER_H_ | 5 #ifndef MOJO_SHELL_STATIC_APPLICATION_LOADER_H_ |
6 #define MOJO_SHELL_STATIC_APPLICATION_LOADER_H_ | 6 #define MOJO_SHELL_STATIC_APPLICATION_LOADER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "mojo/shell/application_loader.h" | 13 #include "mojo/shell/application_loader.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class SimpleThread; | 16 class SimpleThread; |
17 } | 17 } |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 class ApplicationDelegate; | 20 class ShellClient; |
21 } | 21 } |
22 | 22 |
23 namespace mojo { | 23 namespace mojo { |
24 namespace shell { | 24 namespace shell { |
25 | 25 |
26 // An ApplicationLoader which loads a single type of app from a given | 26 // An ApplicationLoader which loads a single type of app from a given |
27 // ApplicationDelegate factory. A Load() request is fulfilled by creating an | 27 // mojo::ShellClient factory. A Load() request is fulfilled by creating an |
28 // instance of the app on a new thread. Only one instance of the app will run at | 28 // instance of the app on a new thread. Only one instance of the app will run at |
29 // a time. Any Load requests received while the app is running will be dropped. | 29 // a time. Any Load requests received while the app is running will be dropped. |
30 class StaticApplicationLoader : public mojo::shell::ApplicationLoader { | 30 class StaticApplicationLoader : public mojo::shell::ApplicationLoader { |
31 public: | 31 public: |
32 using ApplicationFactory = | 32 using ApplicationFactory = |
33 base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>; | 33 base::Callback<scoped_ptr<mojo::ShellClient>()>; |
34 | 34 |
35 // Constructs a static loader for |factory|. | 35 // Constructs a static loader for |factory|. |
36 explicit StaticApplicationLoader(const ApplicationFactory& factory); | 36 explicit StaticApplicationLoader(const ApplicationFactory& factory); |
37 | 37 |
38 // Constructs a static loader for |factory| with a closure that will be called | 38 // Constructs a static loader for |factory| with a closure that will be called |
39 // when the loaded application quits. | 39 // when the loaded application quits. |
40 StaticApplicationLoader(const ApplicationFactory& factory, | 40 StaticApplicationLoader(const ApplicationFactory& factory, |
41 const base::Closure& quit_callback); | 41 const base::Closure& quit_callback); |
42 | 42 |
43 ~StaticApplicationLoader() override; | 43 ~StaticApplicationLoader() override; |
(...skipping 16 matching lines...) Expand all Loading... |
60 | 60 |
61 base::WeakPtrFactory<StaticApplicationLoader> weak_factory_; | 61 base::WeakPtrFactory<StaticApplicationLoader> weak_factory_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(StaticApplicationLoader); | 63 DISALLOW_COPY_AND_ASSIGN(StaticApplicationLoader); |
64 }; | 64 }; |
65 | 65 |
66 } // namespace shell | 66 } // namespace shell |
67 } // namespace mojo | 67 } // namespace mojo |
68 | 68 |
69 #endif // MOJO_SHELL_STATIC_APPLICATION_LOADER_H_ | 69 #endif // MOJO_SHELL_STATIC_APPLICATION_LOADER_H_ |
OLD | NEW |