OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_SHELL_APP_CONTAINER_H_ | |
6 #define MOJO_SHELL_APP_CONTAINER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "base/threading/simple_thread.h" | |
12 #include "mojo/public/system/core_cpp.h" | |
13 #include "mojo/shell/loader.h" | |
14 | |
15 namespace base { | |
16 class FilePath; | |
17 class PlatformThreadHandle; | |
18 } | |
19 | |
20 namespace mojo { | |
21 namespace services { | |
22 class NativeViewportImpl; | |
23 } | |
24 namespace shell { | |
25 | |
26 class Context; | |
27 | |
28 // A container class that runs an app on its own thread. | |
29 class AppContainer | |
30 : public Loader::Delegate, | |
31 public base::DelegateSimpleThread::Delegate { | |
32 public: | |
33 explicit AppContainer(Context* context); | |
34 virtual ~AppContainer(); | |
35 | |
36 void Load(const GURL& app_url); | |
37 | |
38 private: | |
39 // From Loader::Delegate. | |
40 virtual void DidCompleteLoad(const GURL& app_url, | |
41 const base::FilePath& app_path) OVERRIDE; | |
42 | |
43 // From base::DelegateSimpleThread::Delegate. | |
44 virtual void Run() OVERRIDE; | |
45 | |
46 void AppCompleted(); | |
47 | |
48 Context* context_; | |
49 base::FilePath app_path_; | |
50 ScopedMessagePipeHandle shell_handle_; | |
51 ScopedMessagePipeHandle app_handle_; | |
52 base::Closure ack_closure_; | |
53 scoped_ptr<Loader::Job> request_; | |
54 scoped_ptr<base::DelegateSimpleThread> thread_; | |
55 scoped_ptr<services::NativeViewportImpl> native_viewport_; | |
56 | |
57 base::WeakPtrFactory<AppContainer> weak_factory_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(AppContainer); | |
60 }; | |
61 | |
62 } // namespace shell | |
63 } // namespace mojo | |
64 | |
65 #endif // MOJO_SHELL_APP_CONTAINER_H_ | |
OLD | NEW |