| 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_APP_CONTAINER_H_ | 5 #ifndef MOJO_SHELL_APP_CONTAINER_H_ |
| 6 #define MOJO_SHELL_APP_CONTAINER_H_ | 6 #define MOJO_SHELL_APP_CONTAINER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "mojo/loader/job.h" | |
| 12 #include "mojo/public/system/core.h" | 11 #include "mojo/public/system/core.h" |
| 12 #include "mojo/shell/loader.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class FilePath; | 15 class FilePath; |
| 16 class Thread; | 16 class Thread; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 namespace shell { | 20 namespace shell { |
| 21 | 21 |
| 22 class Context; | 22 class Context; |
| 23 | 23 |
| 24 // A container class that runs an app on its own thread. | 24 // A container class that runs an app on its own thread. |
| 25 class AppContainer : public loader::Job::Delegate { | 25 class AppContainer : public Loader::Delegate { |
| 26 public: | 26 public: |
| 27 explicit AppContainer(Context* context); | 27 explicit AppContainer(Context* context); |
| 28 virtual ~AppContainer(); | 28 virtual ~AppContainer(); |
| 29 | 29 |
| 30 void Load(const GURL& app_url); | 30 void Load(const GURL& app_url); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 // From loader::Job::Delegate | 33 // From Loader::Delegate |
| 34 virtual void DidCompleteLoad(const GURL& app_url, | 34 virtual void DidCompleteLoad(const GURL& app_url, |
| 35 const base::FilePath& app_path) OVERRIDE; | 35 const base::FilePath& app_path) OVERRIDE; |
| 36 | 36 |
| 37 void AppCompleted(); | 37 void AppCompleted(); |
| 38 | 38 |
| 39 Context* context_; | 39 Context* context_; |
| 40 scoped_ptr<loader::Job> request_; | 40 scoped_ptr<Loader::Job> request_; |
| 41 scoped_ptr<base::Thread> thread_; | 41 scoped_ptr<base::Thread> thread_; |
| 42 | 42 |
| 43 // Following members are valid only on app thread. | 43 // Following members are valid only on app thread. |
| 44 Handle shell_handle_; | 44 Handle shell_handle_; |
| 45 | 45 |
| 46 base::WeakPtrFactory<AppContainer> weak_factory_; | 46 base::WeakPtrFactory<AppContainer> weak_factory_; |
| 47 | 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(AppContainer); | 48 DISALLOW_COPY_AND_ASSIGN(AppContainer); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace shell | 51 } // namespace shell |
| 52 } // namespace mojo | 52 } // namespace mojo |
| 53 | 53 |
| 54 #endif // MOJO_SHELL_APP_CONTAINER_H_ | 54 #endif // MOJO_SHELL_APP_CONTAINER_H_ |
| OLD | NEW |