| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DYNAMIC_APPLICATION_LOADER_H_ | 5 #ifndef MOJO_SHELL_DYNAMIC_APPLICATION_LOADER_H_ |
| 6 #define MOJO_SHELL_DYNAMIC_APPLICATION_LOADER_H_ | 6 #define MOJO_SHELL_DYNAMIC_APPLICATION_LOADER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_vector.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "mojo/application_manager/application_loader.h" | 13 #include "mojo/application_manager/application_loader.h" |
| 13 #include "mojo/public/cpp/system/core.h" | 14 #include "mojo/public/cpp/system/core.h" |
| 14 #include "mojo/services/public/interfaces/network/network_service.mojom.h" | 15 #include "mojo/services/public/interfaces/network/network_service.mojom.h" |
| 15 #include "mojo/shell/dynamic_service_runner.h" | 16 #include "mojo/shell/dynamic_service_runner.h" |
| 16 #include "mojo/shell/keep_alive.h" | |
| 17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 namespace shell { | 20 namespace shell { |
| 21 | 21 |
| 22 class Context; | 22 class Context; |
| 23 class DynamicServiceRunnerFactory; | 23 class DynamicServiceRunnerFactory; |
| 24 class DynamicServiceRunner; |
| 24 | 25 |
| 25 // An implementation of ApplicationLoader that retrieves a dynamic library | 26 // An implementation of ApplicationLoader that retrieves a dynamic library |
| 26 // containing the implementation of the service and loads/runs it (via a | 27 // containing the implementation of the service and loads/runs it (via a |
| 27 // DynamicServiceRunner). | 28 // DynamicServiceRunner). |
| 28 class DynamicApplicationLoader : public ApplicationLoader { | 29 class DynamicApplicationLoader : public ApplicationLoader { |
| 29 public: | 30 public: |
| 30 DynamicApplicationLoader( | 31 DynamicApplicationLoader( |
| 31 Context* context, | 32 Context* context, |
| 32 scoped_ptr<DynamicServiceRunnerFactory> runner_factory); | 33 scoped_ptr<DynamicServiceRunnerFactory> runner_factory); |
| 33 virtual ~DynamicApplicationLoader(); | 34 virtual ~DynamicApplicationLoader(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 48 void LoadLocalService(const GURL& resolved_url, | 49 void LoadLocalService(const GURL& resolved_url, |
| 49 scoped_refptr<LoadCallbacks> callbacks); | 50 scoped_refptr<LoadCallbacks> callbacks); |
| 50 void LoadNetworkService(const GURL& resolved_url, | 51 void LoadNetworkService(const GURL& resolved_url, |
| 51 scoped_refptr<LoadCallbacks> callbacks); | 52 scoped_refptr<LoadCallbacks> callbacks); |
| 52 void OnLoadNetworkServiceComplete(scoped_refptr<LoadCallbacks> callbacks, | 53 void OnLoadNetworkServiceComplete(scoped_refptr<LoadCallbacks> callbacks, |
| 53 URLResponsePtr url_response); | 54 URLResponsePtr url_response); |
| 54 void RunLibrary(const base::FilePath& response_file, | 55 void RunLibrary(const base::FilePath& response_file, |
| 55 scoped_refptr<LoadCallbacks> callbacks, | 56 scoped_refptr<LoadCallbacks> callbacks, |
| 56 bool delete_file_after, | 57 bool delete_file_after, |
| 57 bool response_path_exists); | 58 bool response_path_exists); |
| 59 void RunLibraryComplete(DynamicServiceRunner* runner, |
| 60 const base::FilePath& temp_file); |
| 58 | 61 |
| 59 Context* const context_; | 62 Context* const context_; |
| 60 scoped_ptr<DynamicServiceRunnerFactory> runner_factory_; | 63 scoped_ptr<DynamicServiceRunnerFactory> runner_factory_; |
| 64 ScopedVector<DynamicServiceRunner> runners_; |
| 61 NetworkServicePtr network_service_; | 65 NetworkServicePtr network_service_; |
| 62 URLLoaderPtr url_loader_; | 66 URLLoaderPtr url_loader_; |
| 63 MimeTypeToURLMap mime_type_to_url_; | 67 MimeTypeToURLMap mime_type_to_url_; |
| 64 base::WeakPtrFactory<DynamicApplicationLoader> weak_ptr_factory_; | 68 base::WeakPtrFactory<DynamicApplicationLoader> weak_ptr_factory_; |
| 65 | 69 |
| 66 DISALLOW_COPY_AND_ASSIGN(DynamicApplicationLoader); | 70 DISALLOW_COPY_AND_ASSIGN(DynamicApplicationLoader); |
| 67 }; | 71 }; |
| 68 | 72 |
| 69 } // namespace shell | 73 } // namespace shell |
| 70 } // namespace mojo | 74 } // namespace mojo |
| 71 | 75 |
| 72 #endif // MOJO_SHELL_DYNAMIC_APPLICATION_LOADER_H_ | 76 #endif // MOJO_SHELL_DYNAMIC_APPLICATION_LOADER_H_ |
| OLD | NEW |